[bitbake-devel] [PATCH 1/1] bitbake: fetch2/git: set password in https clones too

Leif Middelschulte leif.middelschulte at klsmartin.com
Tue Jun 4 16:01:37 UTC 2019


Fetching submodules via https, using the basic HTTP auth scheme, failed.

Example for a broken URL:
SRC_URI = "gitsm://example.com/some_repo.git;protocol=https;user=john:secret"

Now, if some_repo.git had a relative submodule, the initial clone would fail:
> fatal: could not read Username for 'https://example.com':
> No such device or address

This happended, because the password was correctly read into another
`ud`-field (`pswd`), but not added back, when the URL was rebuilt.

Signed-off-by: Leif Middelschulte <leif.middelschulte at klsmartin.com>
---
 lib/bb/fetch2/git.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index e171aa7e..7afc2b52 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -570,7 +570,9 @@ class Git(FetchMethod):
         """
         Return the repository URL
         """
-        if ud.user:
+        if ud.user and ud.pswd:
+            username = "%s:%s@" % (ud.user, ud.pswd)
+        elif ud.user:
             username = ud.user + '@'
         else:
             username = ""
-- 
2.21.0



More information about the bitbake-devel mailing list