From a2189667c718ddf7e89a836411b7b462f9075e5f Mon Sep 17 00:00:00 2001 From: Jeremy Olexa Date: Tue, 28 Feb 2012 21:21:33 +0000 Subject: [PATCH] Add new -T (--purgetmponly) option This commit adds a new option to mimic the existing --purgeonly option EXCEPT does NOT remove generated PKGCACHE (or binpkgs). --- catalyst | 6 +++++- modules/generic_stage_target.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/catalyst b/catalyst index ee319fda..6b6ba2d0 100755 --- a/catalyst +++ b/catalyst @@ -32,6 +32,7 @@ def usage(): print " -h --help print this help message" print " -p --purge clear tmp dirs,package cache and autoresume flags" print " -P --purgeonly clear tmp dirs,package cache and autoresume flags and exit" + print " -T --purgetmponly clear tmp dirs and autoresume flags and exit" print " -s --snapshot generate a release snapshot" print " -V --version display version information" print " -v --verbose verbose output" @@ -225,7 +226,7 @@ if __name__ == "__main__": # parse out the command line arguments try: - opts,args = getopt.getopt(sys.argv[1:], "apPhvdc:C:f:FVs:", ["purge", "purgeonly", "help", "version", "debug",\ + opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\ "clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="]) except getopt.GetoptError: @@ -297,6 +298,9 @@ if __name__ == "__main__": if o in ("-P", "--purgeonly"): conf_values["PURGEONLY"] = "1" + if o in ("-T", "--purgetmponly"): + conf_values["PURGETMPONLY"] = "1" + if o in ("-a", "--clear-autoresume"): conf_values["CLEAR_AUTORESUME"] = "1" diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 8badf5e5..ec032922 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1237,6 +1237,10 @@ class generic_stage_target(generic_target): if self.settings.has_key("CLEAR_AUTORESUME"): self.clear_autoresume() + if self.settings.has_key("PURGETMPONLY"): + self.purge() + return + if self.settings.has_key("PURGEONLY"): self.purge() return @@ -1629,15 +1633,16 @@ class generic_stage_target(generic_target): def purge(self): countdown(10,"Purging Caches ...") - if self.settings.has_key("PURGE") or self.settings.has_key("PURGEONLY"): + if self.settings.has_key("PURGE") or self.settings.has_key("PURGEONLY") or self.settings.has_key("PURGETMPONLY"): print "clearing autoresume ..." self.clear_autoresume() print "clearing chroot ..." self.clear_chroot() - print "clearing package cache ..." - self.clear_packages() + if not self.settings.has_key("PURGETMPONLY"): + print "clearing package cache ..." + self.clear_packages() print "clearing kerncache ..." self.clear_kerncache() -- 2.26.2