diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-11-23 01:20:04 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-11-23 01:20:04 +0000 |
commit | 18a377dcf50c5c10ebc73a36963a6e83d1bbad5d (patch) | |
tree | 987322f54fb1c70ece62fa276c9900eeef6fa2f8 /classes | |
parent | d35cf88e849ccad6fce5ab4bbf4cbe96f6e513b9 (diff) |
package.bbclass/module-strip.bbclass: Various strip fixes
* Turn striping functionality into functions and call in the appropriate place
* Removing various races and ordering issues
* Should mean kernel modules are correctly stripped (and stripping can be disabled)
* Addresses bug 1182
* kernel module stripping applied to ${PKGD} (the correct place)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/module_strip.bbclass | 36 | ||||
-rw-r--r-- | classes/package.bbclass | 37 |
2 files changed, 39 insertions, 34 deletions
diff --git a/classes/module_strip.bbclass b/classes/module_strip.bbclass index 17409190ed..ce36e213ff 100644 --- a/classes/module_strip.bbclass +++ b/classes/module_strip.bbclass @@ -1,26 +1,20 @@ -#DEPENDS_append = " module-strip" +PACKAGESTRIPFUNCS += "do_strip_modules" do_strip_modules () { - for p in ${PACKAGES}; do - if test -e ${PKGDEST}/$p/lib/modules; then - if [ "${KERNEL_MAJOR_VERSION}" == "2.6" ]; then - modules="`find ${PKGDEST}/${p}/lib/modules -name \*.ko`" - else - modules="`find ${PKGDEST}/${p}/lib/modules -name \*.o`" - fi - if [ -n "$modules" ]; then - for module in $modules ; do - if ! [ -d "$module" ] ; then - ${STRIP} -v -g $module - fi - done -# NM="${CROSS_DIR}/bin/${HOST_PREFIX}nm" OBJCOPY="${CROSS_DIR}/bin/${HOST_PREFIX}objcopy" strip_module $modules - fi + if test -e ${PKGDEST}/lib/modules; then + if [ "${KERNEL_MAJOR_VERSION}" == "2.6" ]; then + modules="`find ${PKGD}/lib/modules -name \*.ko`" + else + modules="`find ${PKGD}/lib/modules -name \*.o`" fi - done + if [ -n "$modules" ]; then + for module in $modules ; do + if ! [ -d "$module" ] ; then + ${STRIP} -v -g $module + fi + done + fi + fi } -python do_package_append () { - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): - bb.build.exec_func('do_strip_modules', d) -} + diff --git a/classes/package.bbclass b/classes/package.bbclass index 8892fa9084..4196135710 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -201,6 +201,26 @@ def runstrip(file, d): return 1 +PACKAGESTRIPFUNCS += "do_runstrip" +python do_runstrip() { + import stat + + dvar = bb.data.getVar('PKGD', d, True) + def isexec(path): + try: + s = os.stat(path) + except (os.error, AttributeError): + return 0 + return (s[stat.ST_MODE] & stat.S_IEXEC) + + for root, dirs, files in os.walk(dvar): + for f in files: + file = os.path.join(root, f) + if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): + runstrip(file, d) +} + + def write_package_md5sums (root, outfile, ignorepaths): # For each regular file under root, writes an md5sum to outfile. # With thanks to patch.bbclass. @@ -339,7 +359,7 @@ python perform_packagecopy () { } python populate_packages () { - import glob, stat, errno, re,os + import glob, errno, re,os workdir = bb.data.getVar('WORKDIR', d, True) outdir = bb.data.getVar('DEPLOY_DIR', d, True) @@ -350,13 +370,6 @@ python populate_packages () { bb.mkdirhier(outdir) os.chdir(dvar) - def isexec(path): - try: - s = os.stat(path) - except (os.error, AttributeError): - return 0 - return (s[stat.ST_MODE] & stat.S_IEXEC) - # Sanity check PACKAGES for duplicates - should be moved to # sanity.bbclass once we have the infrastucture package_list = [] @@ -369,12 +382,10 @@ python populate_packages () { else: package_list.append(pkg) + if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): - for root, dirs, files in os.walk(dvar): - for f in files: - file = os.path.join(root, f) - if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): - runstrip(file, d) + for f in (bb.data.getVar('PACKAGESTRIPFUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) pkgdest = bb.data.getVar('PKGDEST', d, True) os.system('rm -rf %s' % pkgdest) |