summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/hg.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2015-09-15 13:56:06 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-18 09:04:26 +0100
commiteaaa81393f181432c8586b17ade623f42c9fed2e (patch)
tree2e735f01b1e3ae1c0bb5a8d6209a0a26704fdebc /lib/bb/fetch2/hg.py
parent38f935647dd768a912b933adebfc9cb225a01a54 (diff)
downloadbitbake-contrib-eaaa81393f181432c8586b17ade623f42c9fed2e.tar.gz
bb.fetch2.{git, hg}: remove tarball if it needs updating
We were maintaining state in the form of ud.repochanged to determine whether we need to write the tarball in the case where the tarball already exists, but this state is maintained only in memory. If we need to update the git repo, set ud.repochanged to True, and then are interrupted or killed, the tarball will then be out of date. Rather than maintaining this state, simply remove the out of date tarball when we update the git repo, and it will be re-created with updated content in build_mirror_data. [YOCTO #6366] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/hg.py')
-rw-r--r--lib/bb/fetch2/hg.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch2/hg.py
index d978630ba..bbb4ed95d 100644
--- a/lib/bb/fetch2/hg.py
+++ b/lib/bb/fetch2/hg.py
@@ -163,8 +163,6 @@ class Hg(FetchMethod):
def download(self, ud, d):
"""Fetch url"""
- ud.repochanged = not os.path.exists(ud.fullmirror)
-
logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
# If the checkout doesn't exist and the mirror tarball does, extract it
@@ -189,7 +187,11 @@ class Hg(FetchMethod):
logger.debug(1, "Running %s", pullcmd)
bb.fetch2.check_network_access(d, pullcmd, ud.url)
runfetchcmd(pullcmd, d)
- ud.repochanged = True
+ try:
+ os.unlink(ud.fullmirror)
+ except OSError as exc:
+ if exc.errno != errno.ENOENT:
+ raise
# No source found, clone it.
if not os.path.exists(ud.moddir):
@@ -238,7 +240,7 @@ class Hg(FetchMethod):
def build_mirror_data(self, ud, d):
# Generate a mirror tarball if needed
- if ud.write_tarballs == "1" and (ud.repochanged or not os.path.exists(ud.fullmirror)):
+ if ud.write_tarballs == "1" and not os.path.exists(ud.fullmirror):
# it's possible that this symlink points to read-only filesystem with PREMIRROR
if os.path.islink(ud.fullmirror):
os.unlink(ud.fullmirror)