[bitbake-devel] [PATCH 3/4] fetch2/repo: Make fetcher always sync on unpack
Oleksandr Andrushchenko
andr2000 at gmail.com
Tue Oct 24 11:35:43 UTC 2017
From: Oleksandr Andrushchenko <oleksandr_andrushchenko at epam.com>
Currently if repo has fetched the repository and
cached it to a tar file it never runs repo sync again,
thus making the build use potentially outdated repo.
Fix this by implementing unpack functionality which runs
repo sync.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko at epam.com>
---
lib/bb/fetch2/repo.py | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch2/repo.py
index 861437dd22b2..3c28fe04ab1e 100644
--- a/lib/bb/fetch2/repo.py
+++ b/lib/bb/fetch2/repo.py
@@ -52,6 +52,10 @@ class Repo(FetchMethod):
ud.manifest += '.xml'
ud.localfile = d.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch))
+ repodir = d.getVar("REPODIR", True) or os.path.join(d.getVar("DL_DIR", True), "repo")
+ gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
+ ud.codir = os.path.join(repodir, gitsrcname, ud.manifest)
+ ud.repodir = os.path.join(ud.codir, "repo")
def download(self, ud, d):
"""Fetch url"""
@@ -60,22 +64,17 @@ class Repo(FetchMethod):
logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath)
return
- gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
- repodir = d.getVar("REPODIR") or os.path.join(d.getVar("DL_DIR"), "repo")
- codir = os.path.join(repodir, gitsrcname, ud.manifest)
-
if ud.user:
username = ud.user + "@"
else:
username = ""
- repodir = os.path.join(codir, "repo")
- bb.utils.mkdirhier(repodir)
+ bb.utils.mkdirhier(ud.repodir)
bb.fetch2.check_network_access(d, "repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url)
- runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=repodir)
+ runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=ud.repodir)
bb.fetch2.check_network_access(d, "repo sync %s" % ud.url, ud.url)
- runfetchcmd("repo sync", d, workdir=repodir)
+ runfetchcmd("repo sync", d, workdir=ud.repodir)
scmdata = ud.parm.get("scmdata", "")
if scmdata == "keep":
@@ -84,7 +83,12 @@ class Repo(FetchMethod):
tar_flags = "--exclude='.repo' --exclude='.git'"
# Create a cache
- runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d, workdir=codir)
+ runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d, workdir=ud.codir)
+
+ def unpack(self, ud, destdir, d):
+ FetchMethod.unpack(self, ud, destdir, d)
+ bb.fetch2.check_network_access(d, "repo sync %s" % ud.url, ud.url)
+ runfetchcmd("repo sync", d, workdir=ud.repodir)
def supports_srcrev(self):
return False
--
2.7.4
More information about the bitbake-devel
mailing list