Skip to content

Commit

Permalink
eclean-pkg: Limit invalid search to 'packages' action
Browse files Browse the repository at this point in the history
Bug: https://bugs.gentoo.org/900224
Fixes: a16d0d4
Signed-off-by: Siddhanth Rathod <[email protected]>
Closes: #30
Signed-off-by: Sam James <[email protected]>
  • Loading branch information
hyprsyd authored and thesamesam committed Aug 22, 2023
1 parent a16d0d4 commit 204b1ab
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions pym/gentoolkit/eclean/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def optionSwitch(option, opts, action=None):

# 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",
Expand All @@ -450,6 +450,7 @@ def optionSwitch(option, opts, action=None):
"help",
"version",
"verbose",
"clean-inavlids",
]
getopt_options["short"]["distfiles"] = "fs:"
getopt_options["long"]["distfiles"] = ["fetch-restricted", "size-limit="]
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 204b1ab

Please sign in to comment.