[PATCH] yumdownloader ignores broken/missing packages - fixed
bgaifullin at mirantis.com
bgaifullin at mirantis.com
Mon Sep 21 07:32:37 UTC 2015
From: Bulat Gaifullin <bgaifullin at mirantis.com>
the command "yumdownloader -q --urls --archlist=x86_64 --resolve bash zzzzzzz"
always completed with success even though there is no package with name "zzzzz".
added option "--strict" that allows to stop execution if there is a broken/missing package.
---
yumdownloader.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/yumdownloader.py b/yumdownloader.py
index 1b95e8d..8deac9a 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -171,7 +171,10 @@ class YumDownloader(YumUtilBase):
if not installable: # doing one at a time, apart from groups
self.logger.error('No Match for argument %s' % pkg)
+ if opts.strict:
+ sys.exit(1)
continue
+
for newpkg in installable:
toActOn.extend(_best_convert_pkg2srcpkgs(self, opts, newpkg))
if toActOn:
@@ -185,7 +188,7 @@ class YumDownloader(YumUtilBase):
toDownload.extend(self.bestPackagesFromList(pkgs, arch))
else:
toDownload.extend(self.bestPackagesFromList(pkgs))
-
+
# If the user supplies to --resolve flag, resolve dependencies for
# all packages
# note this might require root access because the headers need to be
@@ -228,7 +231,7 @@ class YumDownloader(YumUtilBase):
for error in probs[key]:
self.logger.error('%s: %s', key, error)
return exit_code
-
+
def _groupPackages(self,pkglist):
pkgGroups = {}
for po in pkglist:
@@ -238,13 +241,13 @@ class YumDownloader(YumUtilBase):
else:
pkgGroups[na].append(po)
return pkgGroups
-
+
def addCmdOptions(self):
# this if for compatibility with old API (utils.py from yum < 3.2.23)
if hasattr(self,'getOptionGroup'): # check if the group option API is available
group = self.getOptionGroup()
else:
- group = self.optparser
+ group = self.optparser
group.add_option("--destdir", default=".", dest="destdir",
help='destination directory (defaults to current directory)')
group.add_option("--urls", default=False, dest="urls", action="store_true",
@@ -255,6 +258,8 @@ class YumDownloader(YumUtilBase):
help='operate on source packages')
group.add_option("--archlist",
help="only download packages of given and compatible architectures")
+ group.add_option("--strict", default=False, dest='strict', action='store_true',
+ help="stop execution if one of the packages is broken or missing")
if __name__ == '__main__':
setup_locale()
--
2.3.8 (Apple Git-58)
More information about the Yum-devel
mailing list