[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5816/8267] package_ipk: Split into two functions



commit 8454756453789060be677d9ea1402a92b269d779
Author: Richard Purdie <richard purdie linuxfoundation org>
Date:   Thu Mar 30 22:02:08 2017 +0100

    package_ipk: Split into two functions
    
    This prepares the way to parallelise ipk generation and splits the iteration
    over packages and the package generation into separate functions. Whitespace
    indentation is unchanged deliberately and is fixed in a followup patch. There
    should be no functional change.
    
    (From OE-Core rev: f190d8456c7e135164d3073acfb3319e75c9de76)
    
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/classes/package_ipk.bbclass |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index c7cec9d..16ee761 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -17,11 +17,6 @@ OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKA
 OPKGLIBDIR = "${localstatedir}/lib"
 
 python do_package_ipk () {
-    import re, copy
-    import textwrap
-    import subprocess
-    import collections
-
     oldcwd = os.getcwd()
 
     workdir = d.getVar('WORKDIR')
@@ -42,13 +37,27 @@ python do_package_ipk () {
     if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
         os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
 
-    def cleanupcontrol(root):
-        for p in ['CONTROL', 'DEBIAN']:
-            p = os.path.join(root, p)
-            if os.path.exists(p):
-                bb.utils.prunedir(p)
-
     for pkg in packages.split():
+        ipk_write_pkg(pkg, d)
+
+    os.chdir(oldcwd)
+}
+
+def ipk_write_pkg(pkg, d):
+        import re, copy
+        import subprocess
+        import textwrap
+        import collections
+
+        def cleanupcontrol(root):
+            for p in ['CONTROL', 'DEBIAN']:
+                p = os.path.join(root, p)
+                if os.path.exists(p):
+                    bb.utils.prunedir(p)
+
+        outdir = d.getVar('PKGWRITEDIRIPK')
+        pkgdest = d.getVar('PKGDEST')
+
         localdata = bb.data.createCopy(d)
         root = "%s/%s" % (pkgdest, pkg)
 
@@ -99,7 +108,7 @@ python do_package_ipk () {
         if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
             bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), 
localdata.getVar('PKGR')))
             bb.utils.unlockfile(lf)
-            continue
+            return
 
         controldir = os.path.join(root, 'CONTROL')
         bb.utils.mkdirhier(controldir)
@@ -239,10 +248,9 @@ python do_package_ipk () {
         cleanupcontrol(root)
         bb.utils.unlockfile(lf)
 
-    os.chdir(oldcwd)
-}
 # Otherwise allarch packages may change depending on override configuration
-do_package_ipk[vardepsexclude] = "OVERRIDES"
+ipk_write_pkg[vardepsexclude] = "OVERRIDES"
+
 
 SSTATETASKS += "do_package_write_ipk"
 do_package_write_ipk[sstate-inputdirs] = "${PKGWRITEDIRIPK}"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]