aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorSiddhanth Rathod <xsiddhanthrathod@gmail.com>2023-08-22 19:25:48 +0530
committerSam James <sam@gentoo.org>2023-08-22 21:34:30 +0100
commit204b1abca2c0cbbdad188c7fd4b84452c2f630a0 (patch)
tree7903fb57e16a25905f14acec9ccec03f97c44099 /pym
parenteclean-pkg: deal with invalid binpkgs (diff)
downloadgentoolkit-204b1abca2c0cbbdad188c7fd4b84452c2f630a0.tar.gz
gentoolkit-204b1abca2c0cbbdad188c7fd4b84452c2f630a0.tar.bz2
gentoolkit-204b1abca2c0cbbdad188c7fd4b84452c2f630a0.zip
eclean-pkg: Limit invalid search to 'packages' action
Bug: https://bugs.gentoo.org/900224 Fixes: a16d0d4fbfb4614832c4b682b41284a9050af29f Signed-off-by: Siddhanth Rathod <xsiddhanthrathod@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/30 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'pym')
-rw-r--r--pym/gentoolkit/eclean/cli.py46
1 files changed, 24 insertions, 22 deletions
diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 40fc4f9..c8381a0 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -435,7 +435,7 @@ def parseArgs(options={}):
# here are the different allowed command line options (getopt args)
getopt_options = {"short": {}, "long": {}}
- getopt_options["short"]["global"] = "CdDipqe:t:nhVv"
+ getopt_options["short"]["global"] = "CdDipqe:t:nhVvN"
getopt_options["long"]["global"] = [
"nocolor",
"deep",
@@ -450,6 +450,7 @@ def parseArgs(options={}):
"help",
"version",
"verbose",
+ "clean-inavlids",
]
getopt_options["short"]["distfiles"] = "fs:"
getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
@@ -619,28 +620,29 @@ def doAction(action, options, exclude={}, output=None):
)
output.set_colors("deprecated")
output.list_pkgs(deprecated)
- if invalids and options["clean-invalids"]:
- if type(invalids) == list:
- printUsage(_error="invalid_paths", unresolved_invalids=invalids)
- sys.exit(1)
- verb = "were"
- if options["pretend"]:
- verb = "would be"
- if not options["quiet"]:
- print()
- print(
- (
- pp.emph(" The following ")
- + red("invalid")
- + pp.emph(" binpkgs were found")
+ if action in ["packages"]:
+ if invalids and options["clean-invalids"]:
+ if type(invalids) == list:
+ printUsage(_error="invalid_paths", unresolved_invalids=invalids)
+ sys.exit(1)
+ verb = "were"
+ if options["pretend"]:
+ verb = "would be"
+ if not options["quiet"]:
+ print()
+ print(
+ (
+ pp.emph(" The following ")
+ + red("invalid")
+ + pp.emph(" binpkgs were found")
+ )
)
- )
- output.set_colors("invalid")
- output.list_pkgs(invalids)
- clean_size = cleaner.clean_pkgs(invalids, pkgdir)
- output.total("invalid", clean_size, len(invalids), verb, action)
- else:
- cleaner.clean_pkgs(invalids, pkgdir)
+ output.set_colors("invalid")
+ output.list_pkgs(invalids)
+ clean_size = cleaner.clean_pkgs(invalids, pkgdir)
+ output.total("invalid", clean_size, len(invalids), verb, action)
+ else:
+ cleaner.clean_pkgs(invalids, pkgdir)
def main():