Patchwork [bitbake-devel] HG clone with username and password in url

login
register
mail settings
Submitter Volker Vogelhuber
Date May 9, 2014, 8:12 a.m.
Message ID <536C8E01.5050600@digitalendoscopy.de>
Download mbox | patch
Permalink /patch/71807/
State New
Headers show

Comments

Volker Vogelhuber - May 9, 2014, 8:12 a.m.
Unfortunately my last patch for the hg fetcher (in dylan's bitbake 
version) with username and password was incomplete.
The following patch hopefully fixes all cases where username and pasword 
authorization may be required.

Patch

From ed81d51a391c39aa42d01bf9ebf00e9f88dd9c90 Mon Sep 17 00:00:00 2001
From: Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de>
Date: Fri, 9 May 2014 10:10:13 +0200
Subject: [PATCH] fix cloning of mercurial repository with username and
 password specified in url

Signed-off-by: Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de>
---
 bitbake/lib/bb/fetch2/hg.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index cf21481..8c41d4d 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -110,7 +110,10 @@  class Hg(FetchMethod):
             options.append("-r %s" % ud.revision)
 
         if command == "fetch":
-            cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)
+            if ud.user and ud.pswd:
+                cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" clone %s %s://%s/%s %s" % (basecmd, ud.user, ud.pswd, " ".join(options), proto, hgroot, ud.module, ud.module)
+            else:
+                cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)	      
         elif command == "pull":
             # do not pass options list; limiting pull to rev causes the local
             # repo not to contain it and immediately following "update" command
-- 
1.9.1