summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorVolker Vogelhuber <v.vogelhuber@digitalendoscopy.de>2017-11-16 15:15:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-07 15:12:29 +0000
commitd0ac956dc2454da252ab718267af0dcf504e6a13 (patch)
tree10f447b12f8f70a1b6caafcfe566dfa971ba9f18 /bitbake/lib/bb/fetch2
parent4917e7b1a40559b19d2580f4180ad6ccbfc7fd04 (diff)
downloadpoky-d0ac956dc2454da252ab718267af0dcf504e6a13.tar.gz
bitbake: fetch2/hg: Fix various runtime issues
Fix mercurial fetching after breakage from changes to the core fetcher. Fix username and password usage and setting moddir needed by setup_revisions. (Bitbake rev: 8962b27abc68427eae085624f26300108ae88aa1) Signed-off-by: Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/hg.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index 15d729e7b2..e21115debf 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -54,13 +54,6 @@ class Hg(FetchMethod):
54 else: 54 else:
55 ud.proto = "hg" 55 ud.proto = "hg"
56 56
57 ud.setup_revisions(d)
58
59 if 'rev' in ud.parm:
60 ud.revision = ud.parm['rev']
61 elif not ud.revision:
62 ud.revision = self.latest_revision(ud, d)
63
64 # Create paths to mercurial checkouts 57 # Create paths to mercurial checkouts
65 hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \ 58 hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \
66 ud.host, ud.path.replace('/', '.')) 59 ud.host, ud.path.replace('/', '.'))
@@ -74,6 +67,13 @@ class Hg(FetchMethod):
74 ud.localfile = ud.moddir 67 ud.localfile = ud.moddir
75 ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg" 68 ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg"
76 69
70 ud.setup_revisions(d)
71
72 if 'rev' in ud.parm:
73 ud.revision = ud.parm['rev']
74 elif not ud.revision:
75 ud.revision = self.latest_revision(ud, d)
76
77 ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") 77 ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS")
78 78
79 def need_update(self, ud, d): 79 def need_update(self, ud, d):
@@ -139,7 +139,7 @@ class Hg(FetchMethod):
139 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) 139 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)
140 else: 140 else:
141 cmd = "%s pull" % (ud.basecmd) 141 cmd = "%s pull" % (ud.basecmd)
142 elif command == "update": 142 elif command == "update" or command == "up":
143 if ud.user and ud.pswd: 143 if ud.user and ud.pswd:
144 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)) 144 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))
145 else: 145 else:
@@ -247,12 +247,19 @@ class Hg(FetchMethod):
247 247
248 scmdata = ud.parm.get("scmdata", "") 248 scmdata = ud.parm.get("scmdata", "")
249 if scmdata != "nokeep": 249 if scmdata != "nokeep":
250 proto = ud.parm.get('protocol', 'http')
250 if not os.access(os.path.join(codir, '.hg'), os.R_OK): 251 if not os.access(os.path.join(codir, '.hg'), os.R_OK):
251 logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'") 252 logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'")
252 runfetchcmd("%s init %s" % (ud.basecmd, codir), d) 253 runfetchcmd("%s init %s" % (ud.basecmd, codir), d)
253 logger.debug(2, "Unpack: updating source in '" + codir + "'") 254 logger.debug(2, "Unpack: updating source in '" + codir + "'")
254 runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir) 255 if ud.user and ud.pswd:
255 runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir) 256 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, workdir=codir)
257 else:
258 runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir)
259 if ud.user and ud.pswd:
260 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, workdir=codir)
261 else:
262 runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir)
256 else: 263 else:
257 logger.debug(2, "Unpack: extracting source to '" + codir + "'") 264 logger.debug(2, "Unpack: extracting source to '" + codir + "'")
258 runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir) 265 runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir)