[PATCH] Use the rpm database to find packages installed by package payloads

David Shea dshea at redhat.com
Mon Jan 26 14:47:45 UTC 2015


On 01/26/2015 02:45 AM, Vratislav Podzimek wrote:
> On Fri, 2015-01-23 at 10:41 -0500, David Shea wrote:
>> The previous PackagePayload implementations of kernelVersionList had a
>> problem in that they could miss kernels installed by packages not named
>> "kernel" (kernel-core, kernel-PAE, kernel-debug) and in that there may
>> be a difference between the package EVR and the version derived from
>> s/vmlinuz-// (because there's a +PAE or +debug in it or something).
>> ---
>>   pyanaconda/packaging/__init__.py   | 19 +++++++++++++++++++
>>   pyanaconda/packaging/dnfpayload.py |  7 -------
>>   pyanaconda/packaging/yumpayload.py |  8 --------
>>   3 files changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
>> index 2438b6f..2129347 100644
>> --- a/pyanaconda/packaging/__init__.py
>> +++ b/pyanaconda/packaging/__init__.py
>> @@ -35,6 +35,7 @@ import ConfigParser
>>   import shutil
>>   import time
>>   from glob import glob
>> +from fnmatch import fnmatch
>>   import threading
>>   import re
>>   
>> @@ -696,6 +697,24 @@ class PackagePayload(Payload):
>>           return kernels
>>   
>>       @property
>> +    def kernelVersionList(self):
>> +        # Find all installed rpms that provide 'kernel'
>> +        # Unlike the rpm imports in Payload, this one is mandatory
>> +        import rpm
> Maybe we could make Payload's rpm imports mandatory too? We do make sure
> that rpm-python is available. Or if that's not possible, we should catch
> the ImportError here in case rpm-python is not available and raise a
> better (more descriptive) one. Otherwise this looks good to me.
>

I feel like if the rpm imports have been optional for this long, making 
them mandatory will uncover some group of people using TarPayload in an 
rpmless environment or something like that. Converting the ImportError 
to PayloadError or something like that makes sense, though.


More information about the anaconda-patches mailing list