Skip to content

Commit cac2f3e

Browse files
committed
Improve aliBuild clean (#306)
- Now supports the --aggressive-cleanup option, which can be used to remove extra files which come handy only in case of rebuilds. This means that in general the cleanup has no side effects, but it will take longer to rebuild a package. - Do not remove files which do not exists.
1 parent b2a3ce5 commit cac2f3e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

aliBuild

+6
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,19 @@ def doMain():
482482
symlinksBuild = [readlink(x) for x in glob("%s/BUILD/*-latest*" % args.workDir)]
483483
# $WORK_DIR/TMP should always be cleaned up. This does not happen only
484484
# in the case we run out of space while unpacking.
485+
# $WORK_DIR/<architecture>/store can be cleaned up as well, because
486+
# we do not need the actual tarballs after they have been built.
485487
toDelete = ["%s/TMP" % args.workDir]
488+
if args.aggressiveCleanup:
489+
toDelete += ["%s/TARS/%s/store" % (args.workDir, args.architecture),
490+
"%s/SOURCES" % (args.workDir)]
486491
toDelete += [x for x in glob("%s/BUILD/*" % args.workDir)
487492
if not islink(x) and not basename(x) in symlinksBuild]
488493
installGlob ="%s/%s/*/" % (args.workDir, args.architecture)
489494
symlinksInstall = [readlink(x) for x in glob(installGlob + "latest*")]
490495
toDelete += [x for x in glob(installGlob+ "*")
491496
if not islink(x) and not basename(x) in symlinksInstall]
497+
toDelete = [x for x in toDelete if exists(x)]
492498
if not toDelete:
493499
print "Nothing to delete."
494500
exit(0)

0 commit comments

Comments
 (0)