Patchwork [15/22] package.bbclass: Make use of cleandirs and dirs function flags

login
register
mail settings
Submitter Richard Purdie
Date Feb. 3, 2013, 11:55 p.m.
Message ID <1752a0b8a297183395ca1b4b152c8c592d210a90.1359935562.git.richard.purdie@linuxfoundation.org>
Download mbox | patch
Permalink /patch/43903/
State Accepted
Commit ee5e443dba2ee6b2bba318a58f710248894df7c5
Headers show

Comments

Richard Purdie - Feb. 3, 2013, 11:55 p.m.
We can use the cleandirs and dirs flags for the fuctions to handle
directory cleaning and creation at the bitbake level rather than
using these calls within the functions

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/package.bbclass |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 7e45655..22ca546 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -429,11 +429,8 @@  python perform_packagecopy () {
     dest = d.getVar('D', True)
     dvar = d.getVar('PKGD', True)
 
-    bb.mkdirhier(dvar)
-
     # Start by package population by taking a copy of the installed
     # files to operate on
-    subprocess.call('rm -rf %s/*' % (dvar), shell=True)
     # Preserve sparse files and hard links
     subprocess.call('tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar), shell=True)
 
@@ -441,6 +438,8 @@  python perform_packagecopy () {
     if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d):
         rpath_replace (dvar, d)
 }
+perform_packagecopy[cleandirs] = "${PKGD}"
+perform_packagecopy[dirs] = "${PKGD}"
 
 # We generate a master list of directories to process, we start by
 # seeding this list with reasonable defaults, then load from
@@ -897,7 +896,6 @@  python populate_packages () {
                 package_list.append(pkg)
     d.setVar('PACKAGES', ' '.join(package_list))
     pkgdest = d.getVar('PKGDEST', True)
-    subprocess.call('rm -rf %s' % pkgdest, shell=True)
 
     seen = []
 
@@ -1823,7 +1821,7 @@  addtask package before do_build after do_install
 PACKAGELOCK = "${STAGING_DIR}/package-output.lock"
 SSTATETASKS += "do_package"
 do_package[sstate-name] = "package"
-do_package[cleandirs] = "${PKGDESTWORK}"
+do_package[cleandirs] = "${PKGDEST} ${PKGDESTWORK}"
 do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST} ${PKGDESTWORK}"
 do_package[sstate-lockfile-shared] = "${PACKAGELOCK}"
 do_package_setscene[dirs] = "${STAGING_DIR}"