Skip to contentSkip to conversation

Add ${S} to do_unpack[cleandirs]

PATCH New Markus Lehtonen 1 participant 2 messages Aug 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Add ${S} to do_unpack[cleandirs]

The second version of this patch broke usage of externalsrc. The resason was that while externalsrc.bbclass mangles do_unpack[cleandirs] flag in order to make sure that the source directory is never wiped, it was not able to cope with the complicated Python expression used in the flag value in v2 of this patch. Version 3 of the patch fixes the issue by moving Python code outside the value assignment.

Markus Lehtonen (1):
base.bbclass wipe ${S} before unpacking source

 meta/classes/base.bbclass | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
2.6.6
#1 lore raw

PATCH v3 1/1 base.bbclass wipe ${S} before unpacking source

Make sure that we have a pristine source tree after do_unpack.

[YOCTO #9064]

---
 meta/classes/base.bbclass | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
meta/classes/base.bbclass +9 -10
index 5d8e8d6..39acd1e 100644
@@ -136,23 +136,22 @@ python base_do_fetch() {
 
 addtask unpack after do_fetch
 do_unpack[dirs] = "${WORKDIR}"
+
+python () {
+    if d.getVar('S', True) != d.getVar('WORKDIR', True):
+        d.setVarFlag('do_unpack', 'cleandirs', '${S}')
+    else:
+        d.setVarFlag('do_unpack', 'cleandirs', os.path.join('${S}', 'patches'))
+}
+
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI', True) or "").split()
     if len(src_uri) == 0:
         return
 
-    rootdir = d.getVar('WORKDIR', True)
-
-    # Ensure that we cleanup ${S}/patches
-    # TODO: Investigate if we can remove
-    # the entire ${S} in this case.
-    s_dir = d.getVar('S', True)
-    p_dir = os.path.join(s_dir, 'patches')
-    bb.utils.remove(p_dir, True)
-
     try:
         fetcher = bb.fetch2.Fetch(src_uri, d)
-        fetcher.unpack(rootdir)
+        fetcher.unpack(d.getVar('WORKDIR', True))
     except bb.fetch2.BBFetchException as e:
         raise bb.build.FuncFailed(e)
 }
Signature · 1 line
2.6.6