[oe-commits] [openembedded-core] 11/17: archiver.bbclass: ignore unpack sub-directories in do_ar_original

git at git.openembedded.org git at git.openembedded.org
Tue Sep 27 12:13:55 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit bb59605cf21ed5952f69a45cc5c611187e279894
Author: Patrick Ohly <patrick.ohly at intel.com>
AuthorDate: Mon Sep 26 11:55:15 2016 +0200

    archiver.bbclass: ignore unpack sub-directories in do_ar_original
    
    Support for absolute paths in the "subdir" parameter was recently
    added (bitbake rev: c3873346c6fa). The git fetcher has supported
    absolute paths in "destsuffix" already before.
    
    When the path is absolute as in destsuffix=${S}/foobar, the tmpdir
    used by do_ar_original gets ignored, which breaks:
    - source code archiving (tmpdir is empty)
    - compilation due to race conditions (for example, ${S} getting
      modified by do_ar_original while do_compile runs)
    
    To solve this, these parameters get removed from URLs before
    instantiating the fetcher for them.
    
    This is done unconditionally also for relative paths, because these
    paths are not useful when archiving the original source (upstream
    source does not have them, they only get used by the recipe during
    compilation).
    
    Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/archiver.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 2f3b278..5f9c91d 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -132,7 +132,25 @@ python do_ar_original() {
 
     ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
     bb.note('Archiving the original source...')
-    fetch = bb.fetch2.Fetch([], d)
+    urls = d.getVar("SRC_URI", True).split()
+    # destsuffix (git fetcher) and subdir (everything else) are allowed to be
+    # absolute paths (for example, destsuffix=${S}/foobar).
+    # That messes with unpacking inside our tmpdir below, because the fetchers
+    # will then unpack in that directory and completely ignore the tmpdir.
+    # That breaks parallel tasks relying on ${S}, like do_compile.
+    #
+    # To solve this, we remove these parameters from all URLs.
+    # We do this even for relative paths because it makes the content of the
+    # archives more useful (no extra paths that are only used during
+    # compilation).
+    for i, url in enumerate(urls):
+        decoded = bb.fetch2.decodeurl(url)
+        for param in ('destsuffix', 'subdir'):
+            if param in decoded[5]:
+                del decoded[5][param]
+        encoded = bb.fetch2.encodeurl(decoded)
+        urls[i] = encoded
+    fetch = bb.fetch2.Fetch(urls, d)
     for url in fetch.urls:
         local = fetch.localpath(url).rstrip("/");
         if os.path.isfile(local):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list