diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-10 15:14:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-10 15:24:31 +0000 |
commit | 59a08262aba2d2b9b8b299a2818fb4cfe13b9909 (patch) | |
tree | f0bbb476887e74ce2aade34bc0f62cff130ed250 /bitbake/lib/bb | |
parent | 5cac57179144e761eec6ccd8ffa43d5d9876fa04 (diff) | |
download | ast2050-yocto-poky-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.zip ast2050-yocto-poky-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.tar.gz |
bitbake/fetch2/git: Write mirror tarballs if enabled and they don't exist, also set a default value for mirror tarball generation
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 4cb6693..6d99406 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -67,6 +67,7 @@ class Git(FetchMethod): gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname) + ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball) ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" @@ -76,6 +77,8 @@ class Git(FetchMethod): if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]): ud.revisions[name] = self.latest_revision(ud.url, ud, d, name) + ud.write_tarballs = (data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0" + ud.localfile = ud.clonedir def localpath(self, url, ud, d): @@ -88,6 +91,8 @@ class Git(FetchMethod): for name in ud.names: if not self._contains_ref(ud.revisions[name], d): return True + if ud.write_tarballs and not os.path.exists(ud.fullmirror): + return True return False def try_premirror(self, u, ud, d): @@ -107,15 +112,13 @@ class Git(FetchMethod): else: username = "" - repofile = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball) - - ud.repochanged = not os.path.exists(repofile) + ud.repochanged = not os.path.exists(ud.fullmirror) # If the checkout doesn't exist and the mirror tarball does, extract it - if not os.path.exists(ud.clonedir) and os.path.exists(repofile): + if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror): bb.mkdirhier(ud.clonedir) os.chdir(ud.clonedir) - runfetchcmd("tar -xzf %s" % (repofile), d) + runfetchcmd("tar -xzf %s" % (ud.fullmirror), d) # If the repo still doesn't exist, fallback to cloning it if not os.path.exists(ud.clonedir): @@ -144,13 +147,10 @@ class Git(FetchMethod): def build_mirror_data(self, url, ud, d): # Generate a mirror tarball if needed - repofile = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball) - - os.chdir(ud.clonedir) - mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) - if mirror_tarballs != "0" and ud.repochanged: + if ud.write_tarballs and (ud.repochanged or not os.path.exists(ud.fullmirror)): + os.chdir(ud.clonedir) logger.info("Creating tarball of git repository") - runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".") ), d) + runfetchcmd("tar -czf %s %s" % (ud.fullmirror, os.path.join(".") ), d) def unpack(self, ud, destdir, d): """ unpack the downloaded src to destdir""" |