From 9acd3e05e7c396cbfcb4ed5f00f5363b45f7459f Mon Sep 17 00:00:00 2001 From: tst-mswartz <30602702+tst-mswartz@users.noreply.github.com> Date: Thu, 7 Dec 2017 22:13:33 -0500 Subject: [PATCH] add (build): scons clean targets (#621) * now with -c distclean and -c buildclean options, it still deletes things in third_party bc of scons/khEnvironment.py though * removed some debugging messages I missed * missed a line from a previous experiment * removing extra stuff * added back the line that deletes /tmp/fusion_os_install and uncommented the original lines * putting back some lines that i accidentally removed due to a bad local merge * removing some whitespace i added during the last commit * removing some whitespace i added during the last commit * now has only one target, which is -c cleanall * apparently neither Clean() nor Delete() can be successfully invoked from inside a non-target scons block? * now fully deletes things after cleaning, preventing re-creation of metadata scons files --- earth_enterprise/SConstruct | 25 +++++++++++++++++++++++-- earth_enterprise/src/SConstruct | 2 ++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/earth_enterprise/SConstruct b/earth_enterprise/SConstruct index 9ebfdec1bb..6d30f83856 100644 --- a/earth_enterprise/SConstruct +++ b/earth_enterprise/SConstruct @@ -180,7 +180,28 @@ env.PhonyTargets(**this_dict) # Clean install dir (note: the current sconscripts leave stuff behind, like # directories). -if env.GetOption('clean'): - # clean the search and getomcat install folders. + +if 'cleanall' in COMMAND_LINE_TARGETS: + #clean the search and getomcat install folders. file = installdir.get_path() commands.getstatusoutput("rm -rf " + file) + + #clean /tmp/fusion_os_install + Clean(env, installdir) + + #clean build data in ./src + clean_cmd = 'cd src; scons %s -c cleanall' % (arg_vars) + env.Execute(clean_cmd) + + #clean scons metadata.. can't use Clean() or Delete() + #because they are scons functions and recreate + #the files/directories they delete + for sconsfile in [ + ".sconsign.dblite", + ".sconf_temp", + "config.log", + "src/.sconsign.dblite", + "src/.sconf_temp", + "src/config.log"]: + os.system("rm -rf " + sconsfile) + diff --git a/earth_enterprise/src/SConstruct b/earth_enterprise/src/SConstruct index e42e268689..1ccb1c26e6 100644 --- a/earth_enterprise/src/SConstruct +++ b/earth_enterprise/src/SConstruct @@ -524,3 +524,5 @@ env['LRELEASE'] = qtdir+'/bin/lrelease' env['KHIDL'] = File('#common/khxml/khidl.pl') SConscript('SConscript', build_dir=builddir, duplicate=0) + +env.Clean('cleanall', [[exportdir+"/"+x for x in os.listdir(exportdir) if x != "third_party"]])