From: Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de>
To: <yocto@yoctoproject.org>
Subject: Mercurial Authorization and Fetch with AUTOREV
Date: Fri, 29 Jan 2016 11:54:29 +0100 [thread overview]
Message-ID: <56AB44E5.6090507@digitalendoscopy.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
Due to the change in commit 9e24bde011479d9f22830080720510e52e9923d8
within the hg.py fetcher that it calls runfetchmd with "up" instead of
"update" there's a
problem when handling username and password access in _buildhgcommand.
Another problem in the hg.py is when we use AUTOREV for fetching the
latest revision.
In this case the call to setup_revisons in urldata_init results in an
access to ud.moddir that
is not yet populated. So the block for creating ud.pkgdir, ud.moddir and
ud.basecmd has
to be moved to the top.
Following patch should fix both issues.
[-- Attachment #2: hg.patch --]
[-- Type: text/x-patch, Size: 3341 bytes --]
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index 3b743ff..06b305c 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -67,13 +67,6 @@ class Hg(FetchMethod):
else:
ud.proto = "hg"
- ud.setup_revisons(d)
-
- if 'rev' in ud.parm:
- ud.revision = ud.parm['rev']
- elif not ud.revision:
- ud.revision = self.latest_revision(ud, d)
-
# Create paths to mercurial checkouts
hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \
ud.host, ud.path.replace('/', '.'))
@@ -86,6 +79,13 @@ class Hg(FetchMethod):
ud.localfile = ud.moddir
ud.basecmd = data.getVar("FETCHCMD_hg", d, True) or "/usr/bin/env hg"
+ ud.setup_revisons(d)
+
+ if 'rev' in ud.parm:
+ ud.revision = ud.parm['rev']
+ elif not ud.revision:
+ ud.revision = self.latest_revision(ud, d)
+
ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS", True)
def need_update(self, ud, d):
@@ -151,7 +151,7 @@ class Hg(FetchMethod):
cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull" % (ud.basecmd, ud.user, ud.pswd, proto)
else:
cmd = "%s pull" % (ud.basecmd)
- elif command == "update":
+ elif command == "update" or command == "up":
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\" update -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options))
else:
@@ -265,13 +265,20 @@ class Hg(FetchMethod):
scmdata = ud.parm.get("scmdata", "")
if scmdata != "nokeep":
+ proto = ud.parm.get('protocol', 'http')
if not os.access(os.path.join(codir, '.hg'), os.R_OK):
logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'")
runfetchcmd("%s init %s" % (ud.basecmd, codir), d)
logger.debug(2, "Unpack: updating source in '" + codir + "'")
os.chdir(codir)
- runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d)
- runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d)
+ if ud.user and ud.pswd:
+ runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull %s" % (ud.basecmd, ud.user, ud.pswd, proto, ud.moddir), d)
+ else:
+ runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d)
+ if ud.user and ud.pswd:
+ runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" up -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, revflag), d)
+ else:
+ runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d)
else:
logger.debug(2, "Unpack: extracting source to '" + codir + "'")
os.chdir(ud.moddir)
reply other threads:[~2016-01-29 10:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=56AB44E5.6090507@digitalendoscopy.de \
--to=v.vogelhuber@digitalendoscopy.de \
--cc=yocto@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.