fetch2/repo.py: improve unpack to copy only asked project.
PATCH 1/1 fetch2/repo.py: improve unpack to copy only asked project.
From: Nicolas Cornu <[email protected]>
Today this fetcher copy the whole repo projects in each sub-project.
---
This patch is not here to be merged, but to have review on it.
The problem that this patch try to fix is that if your google-repo got 150 projects, and you want to build each with a specific recipe, sources will be copied each time.
lib/bb/fetch2/repo.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
lib/bb/fetch2/repo.py +17 -0
@@ -89,6 +89,23 @@ class Repo(FetchMethod): # Create a cache runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d, workdir=codir) + def unpack(self, ud, destdir, d): + """unpack the project from repo source directories""" + + repodir = d.getVar("REPODIR") or (d.getVar("DL_DIR") + "/repo") + gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", ".")) + codir = os.path.join(repodir, gitsrcname, ud.manifest) + repodir = os.path.join(codir, "repo") + + # With this command I get the full path to the project in the "repo" download dir. + full_path_to_download = runfetchcmd("%s list --path-only --fullpath %s" % ("repo", d.getVar("PN")), d, workdir=repodir) + + # I do this or git clone say the directory is not empty. + runfetchcmd("rm -rf %s" % d.getVar("S"), d, workdir=destdir) + + # Is it ok, here to use "S" directly? I see no fetcher do that. + runfetchcmd("git clone %s %s" % (full_path_to_download.strip(), d.getVar("S")), d, workdir=destdir) + def supports_srcrev(self): return False
Signature · 1 line
2.17.1