Skip to contentSkip to conversation

config.json: Added meta-openembedded and meta-virtualization

PATCH New Thomas Goodwin 1 participant 4 messages Aug 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 config.json: Added meta-openembedded and meta-virtualization

The meta-openembedded has no top-level conf/layer.conf, so layer-config's attempt to add it fails (silently). Adding it to the config.json with no-layer-add set to true will bypass this silent failure.

The meta-virtualization fails because its repo isn't defined. Once defined, it has a conf/layer.conf, so it's presence in NEEDREPOS will cause ADDLAYER to fail because the former will add it to the bblayers.conf before its dependencies are added during run-config (causing bitbake-layers to error out). The fix is to also specify no-layer-add.

---
 config.json | 13 +++++++++++++
 1 file changed, 13 insertions(+)
config.json +13 -0
index 62954ce..2252b83 100644
@@ -921,6 +921,19 @@
             "url" : "git://git.yoctoproject.org/meta-gplv2",
             "branch" : "master",
             "revision" : "HEAD"
+        },
+        "meta-virtualization" : {
+            "url" : "git://git.yoctoproject.org/meta-virtualization",
+            "branch" : "master",
+            "revision" : "HEAD",
+            "no-layer-add" : true
+        },
+        "meta-openembedded" : {
+            "url" : "git://git.openembedded.org/meta-openembedded",
+            "branch" : "master",
+            "revision" : "HEAD",
+            "no-layer-add" : true
         }
+
     }
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/4 layer-config: fixing silent failures from always exiting '0'

The return value from bitbakecmd was not being returned when errors occurred which allowed shared-repo-unpack to succeed despite the failure. This fix changes to check_call and a try-catch when attempting to add repos that fail for whatever reason during add-layer, like a missing conf/layer.conf at the top level or a previously-added layer breaks parsing because of missing dependencies.

---
 scripts/layer-config | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
scripts/layer-config +6 -5
index bfc62da..286451a 100755
@@ -24,9 +24,7 @@ args = parser.parse_args()
 ourconfig = utils.loadconfig()
 
 def bitbakecmd(targetdir, cmd):
-    ret = subprocess.call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)
-    if ret:
-        utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (cmd, ret))
+    subprocess.check_call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)
 
 needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, args.target, None)
 
@@ -51,5 +49,8 @@ if callinit:
 for repo in needrepos:
     if repo in repos and "no-layer-add" in repos[repo] and repos[repo]["no-layer-add"]:
         continue
-    bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
-
+    try:
+        bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
+    except subprocess.CalledProcessError as e:
+        utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (e.cmd, e.returncode))
+        sys.exit(e.returncode)
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/4 shared-repo-unpack: suppressing exception, returning exit code

In reply to Thomas Goodwin

The preceeding errors that would be shown should be enough to identify the problem since it would have been a problem running bitbake-layers add-layer, indicating a misconfiguration of config.json.

---
 scripts/shared-repo-unpack | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/shared-repo-unpack +4 -1
index a9e8678..65ac7cb 100755
@@ -58,4 +58,7 @@ for repo in sorted(repos.keys()):
         if args.publish_dir:
             utils.publishrepo(targetsubdir, repo, args.publish_dir)
 
-subprocess.check_call([scriptsdir + "/layer-config", args.abworkdir, args.target])
+try:
+    subprocess.check_call([scriptsdir + "/layer-config", args.abworkdir, args.target])
+except subprocess.CalledProcessError as e:
+    sys.exit(e.returncode)
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/4 layer-config, shared-repo-unpack: Sub-repos in NEEDREPOS

In reply to Thomas Goodwin

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.

---
 scripts/layer-config       | 24 +++++++++++++++---------
 scripts/shared-repo-unpack |  4 ++--
 2 files changed, 17 insertions(+), 11 deletions(-)
scripts/layer-config +15 -9
index 286451a..bb1b681 100755
@@ -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))
scripts/shared-repo-unpack +2 -2
index 65ac7cb..e52b53b 100755
@@ -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:
Signature · 1 line
2.17.1