All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: andr2000@gmail.com,
	Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: [PATCH 3/4] fetch2/repo: Make fetcher always sync on unpack
Date: Tue, 24 Oct 2017 14:35:43 +0300	[thread overview]
Message-ID: <1508844944-5761-4-git-send-email-andr2000@gmail.com> (raw)
In-Reply-To: <1508844944-5761-1-git-send-email-andr2000@gmail.com>

From: Oleksandr Andrushchenko <oleksandr_andrushchenko@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@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



  parent reply	other threads:[~2017-10-24 11:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 11:35 [PATCH 0/4] fetch2/repo: Repo fetcher fixes and improvements Oleksandr Andrushchenko
2017-10-24 11:35 ` [PATCH 1/4] fetch2/repo: Fix missing logger import in repo fetcher Oleksandr Andrushchenko
2017-10-24 11:35 ` [PATCH 2/4] fetch2/repo: Always check if branch is correct Oleksandr Andrushchenko
2017-10-24 11:35 ` Oleksandr Andrushchenko [this message]
2017-11-07 13:45   ` [PATCH 3/4] fetch2/repo: Make fetcher always sync on unpack Richard Purdie
2017-11-07 19:31     ` Oleksandr Andrushchenko
2017-11-08 18:09       ` Richard Purdie
2017-10-24 11:35 ` [PATCH 4/4] fetch2/repo: Use multiple jobs to fetch and sync Oleksandr Andrushchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508844944-5761-4-git-send-email-andr2000@gmail.com \
    --to=andr2000@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=oleksandr_andrushchenko@epam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.