Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de>
To: <bitbake-devel@lists.openembedded.org>
Subject: HG Fetch with username and password in url
Date: Tue, 29 Oct 2013 17:31:15 +0100	[thread overview]
Message-ID: <526FE2D3.7020808@digitalendoscopy.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

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.

// This time in plain text, sorry for doing HTML mail

[-- Attachment #2: hg_with_user_name_and_passwd.patch --]
[-- Type: text/x-patch, Size: 1360 bytes --]

diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index b1c8675..cf21481 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -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:


             reply	other threads:[~2013-10-29 16:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 16:31 Volker Vogelhuber [this message]
2013-11-01 17:56 ` HG Fetch with username and password in url Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2014-04-29 15:34 Volker Vogelhuber
2013-10-29 16:28 Volker Vogelhuber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526FE2D3.7020808@digitalendoscopy.de \
    --to=v.vogelhuber@digitalendoscopy.de \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox