[packagekit] Yum and locking

Robin Norwood rnorwood at redhat.com
Thu Oct 18 07:59:16 PDT 2007


Tim Lauridsen <tla at rasmil.dk> writes:

>>
>> The still is needing some signal catching to work with the abort case.
>>
> i have added some code so yum is unlocked on SIGQUIT, but i don't know 
> to test it.

Cool.  However, it looks like the way things are now it will just abort
if something else has the lock - shouldn't we wait around awhile, and
perhaps notify PK with a signal?

So instead of:

    def doLock(self):
        ''' Lock Yum'''
        if not self.isLocked():        
            try: # Try to lock yum
                self.yumbase.doLock( YUM_PID_FILE )
                PackageKitBaseBackend.doLock(self)
            except:
                self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')

We do something like:

    def doLock(self):
        ''' Lock Yum'''
        retries = 0
        while not self.isLocked():
            try: # Try to lock yum
                self.yumbase.doLock( YUM_PID_FILE )
                PackageKitBaseBackend.doLock(self)
            except:
                sleep(6)
                retries++
                if retries > 100:
                    self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')


What do you think?

Also, looking at yumBackend.py, I'm a little confused now - it looks
like there are two sets of lock/unlock code: do(Un)Lock and
_(un)lock_yum.  I can't really see why there are two different sets of
methods...

-RN

-- 
Robin Norwood
Red Hat, Inc.

"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching



More information about the PackageKit mailing list