summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2012-01-20 23:03:12 -0800
committerAndy Schwerin <schwerin@10gen.com>2012-01-20 23:03:12 -0800
commite885029b8fa04e846619dc9b157b803e6c3e46a5 (patch)
tree63e9e8387d169c52cdfdf6920ddc38d245ae6cf5 /SConstruct
parent2479794acdd9101efaee829b12bd2c8097dd62b4 (diff)
downloadmongo-e885029b8fa04e846619dc9b157b803e6c3e46a5.tar.gz
Fix scons dist_clean
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct15
1 files changed, 15 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 8ebf3716a74..417b90f093a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1206,3 +1206,18 @@ Export("darwin windows solaris linux nix")
env.SConscript( 'src/SConscript', variant_dir=variantDir, duplicate=False )
env.SConscript( 'SConscript.smoke' )
+
+def clean_old_dist_builds(env, target, source):
+ prefix = "mongodb-%s-%s" % (platform, processor)
+ filenames = sorted(os.listdir("."))
+ filenames = [x for x in filenames if x.startswith(prefix)]
+ to_keep = [x for x in filenames if x.endswith(".tgz") or x.endswith(".zip")][-2:]
+ for filename in [x for x in filenames if x not in to_keep]:
+ print "removing %s" % filename
+ try:
+ shutil.rmtree(filename)
+ except:
+ os.remove(filename)
+
+env.Alias("dist_clean", [], [clean_old_dist_builds])
+env.AlwaysBuild("dist_clean")