[PATCH] repotrack now fails when asked about unknown rpm
Maiki
maiki.dev at gmail.com
Mon Nov 30 15:45:16 UTC 2015
From: Michael Cottencin <maiki.dev at gmail.com>
Previously, repotrack exited on error if NONE of the requested packages
were found. When only a subset of the requested packages matched,
repotrack continued. This leads to a tricky situation where the user
assumed everything went well but it did not.
e.g: issuing the following command
repotrack UNKNOWN_RPM bash
will succeede (assuming bash and its dependencies can be reached) but
the UNKNOWN_RPM won't be downloaded.
---
repotrack.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/repotrack.py b/repotrack.py
index 8dd8b9c..66f0ede 100755
--- a/repotrack.py
+++ b/repotrack.py
@@ -163,12 +163,14 @@ def main():
unprocessed_pkgs = {}
final_pkgs = {}
pkg_list = []
-
+ unmatched_pkg_list = []
+
avail = my.pkgSack.returnPackages()
for item in user_pkg_list:
exactmatch, matched, unmatched = parsePackages(avail, [item])
pkg_list.extend(exactmatch)
pkg_list.extend(matched)
+ unmatched_pkg_list.extend(unmatched)
if opts.newest:
this_sack = ListPackageSack()
this_sack.addList(pkg_list)
@@ -178,6 +180,10 @@ def main():
if len(pkg_list) == 0:
print >> sys.stderr, "Nothing found to download matching packages specified"
sys.exit(1)
+
+ if len(unmatched_pkg_list) > 0:
+ print >> sys.stderr, "Could not find the following requested package(s):",' '.join(unmatched_pkg_list)
+ sys.exit(1)
for po in pkg_list:
unprocessed_pkgs[po.pkgtup] = po
--
2.4.10
More information about the Yum-devel
mailing list