From patchwork Fri Oct 20 11:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexzoyv@gmail.com X-Patchwork-Id: 32635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE69CCDB474 for ; Fri, 20 Oct 2023 11:55:27 +0000 (UTC) Subject: Http access token fetching with gitsm fetcher To: yocto@lists.yoctoproject.org From: alexzoyv@gmail.com X-Originating-Location: RU (193.232.110.5) X-Originating-Platform: Linux Chrome 118 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Fri, 20 Oct 2023 04:55:18 -0700 Message-ID: List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 20 Oct 2023 11:55:27 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/61430 Greetings! I try to use gitsm fetcher to fetch bitbucket repository with read-only https access token. SRC_URI looks like this > > > SRC_URI = > "gitsm://******.git;protocol=https;branch=${BRANCH};user=azoykin:${TOKEN}" > > This recipe fetches parent repository, but is unable to fetch submodule, writing fatal: could not read Username for 'https://tps-git.topcon.com': No such device or address in log.do_fetch It happens because url is passed to fetcher function already with user string. I suggest a patch to fix this issue diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py index c5f7c03c..3a025624 100644 --- a/lib/bb/fetch2/gitsm.py +++ b/lib/bb/fetch2/gitsm.py @@ -100,6 +100,10 @@ class GitSM(Git): # Properly formated URL already proto = uris[module].split(':', 1)[0] url = uris[module].replace('%s:' % proto, 'gitsm:', 1) + # remove user+password from string to add them as parameter + if ud.user in url: + url = url.replace(ud.user + '@', '') + url += ";user=%s" % ud.user else: if ":" in uris[module]: # Most likely an SSH style reference