summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2010-04-13 23:55:39 +0000
committerTom Rini <tom_rini@mentor.com>2010-04-14 13:37:58 -0700
commit69c718c98ccb2e794a1c07e8354a79c255ff94fa (patch)
tree29956479e00582255f9383e3909a5c78a93f7f97
parent83bdc2c30fe8004adb958ca3f112608435f0cf42 (diff)
packaged-staging.bbclass: use 'os.unlink()' instead of spawning 'rm'
Doing a '-c clean' operation on a staged package with very much files (e.g. glibc) took several minutes because * every removed file was reported * an 'rm' instance was spawned for every file This patch uses the native 'os.unlink()' method for removing files and reports only the removed root directory instead of the single files. Based upon maillist discussion, reporting happens with 'debug' level instead of 'note' one, and only error conditions due to non-existing files will be ignored. Other (e.g. permission denied) errors will now abort the build while they were silently ignored previously. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Acked-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Acked-by: Tom Rini <tom_rini@mentor.com> Signed-off-by: Tom Rini <tom_rini@mentor.com>
-rw-r--r--classes/packaged-staging.bbclass23
1 files changed, 18 insertions, 5 deletions
diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass
index 9c72d11b8c..f3648d2f6a 100644
--- a/classes/packaged-staging.bbclass
+++ b/classes/packaged-staging.bbclass
@@ -26,6 +26,16 @@ PSTAGE_NATIVEDEPENDS = "\
BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"
+def _package_unlink (f):
+ import os, errno
+ try:
+ os.unlink(f)
+ return True
+ except OSError, e:
+ if e.errno == errno.ENOENT:
+ return False
+ raise
+
python () {
pstage_allowed = True
@@ -87,10 +97,10 @@ def pstage_manualclean(srcname, destvarname, d):
dest = bb.data.getVar(destvarname, d, True)
for walkroot, dirs, files in os.walk(src):
+ bb.debug("rm %s" % walkroot)
for file in files:
filepath = os.path.join(walkroot, file).replace(src, dest)
- bb.note("rm %s" % filepath)
- os.system("rm %s" % filepath)
+ _package_unlink(filepath)
def pstage_set_pkgmanager(d):
path = bb.data.getVar("PATH", d, 1)
@@ -162,6 +172,7 @@ PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_loca
SCENEFUNCS += "packagestage_scenefunc"
python packagestage_scenefunc () {
+ import glob
if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0":
return
@@ -227,7 +238,9 @@ python packagestage_scenefunc () {
# Remove the stamps and files we added above
# FIXME - we should really only remove the stamps we added
- os.system('rm -f ' + stamp + '.*')
+ for fname in glob.glob(stamp + '.*'):
+ _package_unlink(fname)
+
os.system(bb.data.expand("rm -rf ${WORKDIR}/tstage", d))
if stageok:
@@ -260,8 +273,8 @@ python packagedstage_stampfixing_eventhandler() {
# so we need to remove the autogenerated stamps.
for task in taskscovered:
dir = "%s.do_%s" % (e.stampPrefix[fn], task)
- os.system('rm -f ' + dir)
- os.system('rm -f ' + stamp)
+ _package_unlink(dir)
+ _package_unlink(stamp)
}
populate_staging_preamble () {