aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Varner <fuzzyray@gentoo.org>2015-10-19 16:11:56 -0500
committerPaul Varner <fuzzyray@gentoo.org>2015-10-19 16:11:56 -0500
commit2bf6fcfa9060f2490d77e4c5ea3dcd596e6b4c6b (patch)
treeabd66e643c22dce7df03c42096666810fea0587d
parentrevdep-rebuild: add tmpfiles.d file (diff)
downloadgentoolkit-2bf6fcfa9060f2490d77e4c5ea3dcd596e6b4c6b.tar.gz
gentoolkit-2bf6fcfa9060f2490d77e4c5ea3dcd596e6b4c6b.tar.bz2
gentoolkit-2bf6fcfa9060f2490d77e4c5ea3dcd596e6b4c6b.zip
eclean: Add option to allow for missing PKGDIR. Bug 551266
Added -i, --ignore-failure to ignore a missing PKGDIR error and exit cleanly. This was requested by the Chromium OS project, since they run eclean in an automated process and the directory may not exist yet. References: http://crbug.com/323420
-rw-r--r--man/eclean.13
-rw-r--r--pym/gentoolkit/eclean/cli.py9
-rw-r--r--pym/gentoolkit/eclean/search.py2
3 files changed, 10 insertions, 4 deletions
diff --git a/man/eclean.1 b/man/eclean.1
index 1668b5e..8547c03 100644
--- a/man/eclean.1
+++ b/man/eclean.1
@@ -106,7 +106,8 @@ etc.
Units are: G, M, K and B.
.SS "Options for the 'packages' action"
.TP
-There is no specific option for this action.
+\fB\-i, \-\-ignore\-failure\fP ignore the failure to locate PKGDIR
+This is only useful when scripting to ignore an otherwise fatal error.
.SH "EXCLUSION FILES"
Exclusions files are lists of packages names or categories you want to protect
in particular. This may be useful to protect more binary packages for some system
diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 95d4c06..1c8e66f 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -147,7 +147,8 @@ def printUsage(_error=None, help=None):
or help in ('all','packages'):
print( "Available", yellow("options"),"for the",
green("packages"),"action:", file=out)
- print( yellow(" NONE :)"), file=out)
+ print( yellow(" -i, --ignore-failure")+
+ " - ignore failure to locate PKGDIR", file=out)
print( file=out)
if _error in ('distfiles-options', 'merged-distfiles-options') \
or help in ('all','distfiles'):
@@ -262,6 +263,8 @@ def parseArgs(options={}):
options['size-limit'] = parseSize(a)
elif o in ("-v", "--verbose") and not options['quiet']:
options['verbose'] = True
+ elif o in ("-i", "--ignore-failure"):
+ options['ignore-failure'] = True
else:
return_code = False
# sanity check of --deep only options:
@@ -286,8 +289,8 @@ def parseArgs(options={}):
"time-limit=", "package-names", "help", "version", "verbose"]
getopt_options['short']['distfiles'] = "fs:"
getopt_options['long']['distfiles'] = ["fetch-restricted", "size-limit="]
- getopt_options['short']['packages'] = ""
- getopt_options['long']['packages'] = [""]
+ getopt_options['short']['packages'] = "i"
+ getopt_options['long']['packages'] = ["ignore-failure"]
# set default options, except 'nocolor', which is set in main()
options['interactive'] = False
options['pretend'] = False
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index 1a83fd4..f771ffc 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -532,6 +532,8 @@ def findPackages(
test = os.listdir(pkgdir)
del test
except EnvironmentError as er:
+ if options['ignore-failure']:
+ exit(0)
print( pp.error("Error accessing PKGDIR." ), file=sys.stderr)
print( pp.error("(Check your make.conf file and environment)."), file=sys.stderr)
print( pp.error("Error: %s" %str(er)), file=sys.stderr)