Skip to contentSkip to conversation

Packaging performance improvements

PATCH In review Richard Purdie 4 participants 23 messages Jan 30, 2013 – Jan 31, 2013

lore
Share & tools
lore
#0 lore raw

cover Packaging performance improvements

The following patch series contains a number of packaging improvements along with a couple of bugfixes (one multilib, one directfb).

The following changes since commit cf05c4578c99c0cb885cf2706f7f2b39b100aeb8:

module.bbclass: Don't add pkg_postinst/pkg_prerm to all packages in recipe (2013-01-29 23:51:59 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core master-next
http://cgit.openembedded.org/cgit.cgi/openembedded-core/log/?h=master-next

Richard Purdie (16):
multilib.conf: Use BASELIB to set baselib, not hardcode the value
sstate: Move debug comment to more logical place insane.bbclass: Fix incorrect getVar call
package: Rename splitfile functions to something more descriptive package.bbclass: Improve kernel module handling package.bbclass: Add a shortcut exit from the mkdir function package.bbclass: Check FILES once, not once per loop iteration package.bbclass: Avoid copying the datastore for FILES handling package.bbclass: Move PKG handling code to emit_pkgdata package.bbclass: Split out package_fixsymlinks function package.bbclass: Tweak PACKAGEFUNCS
package.bbclass: Improve package_fixsymlinks
package: Create global package file list and use throughout
PACKAGEFUNCS
package.bbclass: Use expanded RDEPENDS in read_shlibdeps package_ipk/deb/rpm: Ensure deploy staging directory is empty before
rerunning task
directfb: Explictly disable mesa

 meta/classes/buildhistory.bbclass                  |   11 +-
 meta/classes/debian.bbclass                        |   28 ++-
 meta/classes/insane.bbclass                        |    6 +-
 meta/classes/package.bbclass                       |  202 ++++++++++----------
 meta/classes/package_deb.bbclass                   |    1 +
 meta/classes/package_ipk.bbclass                   |    1 +
 meta/classes/package_rpm.bbclass                   |    1 +
 meta/classes/sstate.bbclass                        |    2 +-
 meta/conf/multilib.conf                            |    2 +-
 meta/recipes-graphics/directfb/directfb.inc        |    1 +
 12 files changed, 141 insertions(+), 138 deletions(-)
#1 lore raw

PATCH 1/17 alsa-tools: upgrade to 1.0.26.1

From: Cristian Iorga <[email protected]>

Removed the following tools:
- all related to hdsp (required gtk+ and fltk-config)
- ld10k1, qlo10k1 (required QT)
- hdajackretask

Fixed the automake issue for cross-compilation

---
 .../{alsa-tools-1.0.25 => alsa-tools}/autotools.patch     |   13 +++++++------
 .../alsa/{alsa-tools_1.0.25.bb => alsa-tools_1.0.26.1.bb} |   11 +++++++----
 2 files changed, 14 insertions(+), 10 deletions(-)
 rename meta/recipes-multimedia/alsa/{alsa-tools-1.0.25 => alsa-tools}/autotools.patch (81%)
 rename meta/recipes-multimedia/alsa/{alsa-tools_1.0.25.bb => alsa-tools_1.0.26.1.bb} (71%)
meta/recipes-multimedia/alsa/alsa-tools/autotools.patch renamed from meta/recipes-multimedia/alsa/alsa-tools-1.0.25/autotools.patch +7 -6
similarity index 81%
rename from meta/recipes-multimedia/alsa/alsa-tools-1.0.25/autotools.patch
rename to meta/recipes-multimedia/alsa/alsa-tools/autotools.patch
index c7bc2d6..294e970 100644
@@ -19,16 +19,17 @@ diff -ruN alsa-tools-1.0.24.1-orig//ld10k1/gitcompile alsa-tools-1.0.24.1/ld10k1
 diff -ruN alsa-tools-1.0.24.1-orig//Makefile alsa-tools-1.0.24.1/Makefile
 --- alsa-tools-1.0.24.1-orig//Makefile	2011-07-06 11:27:40.207665000 +0800
 +++ alsa-tools-1.0.24.1/Makefile	2011-07-14 15:08:08.877665009 +0800
-@@ -1,9 +1,8 @@
- VERSION = 1.0.24.1
+@@ -1,9 +1,9 @@
+ VERSION = 1.0.26.1
  TOP = .
 -SUBDIRS = ac3dec as10k1 envy24control hdsploader hdspconf hdspmixer \
 -	  mixartloader pcxhrloader rmedigicontrol sb16_csp seq sscape_ctl \
 -	  us428control usx2yloader vxloader echomixer ld10k1 qlo10k1 \
--	  hwmixvolume
-+SUBDIRS = ac3dec as10k1 hdsploader mixartloader pcxhrloader sb16_csp \
-+          seq sscape_ctl us428control usx2yloader vxloader ld10k1 \
-+          hwmixvolume
+-	  hwmixvolume hdajackretask hda-verb
++SUBDIRS = ac3dec as10k1 envy24control \
++	  mixartloader pcxhrloader rmedigicontrol sb16_csp seq sscape_ctl \
++	  us428control usx2yloader vxloader echomixer \
++	  hwmixvolume hda-verb
  
  all:
  	@for i in $(SUBDIRS); do \
meta/recipes-multimedia/alsa/alsa-tools_1.0.26.1.bb renamed from meta/recipes-multimedia/alsa/alsa-tools_1.0.25.bb +7 -4
similarity index 71%
rename from meta/recipes-multimedia/alsa/alsa-tools_1.0.25.bb
rename to meta/recipes-multimedia/alsa/alsa-tools_1.0.26.1.bb
index 7d96b85..0fe4bee 100644
@@ -1,5 +1,3 @@
-BROKEN = "1"
-
 DESCRIPTION = "Alsa Tools package contains advanced tools for certain sound cards."
 HOMEPAGE = "http://www.alsa-project.org"
 BUGTRACKER = "https://bugtrack.alsa-project.org/alsa-bug/login_page.php"
@@ -15,11 +13,16 @@ LIC_FILES_CHKSUM = "file://hdsploader/COPYING;md5=94d55d512a9ba36caa9b7df079bae1
 SRC_URI = "ftp://ftp.alsa-project.org/pub/tools/alsa-tools-${PV}.tar.bz2 \
            file://autotools.patch"
 
-SRC_URI[md5sum] = "57bfec98a814d12e0f7ab379aaeccd87"
-SRC_URI[sha256sum] = "a974d0f3e837796f67d04df88c783aebcf4ac3c5f9ac31e2b65c10e8cb4b1dca"
+SRC_URI[md5sum] = "805526ea5d6c40e1f2c94cee86141230"
+SRC_URI[sha256sum] = "553338693707fe6ddfc430b9edc4cd2677390e200c9e38de82ede3394e733841"
 
 inherit autotools
 
 EXTRA_OEMAKE += "GITCOMPILE_ARGS='--host=${HOST_SYS} --build=${BUILD_SYS} --target=${TARGET_SYS} --with-libtool-sysroot=${STAGING_DIR_HOST} --prefix=${prefix}' ACLOCAL_FLAGS='-I ${STAGING_DATADIR}/aclocal'"
 
+do_compile_prepend () {
+    #Automake dir is not correctly detected in cross compilation case
+    export AUTOMAKE_DIR=${STAGING_DATADIR_NATIVE}/$(ls ${STAGING_DATADIR_NATIVE} | grep automake)
+}
+
 FILES_${PN} += "${datadir}/ld10k1"
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/17 multilib.conf: Use BASELIB to set baselib, not hardcode the value

---
 meta/conf/multilib.conf |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/multilib.conf +1 -1
index 97b53ec..f86cff0 100644
@@ -1,5 +1,5 @@
 
-baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or 'lib'}"
+baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or d.getVar('BASELIB', True)}"
 
 MULTILIB_VARIANTS = "${@extend_variants(d,'MULTILIBS','multilib')}"
 MULTILIB_SAVE_VARNAME = "DEFAULTTUNE"
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/17 sstate: Move debug comment to more logical place

In reply to Richard Purdie

The same log message gets output multiple times in the log which look confusing and is rather pointless. Move the log message to the correct level.

---
 meta/classes/sstate.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/sstate.bbclass +1 -1
index edddd2f..a79d2b5 100644
@@ -146,8 +146,8 @@ def sstate_install(ss, d):
         locks.append(bb.utils.lockfile(lock))
 
     for state in ss['dirs']:
+        bb.debug(2, "Staging files from %s to %s" % (state[1], state[2]))
         for walkroot, dirs, files in os.walk(state[1]):
-            bb.debug(2, "Staging files from %s to %s" % (state[1], state[2]))
             for file in files:
                 srcpath = os.path.join(walkroot, file)
                 dstpath = srcpath.replace(state[1], state[2])
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/17 insane.bbclass: Fix incorrect getVar call

In reply to Richard Purdie

On a trace I was a bit puzzled why getVar was making 180 calls to len(d). This is an expensive operation that should be very rarely called and certainly not by getVar. In perl's do_package it was resulting in ~1.5 million function calls from those 180 cases.

Ultimately this typo was why. Lets fix it and save the CPU cyles.

---
 meta/classes/insane.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/insane.bbclass +1 -1
index c5c84b8..015abd5 100644
@@ -404,7 +404,7 @@ def package_qa_check_arch(path,name,d, elf, messages):
 
     target_os   = d.getVar('TARGET_OS', True)
     target_arch = d.getVar('TARGET_ARCH', True)
-    provides = d.getVar('PROVIDES', d, True)
+    provides = d.getVar('PROVIDES', True)
     bpn = d.getVar('BPN', True)
 
     # FIXME: Cross package confuse this check, so just skip them
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/17 package: Rename splitfile functions to something more descriptive

In reply to Richard Purdie

The splitfile and splitfile2 function names are confusing and the comments are also misleading, hard to understand or plain incorrect. This tries to improve things.

---
 meta/classes/package.bbclass |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +9 -12
index 71c6179..0be84ed 100644
@@ -223,13 +223,12 @@ python () {
         d.setVar("PACKAGERDEPTASK", "")
 }
 
-def splitfile(file, debugfile, debugsrcdir, d):
-    # Function to split a single file, called from split_and_strip_files below
-    # A working 'file' (one which works on the target architecture)
-    # is split and the split off portions go to debugfile.
+def splitdebuginfo(file, debugfile, debugsrcdir, d):
+    # Function to split a single file into two components, one is the stripped
+    # target system binary, the other contains any debugging information. The
+    # two files are linked to reference each other.
     #
-    # The debug information is then processed for src references.  These
-    # references are copied to debugsrcdir, if defined.
+    # sourcefile is also generated containing a list of debugsources
 
     import commands, stat, subprocess
 
@@ -267,10 +266,8 @@ def splitfile(file, debugfile, debugsrcdir, d):
 
     return 0
 
-def splitfile2(debugsrcdir, d):
-    # Function to split a single file, called from split_and_strip_files below
-    #
-    # The debug src information processed in the splitfile2 is further procecessed
+def copydebugsources(debugsrcdir, d):
+    # The debug src information written out to sourcefile is further procecessed
     # and copied to the destination here.
 
     import commands, stat, subprocess
@@ -875,7 +872,7 @@ python split_and_strip_files () {
                 bb.mkdirhier(os.path.dirname(fpath))
                 #bb.note("Split %s -> %s" % (file, fpath))
                 # Only store off the hard link reference if we successfully split!
-                if splitfile(file, fpath, debugsrcdir, d) == 0 and file_reference != "":
+                if splitdebuginfo(file, fpath, debugsrcdir, d) == 0 and file_reference != "":
                     file_links[file_reference] = file
 
         # The above may have generated dangling symlinks, remove them!
@@ -899,7 +896,7 @@ python split_and_strip_files () {
 
         # Process the debugsrcdir if requested...
         # This copies and places the referenced sources for later debugging...
-        splitfile2(debugsrcdir, d)
+        copydebugsources(debugsrcdir, d)
     #
     # End of debug splitting
     #
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 6/17 package.bbclass: Improve kernel module handling

In reply to Richard Purdie

Currently the kernel module handling consists of several special cases and has its own path walking. This refactors the code to handle them in a more standardised way which is also a bit more efficient.

---
 meta/classes/package.bbclass |   37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)
meta/classes/package.bbclass +16 -21
index 0be84ed..0f11ba9 100644
@@ -325,10 +325,6 @@ def runstrip(file, elftype, d):
     pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
     strip = d.getVar("STRIP", True)
 
-    # Handle kernel modules specifically - .debug directories here are pointless
-    if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
-        return subprocess.call("%s'%s' --strip-debug --remove-section=.comment --remove-section=.note --preserve-dates '%s'" % (pathprefix, strip, file), shell=True)
-
     newmode = None
     if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
         origmode = os.stat(file)[stat.ST_MODE]
@@ -337,15 +333,14 @@ def runstrip(file, elftype, d):
 
     extraflags = ""
     
-    # split_and_strip_files is calling this with elf_type None, causing:
-    # TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
-    if elftype:
-        # .so and shared library
-        if ".so" in file and elftype & 8:
-            extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
-        # shared or executable:
-        elif elftype & 8 or elftype & 4:
-            extraflags = "--remove-section=.comment --remove-section=.note"
+    # .so and shared library
+    if elftype & 16:
+        extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
+    elif ".so" in file and elftype & 8:
+        extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
+    # shared or executable:
+    elif elftype & 8 or elftype & 4:
+        extraflags = "--remove-section=.comment --remove-section=.note"
 
     stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
     bb.debug(1, "runstrip: %s" % stripcmd)
@@ -749,6 +744,7 @@ python split_and_strip_files () {
     # 2 - stripped
     # 4 - executable
     # 8 - shared library
+    # 16 - kernel module
     def isELF(path):
         type = 0
         pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
@@ -775,11 +771,16 @@ python split_and_strip_files () {
     #
     file_list = {}
     file_links = {}
+    kernmods = []
     if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT', True) != '1') and \
             (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
         for root, dirs, files in os.walk(dvar):
             for f in files:
                 file = os.path.join(root, f)
+                if file.endswith(".ko") and file.find("/lib/modules/") != -1:
+                    kernmods.append(file)
+                    continue
+
                 # Only process files (and symlinks)... Skip files that are obviously debug files
                 if not (debugappend != "" and file.endswith(debugappend)) and \
                    not (debugdir != "" and debugdir in os.path.dirname(file[len(dvar):])) and \
@@ -910,14 +911,8 @@ python split_and_strip_files () {
                 elf_file = int(file_list[file][5:])
                 #bb.note("Strip %s" % file)
                 runstrip(file, elf_file, d)
-
-
-    if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
-        for root, dirs, files in os.walk(dvar):
-            for f in files:
-                if not f.endswith(".ko"):
-                    continue
-                runstrip(os.path.join(root, f), 0, d)
+        for f in kernmods:
+            runstrip(f, 16, d)
     #
     # End of strip
     #
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 7/17 package.bbclass: Add a shortcut exit from the mkdir function

In reply to Richard Purdie

The mkdir function iterates over strings with many different operations, even if ultimately the target already exists. This adds a check to the start of the function so we don't waste time when the target already exists.

---
 meta/classes/package.bbclass |    2 ++
 1 file changed, 2 insertions(+)
meta/classes/package.bbclass +2 -0
index 0f11ba9..8b256cf 100644
@@ -997,6 +997,8 @@ python populate_packages () {
                     seen.append(p)
 
             def mkdir_recurse(src, dest, paths):
+                if os.path.exists(dest + '/' + paths):
+                    return
                 while paths.startswith("./"):
                     paths = paths[2:]
                 p = "."
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 8/17 package.bbclass: Check FILES once, not once per loop iteration

In reply to Richard Purdie

There is no need to check FILES in each loop iteration, we can just check it once at the start when we read the variable.

---
 meta/classes/package.bbclass |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/package.bbclass +3 -3
index 8b256cf..51ab009 100644
@@ -961,12 +961,12 @@ python populate_packages () {
         bb.data.update_data(localdata)
 
         filesvar = localdata.getVar('FILES', True) or ""
+        if "//" in filesvar:
+            bb.warn("FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg)
+            filesvar.replace("//", "/")
         files = filesvar.split()
         file_links = {}
         for file in files:
-            if file.find("//") != -1:
-                bb.warn("FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg)
-                file.replace("//", "/")
             if os.path.isabs(file):
                 file = '.' + file
             if not os.path.islink(file):
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 9/17 package.bbclass: Avoid copying the datastore for FILES handling

In reply to Richard Purdie

There is no real point in adjusting overrides and creating a copy of the datastore, just to access a single variable. We can do this just as easily with a slightly more complicated getVar call. This improves performance.

---
 meta/classes/package.bbclass |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
meta/classes/package.bbclass +1 -10
index 51ab009..4e7db9a 100644
@@ -949,18 +949,10 @@ python populate_packages () {
     seen = []
 
     for pkg in package_list:
-        localdata = bb.data.createCopy(d)
         root = os.path.join(pkgdest, pkg)
         bb.mkdirhier(root)
 
-        localdata.setVar('PKG', pkg)
-        overrides = localdata.getVar('OVERRIDES', True)
-        if not overrides:
-            raise bb.build.FuncFailed('OVERRIDES not defined')
-        localdata.setVar('OVERRIDES', overrides + ':' + pkg)
-        bb.data.update_data(localdata)
-
-        filesvar = localdata.getVar('FILES', True) or ""
+        filesvar = d.getVar('FILES_%s' % pkg, True) or d.getVar('FILES', True) or ""
         if "//" in filesvar:
             bb.warn("FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg)
             filesvar.replace("//", "/")
@@ -1023,7 +1015,6 @@ python populate_packages () {
             if ret is False or ret == 0:
                 raise bb.build.FuncFailed("File population failed")
 
-        del localdata
     os.chdir(workdir)
 
     unshipped = []
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 10/17 package.bbclass: Move PKG handling code to emit_pkgdata

In reply to Richard Purdie

We only use the PKG variable in emit_pkgdata so we might as well move the fallback code there, allowing restructuring of other parts of the metadata.

---
 meta/classes/package.bbclass |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
meta/classes/package.bbclass +5 -6
index 4e7db9a..858afbd 100644
@@ -1038,11 +1038,6 @@ python populate_packages () {
 
     bb.build.exec_func("package_name_hook", d)
 
-    for pkg in package_list:
-        pkgname = d.getVar('PKG_%s' % pkg, True)
-        if pkgname is None:
-            d.setVar('PKG_%s' % pkg, pkg)
-
     dangling_links = {}
     pkg_files = {}
     for pkg in package_list:
@@ -1154,6 +1149,11 @@ python emit_pkgdata() {
     for pkg in packages.split():
         subdata_file = pkgdatadir + "/runtime/%s" % pkg
 
+        pkgval = d.getVar('PKG_%s' % pkg, True)
+        if pkgval is None:
+            pkgval = pkg
+            d.setVar('PKG_%s' % pkg, pkg)
+
         sf = open(subdata_file, 'w')
         write_if_exists(sf, pkg, 'PN')
         write_if_exists(sf, pkg, 'PV')
@@ -1189,7 +1189,6 @@ python emit_pkgdata() {
         sf.close()
 
         # Symlinks needed for reverse lookups (from the final package name)
-        pkgval = d.getVar('PKG_%s' % (pkg), True)
         subdata_sym = pkgdatadir + "/runtime-reverse/%s" % pkgval
         oe.path.symlink("../runtime/%s" % pkg, subdata_sym, True)
 
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 11/17 package.bbclass: Split out package_fixsymlinks function

In reply to Richard Purdie

The symlink handling code doesn't need to being part of populate_packages and is logically separate so split it out into a separate function, package_fixsymlinks.

---
 meta/classes/package.bbclass |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
meta/classes/package.bbclass +12 -5
index 858afbd..8bf80f5 100644
@@ -919,7 +919,7 @@ python split_and_strip_files () {
 }
 
 python populate_packages () {
-    import glob, stat, errno, re, subprocess
+    import glob, re, subprocess
 
     workdir = d.getVar('WORKDIR', True)
     outdir = d.getVar('DEPLOY_DIR', True)
@@ -1037,10 +1037,17 @@ python populate_packages () {
             package_qa_handle_error("installed_vs_shipped", msg, d)
 
     bb.build.exec_func("package_name_hook", d)
+}
+populate_packages[dirs] = "${D}"
+
+python package_fixsymlinks () {
+    import errno
+    pkgdest = d.getVar('PKGDEST', True)
+    packages = d.getVar("PACKAGES").split()
 
     dangling_links = {}
     pkg_files = {}
-    for pkg in package_list:
+    for pkg in packages:
         dangling_links[pkg] = []
         pkg_files[pkg] = []
         inst_root = os.path.join(pkgdest, pkg)
@@ -1059,13 +1066,13 @@ python populate_packages () {
                         target = os.path.join(root[len(inst_root):], target)
                     dangling_links[pkg].append(os.path.normpath(target))
 
-    for pkg in package_list:
+    for pkg in packages:
         rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
 
         for l in dangling_links[pkg]:
             found = False
             bb.debug(1, "%s contains dangling link %s" % (pkg, l))
-            for p in package_list:
+            for p in packages:
                 for f in pkg_files[p]:
                     if f == l:
                         found = True
@@ -1079,7 +1086,6 @@ python populate_packages () {
                 bb.note("%s contains dangling symlink to %s" % (pkg, l))
         d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
 }
-populate_packages[dirs] = "${D}"
 
 PKGDESTWORK = "${WORKDIR}/pkgdata"
 
@@ -1842,6 +1848,7 @@ PACKAGEFUNCS ?= "package_get_auto_pr \
                 split_and_strip_files \
                 fixup_perms \
                 populate_packages \
+                package_fixsymlinks \
                 package_do_filedeps \
                 package_do_shlibs \
                 package_do_pkgconfig \
Signature · 1 line
1.7.10.4
#12 lore raw

Re: [PATCH 11/17] package.bbclass: Split out package_fixsymlinks function

Quoted 4 lines · Richard Purdie

The symlink handling code doesn't need to being part of populate_packages and is logically separate so split it out into a separate function, package_fixsymlinks.

Not sure why, this patch causes a problem with the hicolor-icon-theme.

The problem I see is:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Quoted 3 lines
ERROR:      0127:        bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
ERROR:      0128:        rdepends = d.getVar('RDEPENDS_%s' % pkg, True)
ERROR:  *** 0129:        rdepends = rdepends + ' ' + d.getVar('MLPREFIX') + "hicolor-icon-t

In this case the rdepends is a NoneType.

I have a patch on the queue that solves the problem. I changed the lines above to use d.appendVar().

Sau!

Quoted 70 lines
---
  meta/classes/package.bbclass |   17 ++++++++++++-----
  1 file changed, 12 insertions(+), 5 deletions(-)
meta/classes/package.bbclass +12 -5
index 858afbd..8bf80f5 100644
@@ -919,7 +919,7 @@ python split_and_strip_files () {
  }
 
  python populate_packages () {
-    import glob, stat, errno, re, subprocess
+    import glob, re, subprocess
 
      workdir = d.getVar('WORKDIR', True)
      outdir = d.getVar('DEPLOY_DIR', True)
@@ -1037,10 +1037,17 @@ python populate_packages () {
              package_qa_handle_error("installed_vs_shipped", msg, d)
 
      bb.build.exec_func("package_name_hook", d)
+}
+populate_packages[dirs] = "${D}"
+
+python package_fixsymlinks () {
+    import errno
+    pkgdest = d.getVar('PKGDEST', True)
+    packages = d.getVar("PACKAGES").split()
 
      dangling_links = {}
      pkg_files = {}
-    for pkg in package_list:
+    for pkg in packages:
          dangling_links[pkg] = []
          pkg_files[pkg] = []
          inst_root = os.path.join(pkgdest, pkg)
@@ -1059,13 +1066,13 @@ python populate_packages () {
                          target = os.path.join(root[len(inst_root):], target)
                      dangling_links[pkg].append(os.path.normpath(target))
 
-    for pkg in package_list:
+    for pkg in packages:
          rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
 
          for l in dangling_links[pkg]:
              found = False
              bb.debug(1, "%s contains dangling link %s" % (pkg, l))
-            for p in package_list:
+            for p in packages:
                  for f in pkg_files[p]:
                      if f == l:
                          found = True
@@ -1079,7 +1086,6 @@ python populate_packages () {
                  bb.note("%s contains dangling symlink to %s" % (pkg, l))
          d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
  }
-populate_packages[dirs] = "${D}"
 
  PKGDESTWORK = "${WORKDIR}/pkgdata"
 
@@ -1842,6 +1848,7 @@ PACKAGEFUNCS ?= "package_get_auto_pr \
                  split_and_strip_files \
                  fixup_perms \
                  populate_packages \
+                package_fixsymlinks \
                  package_do_filedeps \
                  package_do_shlibs \
                  package_do_pkgconfig \
#13 lore raw

PATCH 12/17 package.bbclass: Tweak PACKAGEFUNCS

In reply to Richard Purdie

Move package_rename_hook call into PACKAGEFUNCS and also move package_get_auto_pr to a more appropriate execution point, grouping package metadata handling functions together.

---
 meta/classes/package.bbclass |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/package.bbclass +3 -3
index 8bf80f5..2f1695b 100644
@@ -1035,8 +1035,6 @@ python populate_packages () {
             for f in unshipped:
                 msg = msg + "\n  " + f
             package_qa_handle_error("installed_vs_shipped", msg, d)
-
-    bb.build.exec_func("package_name_hook", d)
 }
 populate_packages[dirs] = "${D}"
 
@@ -1841,13 +1839,15 @@ def gen_packagevar(d):
     return " ".join(ret)
 
 PACKAGE_PREPROCESS_FUNCS ?= ""
-PACKAGEFUNCS ?= "package_get_auto_pr \
+PACKAGEFUNCS ?= " \
                 perform_packagecopy \
                 ${PACKAGE_PREPROCESS_FUNCS} \
                 package_do_split_locales \
                 split_and_strip_files \
                 fixup_perms \
                 populate_packages \
+                package_name_hook \
+                package_get_auto_pr \
                 package_fixsymlinks \
                 package_do_filedeps \
                 package_do_shlibs \
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH 13/17 package.bbclass: Improve package_fixsymlinks

In reply to Richard Purdie

Improve package_fixsymlinks so we don't handle RDEPENDS for every single package in PACKAGES.

---
 meta/classes/package.bbclass |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
meta/classes/package.bbclass +12 -7
index 2f1695b..1ccac9c 100644
@@ -1064,24 +1064,29 @@ python package_fixsymlinks () {
                         target = os.path.join(root[len(inst_root):], target)
                     dangling_links[pkg].append(os.path.normpath(target))
 
-    for pkg in packages:
-        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
-
+    newrdepends = {}
+    for pkg in dangling_links:
         for l in dangling_links[pkg]:
             found = False
             bb.debug(1, "%s contains dangling link %s" % (pkg, l))
             for p in packages:
-                for f in pkg_files[p]:
-                    if f == l:
+                if l in pkg_files[p]:
                         found = True
                         bb.debug(1, "target found in %s" % p)
                         if p == pkg:
                             break
-                        if p not in rdepends:
-                            rdepends[p] = []
+                        if pkg not in newrdepends:
+                            newrdepends[pkg] = []
+                        newrdepends[pkg].append(p)
                         break
             if found == False:
                 bb.note("%s contains dangling symlink to %s" % (pkg, l))
+
+    for pkg in newrdepends:
+        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
+        for p in newrdepends[pkg]:
+            if p not in rdepends:
+                rdepends[p] = []
         d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
 }
 
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 14/17 package: Create global package file list and use throughout PACKAGEFUNCS

In reply to Richard Purdie

Currently we do a signficant amount of tree traversal in many different places which in inefficient. We can assume that the files don't change and cache the file list which gives an efficiency improvement which this patch does using a global variable.

---
 meta/classes/buildhistory.bbclass |   11 +++---
 meta/classes/debian.bbclass       |   28 +++++++------
 meta/classes/insane.bbclass       |    4 +-
 meta/classes/package.bbclass      |   78 +++++++++++++++++++------------------
 4 files changed, 60 insertions(+), 61 deletions(-)
meta/classes/buildhistory.bbclass +5 -6
index 4b80f07..a6fbd68 100644
@@ -199,12 +199,11 @@ python buildhistory_emit_pkghistory() {
         pkgdestpkg = os.path.join(pkgdest, pkg)
         filelist = []
         pkginfo.size = 0
-        for root, dirs, files in os.walk(pkgdestpkg):
-            relpth = os.path.relpath(root, pkgdestpkg)
-            for f in files:
-                fstat = os.lstat(os.path.join(root, f))
-                pkginfo.size += fstat.st_size
-                filelist.append(os.sep + os.path.join(relpth, f))
+        for f in pkgfiles[pkg]:
+            relpth = os.path.relpath(f, pkgdestpkg)
+            fstat = os.lstat(f)
+            pkginfo.size += fstat.st_size
+            filelist.append(os.sep + relpth)
         filelist.sort()
         pkginfo.filelist = " ".join(filelist)
 
meta/classes/debian.bbclass +13 -15
index 45f01e4..d7ea151 100644
@@ -51,23 +51,21 @@ python debian_package_name_hook () {
         sonames = []
         has_bins = 0
         has_libs = 0
-        pkg_dir = os.path.join(pkgdest, orig_pkg)
-        for root, dirs, files in os.walk(pkg_dir):
-            if bin_re.match(root) and files:
+        for file in pkgfiles[orig_pkg]:
+            root = os.path.dirname(file)
+            if bin_re.match(root):
                 has_bins = 1
-            if lib_re.match(root) and files:
+            if lib_re.match(root):
                 has_libs = 1
-                for f in files:
-                    if so_re.match(f):
-                        fp = os.path.join(root, f)
-                        cmd = (d.getVar('TARGET_PREFIX', True) or "") + "objdump -p " + fp + " 2>/dev/null"
-                        fd = os.popen(cmd)
-                        lines = fd.readlines()
-                        fd.close()
-                        for l in lines:
-                            m = re.match("\s+SONAME\s+([^\s]*)", l)
-                            if m and not m.group(1) in sonames:
-                                sonames.append(m.group(1))
+                if so_re.match(os.path.basename(file)):
+                    cmd = (d.getVar('TARGET_PREFIX', True) or "") + "objdump -p " + file + " 2>/dev/null"
+                    fd = os.popen(cmd)
+                    lines = fd.readlines()
+                    fd.close()
+                    for l in lines:
+                        m = re.match("\s+SONAME\s+([^\s]*)", l)
+                        if m and not m.group(1) in sonames:
+                            sonames.append(m.group(1))
 
         bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames))
         soname = None
meta/classes/insane.bbclass +1 -3
index 015abd5..f532a53 100644
@@ -660,9 +660,7 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
 
     warnings = []
     errors = []
-    for root, dirs, files in os.walk(path):
-        for file in files:
-            path = os.path.join(root,file)
+    for path in pkgfiles[package]:
             elf = oe.qa.ELFFile(path)
             try:
                 elf.open()
meta/classes/package.bbclass +41 -37

164 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#16 lore raw

PATCH 15/17 package.bbclass: Use expanded RDEPENDS in read_shlibdeps

In reply to Richard Purdie

We may as well expand the RDEPENDS when reading and writing as this function does. if we don't do this, we could accidentally duplicate data and it also turns out to be much less efficient.

---
 meta/classes/package.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +1 -1
index 5f6cf80..fec3db6 100644
@@ -1680,7 +1680,7 @@ python read_shlibdeps () {
 
     packages = d.getVar('PACKAGES', True).split()
     for pkg in packages:
-        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, False) or d.getVar('RDEPENDS', False) or "")
+        rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
         for dep in pkglibdeps[pkg]:
             # Add the dep if it's not already there, or if no comparison is set
             if dep not in rdepends:
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH 16/17 package_ipk/deb/rpm: Ensure deploy staging directory is empty before rerunning task

In reply to Richard Purdie

If we don't do this, stale files can build up, particularly with the PR server.

---
 meta/classes/package_deb.bbclass |    1 +
 meta/classes/package_ipk.bbclass |    1 +
 meta/classes/package_rpm.bbclass |    1 +
 3 files changed, 3 insertions(+)
meta/classes/package_deb.bbclass +1 -0
index ac8c9f3..5740948 100644
@@ -452,6 +452,7 @@ python do_package_write_deb () {
     bb.build.exec_func("do_package_deb", d)
 }
 do_package_write_deb[dirs] = "${PKGWRITEDIRDEB}"
+do_package_write_deb[cleandirs] = "${PKGWRITEDIRDEB}"
 do_package_write_deb[umask] = "022"
 addtask package_write_deb before do_package_write after do_packagedata do_package
 
meta/classes/package_ipk.bbclass +1 -0
index ad4ea53..433d0bb 100644
@@ -476,6 +476,7 @@ python do_package_write_ipk () {
     bb.build.exec_func("do_package_ipk", d)
 }
 do_package_write_ipk[dirs] = "${PKGWRITEDIRIPK}"
+do_package_write_ipk[cleandirs] = "${PKGWRITEDIRIPK}"
 do_package_write_ipk[umask] = "022"
 addtask package_write_ipk before do_package_write after do_packagedata do_package
 
meta/classes/package_rpm.bbclass +1 -0
index af51d80..8ea2bbe 100644
@@ -1125,6 +1125,7 @@ python do_package_write_rpm () {
 }
 
 do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}"
+do_package_write_rpm[cleandirs] = "${PKGWRITEDIRRPM}"
 do_package_write_rpm[umask] = "022"
 addtask package_write_rpm before do_package_write after do_packagedata do_package
 
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH 17/17 directfb: Explictly disable mesa

In reply to Richard Purdie

Without this, directfb might build with mesa enabled if present.

---
 meta/recipes-graphics/directfb/directfb.inc |    1 +
 1 file changed, 1 insertion(+)
meta/recipes-graphics/directfb/directfb.inc +1 -0
index c9b8ff8..aecc834 100644
@@ -31,6 +31,7 @@ EXTRA_OECONF = "\
   --enable-sdl=no \
   --enable-vnc=no \
   --disable-x11 \
+  --disable-mesa \
 "
 
 #PACKAGES_DYNAMIC += "^directfb-inputdrivers-.*"
Signature · 1 line
1.7.10.4
#19 lore raw

Re: [PATCH 17/17] directfb: Explictly disable mesa

Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Purdie
Sent: Wednesday, January 30, 2013 9:01 AM
To: [email protected]
Subject: [OE-core] [PATCH 17/17] directfb: Explictly disable mesa

Without this, directfb might build with mesa enabled if present.

Is it possible to make this tunable? We use directfb with the mesa dri drivers for opengl. Maybe enable it only if the distro features contains opengl?

Thanks!

#20 lore raw

Re: [PATCH 17/17] directfb: Explictly disable mesa

Quoted 8 lines · Ian Geiser
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Purdie
Sent: Wednesday, January 30, 2013 9:01 AM
To: [email protected]
Subject: [OE-core] [PATCH 17/17] directfb: Explictly disable mesa

Quoted 5 lines
Quoted 2 lines

Without this, directfb might build with mesa enabled if present.

Is it possible to make this tunable? We use directfb with the mesa dri drivers for opengl. Maybe enable it only if the distro features contains opengl?

I'll take patches to make it controlled by PACKAGECONFIG, probably with the default of mesa disabled for now.

For the immediate build failures it was causing I pushed a patch to make the configure options match DEPENDS.

Cheers,

Richard

#21 lore raw

Re: [PATCH 17/17] directfb: Explictly disable mesa

In reply to Ian Geiser
Quoted 3 lines · Ian Geiser
Quoted 2 lines

Without this, directfb might build with mesa enabled if present.

Is it possible to make this tunable? We use directfb with the mesa dri drivers for opengl. Maybe enable it only if the distro features contains opengl?

I was just saying to Richard that if someone wants it, we can enable it.

Basing on the "opengl" distro feature makes some sense, as long as people are aware of the interaction between directfb and opengl, especially on platforms where Mesa may not be the GL implementation.

An alternative would be to make it a non-default PACKAGECONFIG option, so you can enable it because you know that you have Mesa as your GL provider.

Ross

#22 lore raw

Re: [PATCH 17/17] directfb: Explictly disable mesa

Quoted 17 lines

-----Original Message-----
From: Burton, Ross [mailto:[email protected]]
Sent: Wednesday, January 30, 2013 9:53 AM
To: Ian Geiser
Cc: [email protected]
Subject: Re: [OE-core] [PATCH 17/17] directfb: Explictly disable mesa

Quoted 3 lines · Ian Geiser
Quoted 2 lines

Without this, directfb might build with mesa enabled if present.

Is it possible to make this tunable? We use directfb with the mesa

dri drivers for opengl. Maybe enable it only if the distro features contains opengl?

I was just saying to Richard that if someone wants it, we can enable it.

Quoted 7 lines

Basing on the "opengl" distro feature makes some sense, as long as people are aware of the interaction between directfb and opengl, especially on platforms where Mesa may not be the GL implementation.

An alternative would be to make it a non-default PACKAGECONFIG option, so you can enable it because you know that you have Mesa as your GL provider.

Now that you suggest it I like the PACKAGECONFIG option because its trivial to work with from the distro without impacting other things. It also streamlines the dependencies and configure options. Thanks!