[yocto] archiver.bbclass raising exception

Urs Ritzmann Urs.Ritzmann at kistler.com
Tue Nov 1 09:55:09 PDT 2016


I switched from yocto 2.0.1 to yocto 2.1.1 and use the archiver class with the following settings:
INHERIT += "archiver"
ARCHIVER_MODE[src] = "original"
ARCHIVER_MODE[recipe] = "1"

I'm getting this exception:

ERROR: dbus-c++-native-0.9.0-r8 do_ar_recipe: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
 *** 0002:do_ar_recipe(d)
File: '/home/riu/projects/skybase-build/next/yocto/poky-krogoth-15.0.1/meta/classes/archiver.bbclass', lineno: 323, function: do_ar_recipe
     0319:    pn = d.getVar('PN', True)
     0320:    bbappend_files = d.getVar('BBINCLUDED', True).split()
     0321:    # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend
     0322:    # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded.
 *** 0323:    bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn)
     0324:    bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn)
     0325:    for file in bbappend_files:
     0326:        if bbappend_re.match(file) or bbappend_re1.match(file):
     0327:            shutil.copy(file, outdir)
Exception: error: multiple repeat

Looks like the recipe archiver function (do_ar_recipe) has its problems with .bbappend files containing special characters like '+' or '-'. I think this is a bug because these should be valid characters for recipe names, right? Or do I miss something? I fixed my setup by just escaping the package name before it is used in the regular expression, like so:

>From 1d3a75d21025012d86c67e8ff5b8b2880a99141c Mon Sep 17 00:00:00 2001
From: Urs Ritzmann <urs.ritzmann at kistler.com>
Date: Tue, 25 Oct 2016 17:18:39 +0200
Subject: [PATCH] archiver: fix do_ar_recipe for recipe names including regex

 meta/classes/archiver.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 2f3b278..94741bf 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -315,7 +315,7 @@ python do_ar_recipe () {
     shutil.copy(bbfile, outdir)
-    pn = d.getVar('PN', True)
+    pn = re.escape(d.getVar('PN', True))
     bbappend_files = d.getVar('BBINCLUDED', True).split()
     # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend
     # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded.

The archiver code relevant for this issue is introduced in yocto-2.1 and seems to be unchanged in master and master-next branches of poky.

Thanks and
BR Urs

More information about the yocto mailing list