Yocto Project Discussions
 help / color / mirror / Atom feed
* Http access token fetching with gitsm fetcher
@ 2023-10-20 11:55 alexzoyv
  2023-10-20 13:32 ` [yocto] " Adrian Freihofer
  0 siblings, 1 reply; 7+ messages in thread
From: alexzoyv @ 2023-10-20 11:55 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 543 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 605 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gits.patch --]
[-- Type: text/x-patch; name="gits.patch", Size: 704 bytes --]

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-22  6:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 11:55 Http access token fetching with gitsm fetcher alexzoyv
2023-10-20 13:32 ` [yocto] " Adrian Freihofer
2023-10-20 13:43   ` Yoann CONGAL
2023-10-20 14:32     ` alexzoyv
2024-04-19 13:25       ` [yocto] " Altous, Salahaldeen
2024-04-19 13:44         ` Janne Kiiskila
2024-04-22  6:52           ` Altous, Salahaldeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox