add CLI switches to make output less noisy by default

This commit is contained in:
Fabio Valentini 2022-08-24 12:20:50 +02:00
commit 90c3f490fb
Signed by: decathorpe
GPG key ID: 5AC5F572E5D410AF

View file

@ -13,11 +13,6 @@
# infrastructure (one shared "-source" repository for all architectures, which
# contains SRPM files with randomized architecture-specific BuildRequires).
#
# However, this case mostly affects more "esoteric" architectures like ppc64le
# and s390x (for example, due to missing Qt5WebKit / Qt5WebEngine support), so
# this limitation should have little to no impact on the correctness of this
# script for i686.
#
# Author: Fabio Valentini <decathorpe@gmail.org>
# SPDX-License-Identifier: Unlicense
@ -156,12 +151,24 @@ def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument(
"package",
help="Source name of the package to check for leaf status on i686"
help="Source name of the package to check for leaf status on i686",
)
parser.add_argument(
"--clean-cache",
action="store_true",
help="Delete DNF metadata after executing the query."
help="Delete DNF metadata after executing the query",
)
parser.add_argument(
"--print-same-package",
"-s",
action="store_true",
help="Print intra-package dependencies",
)
parser.add_argument(
"--print-leaf-packages",
"-p",
action="store_true",
help="Print leaf subpackages in results"
)
args = parser.parse_args()
@ -200,17 +207,28 @@ def main() -> int:
all_internal = False
if requires:
print(f"{key} is Required by:")
r_to_print = []
for name in requires:
print(f"- {name}")
if args.print_same_package or name not in s2b[args.package]:
r_to_print.append(name)
if r_to_print:
print(f"{key} is Required by:")
for name in r_to_print:
print(f"- {name}")
elif args.print_leaf_packages:
print(f"{key} is a leaf package.")
if build_requires:
print(f"{key} is BuildRequired by:")
br_to_print = []
for name in build_requires:
print(f"- {name}")
if args.print_same_package or name not in s2b[args.package]:
br_to_print.append(name)
if requires or build_requires:
print()
if br_to_print:
print(f"{key} is BuildRequired by:")
for name in br_to_print:
print(f"- {name}")
if all_internal:
print(f"YES: Package {args.package} is a leaf package on i686.")