[yocto] [yocto-autobuilder-helper][PATCH 4/4] layer-config, shared-repo-unpack: Sub-repos in NEEDREPOS

Thomas Goodwin btgoodwin at geontech.com
Thu Aug 1 11:37:34 PDT 2019


The previous fixes requires the user to set "no-layer-add"
for a repo and then use ADDLAYER to insert the sub-repos
(e.g., meta-openmbedded/meta-oe) as a two-part process.
This means that you would also have to specify that flag
if a repo that is a layer with dependencies is in the
list so that it can be inserted in the correct order later
via ADDLAYER to avoid parsing problems.  This fix allows
for specifying a NEEDREPOS with the subdirectory of the
target layer (e.g., meta-openembedded/meta-oe) so that
there is no need for the "no-layer-add" followed by
ADDLAYER combination.  The entire meta-openembedded
repo would be moved into place, and the sublayer added
to bblayers.conf.

Signed-off-by: Thomas Goodwin <btgoodwin at geontech.com>
---
 scripts/layer-config       | 24 +++++++++++++++---------
 scripts/shared-repo-unpack |  4 ++--
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/scripts/layer-config b/scripts/layer-config
index 286451a..bb1b681 100755
--- a/scripts/layer-config
+++ b/scripts/layer-config
@@ -33,21 +33,27 @@ callinit = False
 repos = utils.getconfig("repo-defaults", ourconfig)
 
 for repo in needrepos:
-    checkdir = repo
-    if repo in repos:
-        if "call-init" in repos[repo] and repos[repo]["call-init"]:
+    repo_basename = repo.split('/')[0]
+    checkdir = repo_basename
+    if repo_basename in repos:
+        if "call-init" in repos[repo_basename] and repos[repo_basename]["call-init"]:
             callinit = True
-        if "checkout-dirname" in repos[repo]:
-            checkdir = repos[repo]["checkout-dirname"]
-    utils.mkdir(args.abworkdir + "/" + checkdir)
-    for f in os.listdir(args.abworkdir + "/repos/" + repo):
-        subprocess.check_call(['mv', args.abworkdir + "/repos/" + repo + "/" + f, args.abworkdir + "/" + checkdir + "/"])
+        if "checkout-dirname" in repos[repo_basename]:
+            checkdir = repos[repo_basename]["checkout-dirname"]
+
+    source = args.abworkdir + "/repos/" + repo_basename
+    destination = args.abworkdir + "/" + checkdir
+    if not os.path.isdir(destination) or callinit:
+        utils.mkdir(destination)
+        for f in os.listdir(source):
+            subprocess.check_call(['mv', source + "/" + f, destination + "/"])
 
 if callinit:
     subprocess.check_call(". ./oe-init-build-env", shell=True, cwd=args.abworkdir)
 
 for repo in needrepos:
-    if repo in repos and "no-layer-add" in repos[repo] and repos[repo]["no-layer-add"]:
+    repo_basename = repo.split('/')[0]
+    if repo_basename in repos and "no-layer-add" in repos[repo_basename] and repos[repo_basename]["no-layer-add"]:
         continue
     try:
         bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
diff --git a/scripts/shared-repo-unpack b/scripts/shared-repo-unpack
index 65ac7cb..e52b53b 100755
--- a/scripts/shared-repo-unpack
+++ b/scripts/shared-repo-unpack
@@ -43,9 +43,9 @@ with open(args.repojson) as f:
     repos = json.load(f)
 
 targetsubdir = args.abworkdir + "/repos"
-
+needrepos_baseddirs = [r.split('/')[0] for r in needrepos]
 for repo in sorted(repos.keys()):
-    if repo not in needrepos:
+    if repo not in needrepos_baseddirs:
         continue
     targetrepodir = "%s/%s" % (targetsubdir, repo)
     if args.cache_dir:
-- 
2.17.1



More information about the yocto mailing list