From 2bf6fcfa9060f2490d77e4c5ea3dcd596e6b4c6b Mon Sep 17 00:00:00 2001 From: Paul Varner Date: Mon, 19 Oct 2015 16:11:56 -0500 Subject: 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 --- pym/gentoolkit/eclean/cli.py | 9 ++++++--- pym/gentoolkit/eclean/search.py | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'pym') 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) -- cgit v1.2.3