summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-10 15:14:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-10 15:24:31 +0000
commit59a08262aba2d2b9b8b299a2818fb4cfe13b9909 (patch)
treef0bbb476887e74ce2aade34bc0f62cff130ed250 /bitbake
parent5cac57179144e761eec6ccd8ffa43d5d9876fa04 (diff)
downloadopenembedded-core-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.tar.gz
openembedded-core-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.tar.bz2
openembedded-core-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.tar.xz
openembedded-core-59a08262aba2d2b9b8b299a2818fb4cfe13b9909.zip
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')
-rw-r--r--bitbake/lib/bb/fetch2/git.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 4cb669350..6d9940677 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"""