You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/catalyst/files/0001-Add-new-T-purgetmponly...

82 lines
2.9 KiB

From 76f428436777a1217709055126961972194064a8 Mon Sep 17 00:00:00 2001
From: Jeremy Olexa <darkside@gentoo.org>
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 f05a7bc..09856e3 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"
@@ -229,7 +230,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:
@@ -301,6 +302,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 8aa2075..6039da5 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1250,6 +1250,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
@@ -1642,15 +1646,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()
--
1.7.3.4