]> code.ossystems Code Review - openembedded-core.git/commitdiff
archiver: Drop unwanted directories
authorFabien Lahoudere <fabien.lahoudere@collabora.com>
Mon, 29 Oct 2018 11:02:29 +0000 (12:02 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 24 Nov 2018 21:45:48 +0000 (21:45 +0000)
In sources directory we can find patches/ and temp/.
The first one is filled with symbolic link unusable on another
machines.
The second contains yocto logs to create this archives and are
typically copied when 'S = "${WORKDIR}"'

(From OE-Core rev: 3904f98851c6a63dd9377e38f1432be6b1c0a94d)

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/classes/archiver.bbclass

index 31c9b7eb4b6d4d360f384718ba9064cc324b6ac9..d68add9e5d3fc442e7ad6ef57f78a022900ad42e 100644 (file)
@@ -267,6 +267,14 @@ python do_ar_configured() {
         create_tarball(d, srcdir, 'configured', ar_outdir)
 }
 
+def exclude_useless_paths(tarinfo):
+    if tarinfo.isdir():
+        if tarinfo.name.endswith('/temp') or tarinfo.name.endswith('/patches') or tarinfo.name.endswith('/.pc'):
+            return None
+        elif tarinfo.name == 'temp' or tarinfo.name == 'patches' or tarinfo.name == '.pc':
+            return None
+    return tarinfo
+
 def create_tarball(d, srcdir, suffix, ar_outdir):
     """
     create the tarball from srcdir
@@ -291,7 +299,7 @@ def create_tarball(d, srcdir, suffix, ar_outdir):
 
     bb.note('Creating %s' % tarname)
     tar = tarfile.open(tarname, 'w:gz')
-    tar.add(srcdir, arcname=os.path.basename(srcdir))
+    tar.add(srcdir, arcname=os.path.basename(srcdir), filter=exclude_useless_paths)
     tar.close()
 
 # creating .diff.gz between source.orig and source