Message ID | SI8G.1697802918201554942.vNSZ@lists.yoctoproject.org |
---|---|
State | New |
Headers | show |
Series | Http access token fetching with gitsm fetcher | expand |
Did you already consider to write the credentials in a .netrc file? Regards Adrian <alexzoyv@gmail.com> schrieb am Fr., 20. Okt. 2023, 13:55: > 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 > <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 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#61430): > https://lists.yoctoproject.org/g/yocto/message/61430 > Mute This Topic: https://lists.yoctoproject.org/mt/102079282/4454582 > Group Owner: yocto+owner@lists.yoctoproject.org > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ > adrian.freihofer@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Hi, Le ven. 20 oct. 2023 à 15:32, Adrian Freihofer <adrian.freihofer@gmail.com> a écrit : > Did you already consider to write the credentials in a .netrc file? > > Regards > Adrian > > <alexzoyv@gmail.com> schrieb am Fr., 20. Okt. 2023, 13:55: >> >> 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 I'm sorry but this is a known WONTFIX bug : https://bugzilla.yoctoproject.org/show_bug.cgi?id=13550 See : https://git.openembedded.org/bitbake/tree/lib/bb/fetch2/gitsm.py#n127 The only supported way to do this (that I know of) is to use .netrc as Adrian suggested. Regards,
Adrian, Yoann, Thank you very much and sorry for bringing it up. .netrc does fix my problem. Alex On Fri, Oct 20, 2023 at 04:43 PM, Yoann Congal wrote: > > Hi, > > Le ven. 20 oct. 2023 à 15:32, Adrian Freihofer > <adrian.freihofer@gmail.com> a écrit : > >> Did you already consider to write the credentials in a .netrc file? >> >> Regards >> Adrian >> >> <alexzoyv@gmail.com> schrieb am Fr., 20. Okt. 2023, 13:55: >> >>> >>> 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 >> >> > > I'm sorry but this is a known WONTFIX bug : > https://bugzilla.yoctoproject.org/show_bug.cgi?id=13550 > See : https://git.openembedded.org/bitbake/tree/lib/bb/fetch2/gitsm.py#n127 > > > The only supported way to do this (that I know of) is to use .netrc as > Adrian suggested. > > Regards, > -- > Yoann Congal > Smile ECS - Tech expert
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