HG Fetch with username and password in url
We currently use an company internal mercurial server with username and password authentication that will be accessed during the build of a firmware image from within a custom recipe. The only way to access it from within the yocto toolchain seems to have the username and password stored within the URL of the SRC_URI variable.
But the current hg.py fetcher does not completely support this. Attached is a patch that fixes the missing parts.
Signature · 22 lines
*Volker Vogelhuber*| Softwareentwickler *PENTAX**MEDICA**L */Excellence in Focus//^TM / Tel: +49(0)821-650566-18 [email protected] <mailto:[email protected]> Hoya Corporation - Pentax Medical Division *Digital**Endoscopy GmbH* Paul-Lenz-Str. 5 86316 Friedberg - Germany pentaxmedical.com Handelsregister HRB 27226 Amtsgericht Augsburg Geschäftsführer: Michael Drexel, Marc Henzler Sitz: Paul-Lenz-Str. 5, 86316 Friedberg, Germany _____________________________________ Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
bitbake/lib/bb/fetch2/hg.py +8 -2
@@ -92,7 +92,10 @@ class Hg(FetchMethod): if not ud.user: hgroot = host + ud.path else: - hgroot = ud.user + "@" + host + ud.path + if ud.pswd: + hgroot = ud.user + ":" + ud.pswd + "@" + host + ud.path + else: + hgroot = ud.user + "@" + host + ud.path if command == "info": return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module)
@@ -112,7 +115,10 @@ class Hg(FetchMethod): # do not pass options list; limiting pull to rev causes the local # repo not to contain it and immediately following "update" command # will crash - cmd = "%s pull" % (basecmd) + 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\" pull" % (basecmd, ud.user, ud.pswd, proto) + else: + cmd = "%s pull" % (basecmd) elif command == "update": cmd = "%s update -C %s" % (basecmd, " ".join(options)) else: