Skip to contentSkip to conversation

archiver.bbclass: fix some errors for do_ar_original and do_ar_recipe

PATCH New Dengke Du 1 participant 3 messages Dec 7, 2016

lore
Share & tools
lore

Dengke Du

author
#0 lore raw

cover archiver.bbclass: fix some errors for do_ar_original and do_ar_recipe

The following changes since commit 9e63f81c78e284c9b325fe04a1b59e61c7ad8a1a:

bitbake: ast: remove BBVERSIONS support (2016-11-30 15:48:10 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ddk/fix-some-error-for-archiver-bbclass
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ddk/fix-some-error-for-archiver-bbclass

Dengke Du (2):
archiver.bbclass: fix do_ar_original error for matchbox-desktop archiver.bbclass: fix do_ar_recipe error for bonnie++ and

    libsigc++-2.0
 meta/classes/archiver.bbclass | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 archiver.bbclass: fix do_ar_original error for matchbox-desktop

Error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: matchbox-desktop-2.1-r0 do_ar_original: Can not determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: git://git.yoctoproject.org/matchbox-desktop-2
file://vfolders/%2A

ERROR: matchbox-desktop-2.1-r0 do_ar_original: Function failed: do_ar_original
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In function do_ar_original, when recipes have more than one source, it added the "name" URL parameter as suffix to identify the created tarball.

But the URL type "file://" that we always used to represent a series of patches, it didn't have "name" parameter, so it failed.

So set "name" to the folder name to identify the created tarball, for example:

In matchbox-desktop bb file, the SRC_URI contains:

	file://vfloders/*

We set "name" to "vfolders" to identify the created tarball.

In connman-gnome bb file, the SRC_URI contains:

	file://images/*

We set "name" to "images" to identify the created tarball.

---
 meta/classes/archiver.bbclass | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
meta/classes/archiver.bbclass +11 -5
index 9239983..fe8877b 100644
@@ -166,12 +166,18 @@ python do_ar_original() {
             # to be set when using the git fetcher, otherwise SRCREV cannot
             # be set separately for each URL.
             params = bb.fetch2.decodeurl(url)[5]
+            type = bb.fetch2.decodeurl(url)[0]
+            location = bb.fetch2.decodeurl(url)[2]
             name = params.get('name', '')
-            if name in tarball_suffix:
-                if not name:
-                    bb.fatal("Cannot determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: %s %s" % (tarball_suffix[name], url))
-                else:
-                    bb.fatal("Cannot determine archive names for original source because 'name=' URL parameter '%s' is used twice. Make it unique in: %s %s" % (tarball_suffix[name], url))
+            if type.lower() == 'file':
+                name_tmp = location.rstrip("*").rstrip("/")
+                name = os.path.basename(name_tmp)
+            else:
+                if name in tarball_suffix:
+                    if not name:
+                        bb.fatal("Cannot determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: %s %s" % (tarball_suffix[name], url))
+                    else:
+                        bb.fatal("Cannot determine archive names for original source because 'name=' URL parameter '%s' is used twice. Make it unique in: %s %s" % (tarball_suffix[name], url))
             tarball_suffix[name] = url
             create_tarball(d, tmpdir + '/.', name, ar_outdir)
 
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/2 archiver.bbclass: fix do_ar_recipe error for bonnie++ and libsigc++-2.0

In reply to Dengke Du

When recipes name contains regular expression special characters, such as "++", in this case, the re.compile function in do_ar_recipe can't recognize it, so we should associate with re.escape to recognize the special characters in pattern.

---
 meta/classes/archiver.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes/archiver.bbclass +3 -2
index fe8877b..7d89e44 100644
@@ -359,8 +359,9 @@ python do_ar_recipe () {
     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.
-    bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn)
-    bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn)
+    # If the "pn" contains regular expression special characters, we should use re.escape to recognize it.
+    bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn))
+    bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn))
     for file in bbappend_files:
         if bbappend_re.match(file) or bbappend_re1.match(file):
             shutil.copy(file, outdir)
Signature · 1 line
2.7.4