[packagekit] yum2 error fixes

Robin Norwood rnorwood at redhat.com
Sat Feb 16 13:24:39 PST 2008


On Sat, 16 Feb 2008 20:15:12 +0100
Tim Lauridsen <tim.lauridsen at googlemail.com> wrote:

> Robin Norwood wrote:
> > On Fri, 15 Feb 2008 20:30:32 +0100
> > Tim Lauridsen <tim.lauridsen at googlemail.com> wrote:
> > 
> >> Robin Norwood wrote:
> >>> o Is 'yum cache invalid' a correct description for any RepoError,
> >>> or are there other error cases that throw RepoErrors?
> >>>
> >> RepoError is raised, if there is something wrong with metadate, i 
> >> cacheonly mode, then it is because some need metadata is missing.
> >> There is some other cases when not in cacheonly mode, but this is
> >> thing we cant solve any way. (Ex. bad configuration i .repo files)
> >>
> >>> o Is there anything we can do inside PK to recover from this?
> >> We can refreshcache and try again.
> > 
> > Ok.  That takes almost a minute on my system.  What's the best way
> > to notify the engine so the user
> > 
> >         except yum.Errors.RepoError,e:
> >             self.ErrorCode(ERROR_NO_CACHE,"Yum cache is invalid.
> > Rebuilding.") self.Finished(EXIT_FAILED)
> >             self.StatusChanged(STATUS_WAIT)
> >             self._refresh_yum_cache()
> >             return
> 
> I am not sure we should do this (self._refresh_yum_cache()) we should 
> just signal to pk that the cache is invalid, and then pk should call 
> RefreshCache(). Hughsie?

That's an acceptable alternative, and would probably provide a better
user experience.  However, it means that various pieces of the UI
(pkcon, pk-application, pk-update-thingie) will need to handle the
error condition and issue the RefreshCache call.  I picked this way
since it's simpler. I don't mind to change it if you and hughsie want,
though.

FYI, the new code looks like this instead of what I quoted above:

        except yum.Errors.RepoError,e:
            self.ErrorCode(ERROR_NO_CACHE,"Yum cache is invalid")
            self._refresh_yum_cache()
            self.Finished(EXIT_FAILED)
            self.Exit()

And _refresh_yum_cache calls: StatusChanged(STATUS_REFRESH_CACHE)

-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