<p dir="ltr">Thanks for the heads up, I'll poke at it this evening.</p>
<div class="gmail_quote">On 18 May 2015 1:26 am, "Robert Yang" <<a href="mailto:liezhi.yang@windriver.com">liezhi.yang@windriver.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello,<br>
<br>
This patches breaks the BB_GENERATE_MIRROR_TARBALLS, it doesn't generate<br>
or untar the local tarball any more, the local tarball's mirror doesn't<br>
work any more.<br>
<br>
// Robert<br>
<br>
On 05/12/2015 11:25 AM, Dan McGregor wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Daniel McGregor <<a href="mailto:daniel.mcgregor@vecima.com" target="_blank">daniel.mcgregor@vecima.com</a>><br>
<br>
Use hg clone and hg pull to copy the source into the build<br>
directory rather than taring up the cloned repository and<br>
untarring in the destination.<br>
<br>
This allows submodules to be cloned. While here, make the default<br>
behaviour keep the hg scm data to match the behaviour of the git<br>
fetcher.<br>
<br>
Signed-off-by: Daniel McGregor <<a href="mailto:daniel.mcgregor@vecima.com" target="_blank">daniel.mcgregor@vecima.com</a>><br>
---<br>
lib/bb/fetch2/hg.py | 55 +++++++++++++++++++++++++++++++++++------------------<br>
1 file changed, 36 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch2/hg.py<br>
index 81592f6..6547cca 100644<br>
--- a/lib/bb/fetch2/hg.py<br>
+++ b/lib/bb/fetch2/hg.py<br>
@@ -64,7 +64,9 @@ class Hg(FetchMethod):<br>
elif not ud.revision:<br>
ud.revision = self.latest_revision(ud, d)<br>
<br>
- ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)<br>
+ ud.localfile = ud.moddir<br>
+<br>
+ ud.basecmd = data.getVar("FETCHCMD_hg", d, True) or "/usr/bin/env hg"<br>
<br>
def need_update(self, ud, d):<br>
revTag = ud.parm.get('rev', 'tip')<br>
@@ -80,8 +82,6 @@ class Hg(FetchMethod):<br>
command is "fetch", "update", "info"<br>
"""<br>
<br>
- basecmd = data.expand('${FETCHCMD_hg}', d)<br>
-<br>
proto = ud.parm.get('protocol', 'http')<br>
<br>
host = ud.host<br>
@@ -98,7 +98,7 @@ class Hg(FetchMethod):<br>
hgroot = ud.user + "@" + host + ud.path<br>
<br>
if command == "info":<br>
- return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module)<br>
+ return "%s identify -i %s://%s/%s" % (ud.basecmd, proto, hgroot, ud.module)<br>
<br>
options = [];<br>
<br>
@@ -111,22 +111,22 @@ class Hg(FetchMethod):<br>
<br>
if command == "fetch":<br>
if ud.user and ud.pswd:<br>
- 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, proto, " ".join(options), proto, hgroot, ud.module, ud.module)<br>
+ 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" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options), proto, hgroot, ud.module, ud.module)<br>
else:<br>
- cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module) <br>
+ cmd = "%s clone %s %s://%s/%s %s" % (ud.basecmd, " ".join(options), proto, hgroot, ud.module, ud.module)<br>
elif command == "pull":<br>
# do not pass options list; limiting pull to rev causes the local<br>
# repo not to contain it and immediately following "update" command<br>
# will crash<br>
if ud.user and ud.pswd:<br>
- 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)<br>
+ 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)<br>
else:<br>
- cmd = "%s pull" % (basecmd)<br>
+ cmd = "%s pull" % (ud.basecmd)<br>
elif command == "update":<br>
if ud.user and ud.pswd:<br>
- cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" update -C %s" % (basecmd, ud.user, ud.pswd, proto, " ".join(options))<br>
+ 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))<br>
else:<br>
- cmd = "%s update -C %s" % (basecmd, " ".join(options))<br>
+ cmd = "%s update -C %s" % (ud.basecmd, " ".join(options))<br>
else:<br>
raise FetchError("Invalid hg command %s" % command, ud.url)<br>
<br>
@@ -163,15 +163,6 @@ class Hg(FetchMethod):<br>
logger.debug(1, "Running %s", updatecmd)<br>
runfetchcmd(updatecmd, d)<br>
<br>
- scmdata = ud.parm.get("scmdata", "")<br>
- if scmdata == "keep":<br>
- tar_flags = ""<br>
- else:<br>
- tar_flags = "--exclude '.hg' --exclude '.hgrags'"<br>
-<br>
- os.chdir(ud.pkgdir)<br>
- runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d, cleanup = [ud.localpath])<br>
-<br>
def supports_srcrev(self):<br>
return True<br>
<br>
@@ -191,3 +182,29 @@ class Hg(FetchMethod):<br>
Return a unique key for the url<br>
"""<br>
return "hg:" + ud.moddir<br>
+<br>
+ def localpath(self, ud, d):<br>
+ return ud.moddir<br>
+<br>
+ def unpack(self, ud, destdir, d):<br>
+ """<br>
+ Make a local clone or export for the url<br>
+ """<br>
+<br>
+ revflag = "-r %s" % ud.revision<br>
+ subdir = ud.parm.get("destsuffix", ud.module)<br>
+ codir = "%s/%s" % (destdir, subdir)<br>
+<br>
+ scmdata = ud.parm.get("scmdata", "")<br>
+ if scmdata != "nokeep":<br>
+ if not os.access(os.path.join(codir, '.hg'), os.R_OK):<br>
+ logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'")<br>
+ runfetchcmd("%s init %s" % (ud.basecmd, codir), d)<br>
+ logger.debug(2, "Unpack: updating source in '" + codir + "'")<br>
+ os.chdir(codir)<br>
+ runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d)<br>
+ runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d)<br>
+ else:<br>
+ logger.debug(2, "Unpack: extracting source to '" + codir + "'")<br>
+ os.chdir(ud.moddir)<br>
+ runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d)<br>
<br>
</blockquote>
</blockquote></div>