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

Submitted by Leif Middelschulte on June 4, 2019, 4:01 p.m. | Patch ID: 161955

Details

Message ID 20190604160137.5636-2-leif.middelschulte@klsmartin.com
State New
Headers show

Commit Message

Leif Middelschulte June 4, 2019, 4:01 p.m.
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@klsmartin.com>
---
 lib/bb/fetch2/git.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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 = ""