Re: Treating 'not found' packages as errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



seth vidal wrote:
> 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?
Yes, the software that handles updates is already in python.

Are there any docs available for the API?

BTW: My software for updates is at
http://www.control.lth.se/user/andersb/software/mio/ but docs are [currently and
for some time now] badly out of sync...

Best regards

Anders Blomdell

-- 
Anders Blomdell                  Email: anders.blomdell@xxxxxxxxxxxxxx
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden
_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxxxxx
https://lists.dulug.duke.edu/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux