[Yum-devel] [PATCH 2/2] Use rpmsack for retrieving system release version
Panu Matilainen
pmatilai at laiskiainen.org
Thu Feb 24 11:49:52 UTC 2011
On 02/15/2011 05:16 PM, seth vidal wrote:
> On Tue, 2011-02-15 at 10:08 -0500, James Antill wrote:
>> On Tue, 2011-02-15 at 13:06 +0200, Panu Matilainen wrote:
>>> Avoids another lowlevel rpm routine usage where rpmsack provides
>>> a nicer interface for the thing, and another step towards consolidating
>>> rpm quirk handling to one spot.
>>
>> This makes me twitch a bit, it just seems wrong to have config depend
>> on rpmsack ... I can't see any problems atm. though, so let me think
>> about it a bit more.
>> Anyone else have an opinion?
>>
>
> feels like a place where we'll trip up later by a stray or circular
> import but there's nothing implicitly worrisome about it. I use the
> RpmDBPackageSack object directly for talking to the rpmdb w/o
> instantiating a yumbase object pretty commonly in little random scripts.
So ... any decision wrt this - is it ok to use rpmdbsack from config or
not? Like said (IIRC), another way to avoid the current circular import
without shuffling anything else around is putting the import inside
_getsysver(), eg
--- a/yum/config.py
+++ b/yum/config.py
@@ -1000,10 +1000,10 @@ def _getsysver(installroot, distroverpkg):
@param distroverpkg: The value of the distroverpkg option.
@return: The release version as a string (eg. '4' for FC4)
'''
- ts = rpmUtils.transaction.initReadOnlyTransaction(root=installroot)
- ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS))
+ from rpmsack import RPMDBPackageSack
+ rpmdb = RPMDBPackageSack(root=installroot)
...
- Panu -
More information about the Yum-devel
mailing list