[packagekit] yumbackend metadata_expire in mediarepo

مؤيد السعدي muayyad.alsadi at ojuba.org
Wed Jul 29 08:24:10 PDT 2009


hello,


>> for repo in self.yumbase.repos.listEnabled():
>>    if repo.metadata_expire!=-1:
>>        repo.metadata_expire = 60 * 60 * 24  # 24 hours
> 
> Yes, this is a good idea, along with a comment describing what the -1
> value means.
> 
the value of metadata_expire is a time after which yum will try to check
for updates (refresh its metadata)
a value of -1 means never expire the metadata 
a value of 0 means the metadata is currently expired

I asked Seth Vidal (skvidal) on the IRC and he said that he liked the
following solution

    if not repo.mediaid:

maybe he liked this solution because repo.metadata_expire is set to -1 when
we are offline (line 2475)
http://cgit.freedesktop.org/packagekit/tree/backends/yum/yumBackend.py#n2475

ie. -1 is no longer special and this could (just a guess) case a bug in the
following scenario:
Ahmad is using PK and he is online
when Ahmad goes offline (he wants to use some local repos and media repos)
PK overwrite the original value of metadata_expire to -1

when the control of the program goes to 
>> for repo in self.yumbase.repos.listEnabled():
>>    if repo.metadata_expire!=-1:
>>        repo.metadata_expire = 60 * 60 * 24  # 24 hours

maybe when Ahmad is back online it will never make any refresh because the
value of expire=-1

a trivial patch is attached

NOTE: I could be mistaken about the side effects of line 2475
in that case the patch should be like this
if repo.mediaid or repo.metadata_expire==-1: continue

another thing to note that the patch should allow creation of the metadata
for the first time
to test that one should do

/bin/rm -r /var/cache/yum/InstallMedia

then start PK, PK should asks for the media to be inserted
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PackageKit-MediaRepo-no-expire.patch
Type: text/x-diff
Size: 1191 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20090729/58edd521/attachment-0004.patch>


More information about the PackageKit mailing list