Treating 'not found' packages as errors
Anders Blomdell <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm using yum for keeping all my machines properly installed. Unfortunately I
occasionally makes mistakes and asks yum to install packages that does not
exist, this gives printouts like (with enough verbosity enabled):
No package misspelled_package_name available.
but the exit status from yum is unfortunately 0, so there is no way to find this
out from a script. I humbly suggest something like:
--- cli.py~ 2007-12-05 23:27:40.000000000 +0100
+++ cli.py 2008-04-23 16:24:48.000000000 +0200
@@ -456,7 +456,8 @@
toBeInstalled = {} # keyed on name
passToUpdate = [] # list of pkgtups to pass along to updatecheck
-
+ not_found = [] # list of packages that could not be found
+
self.verbose_logger.log(yum.logginglevels.INFO_2,
_('Parsing package install arguments'))
for arg in userlist:
@@ -506,7 +507,8 @@
if len(installable) == 0:
self.verbose_logger.log(yum.logginglevels.INFO_2,
'No package %s available.', arg)
-
+ not_found.append("Package '%s' not found" % arg)
+
# we look through each returned possibility and rule out the
# ones that we obviously can't use
for pkg in installable:
@@ -578,6 +580,8 @@
if len(self.tsInfo) > oldcount:
return 2, ['Package(s) to install']
+ if len(not_found) > 0:
+ return 1, not_found
return 0, ['Nothing to do']
Best regards
Anders Blomdell
--
Anders Blomdell Email: [email protected]
Department of Automatic Control
Lund University Phone: +46 46 222 4625
P.O. Box 118 Fax: +46 46 138118
SE-221 00 Lund, Sweden