On Wed, 2008-04-23 at 16:59 +0200, Anders Blomdell wrote: > 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'] > the problem is dealing with partial failures and wildcards. if I say: yum install foo bar baz and foo and bar exist but baz does not - should I exit with non-zero exit value? What about: yum update bar* and I can update bar-libs and bar-app but not bar-compat is that a failure? I'd say no, it is not a failure, in either case. My initial thought is if you want to use yum with scripted interactions you can call the yum module api from python pretty easily these days. does that make sense? -sv _______________________________________________ Yum mailing list Yum@xxxxxxxxxxxxxxxxxxxx https://lists.dulug.duke.edu/mailman/listinfo/yum