[packagekit] Reviewing use of internal-error

Robin Norwood rnorwood at redhat.com
Mon Mar 24 11:20:55 PDT 2008


On Mon, 24 Mar 2008 17:32:06 +0000
Richard Hughes <hughsient at gmail.com> wrote:

> Guys, we shouldn't be using internal-error at all:
> 
> Error Type: <class 'yum.Errors.RepoError'>
> Error Value: Cannot retrieve repository metadata (repomd.xml) for
> repository: utopia. Please verify its path and try again
> File : /usr/share/PackageKit/helpers/yum/get-updates.py , line 19, in
> <module> backend.get_updates(filter)
> File : /usr/share/PackageKit/helpers/yum/yumBackend.py , line 1075,
> in get_updates self._refresh_yum_cache()
> File : /usr/share/PackageKit/helpers/yum/yumBackend.py , line 1237,
> in _refresh_yum_cache
> self.yumbase.repos.populateSack(mdtype='metadata', cacheonly=1)
> File : /usr/lib/python2.5/site-packages/yum/repos.py , line 244, in
> populateSack sack.populate(repo, mdtype, callback, cacheonly)
> File : /usr/lib/python2.5/site-packages/yum/yumRepo.py , line 149, in
> populate if self._check_db_version(repo, mydbtype):
> File : /usr/lib/python2.5/site-packages/yum/yumRepo.py , line 203, in
> _check_db_version return repo._check_db_version(mdtype)
> File : /usr/lib/python2.5/site-packages/yum/yumRepo.py , line 911, in
> _check_db_version repoXML = self.repoXML
> File : /usr/lib/python2.5/site-packages/yum/yumRepo.py , line 1057,
> in <lambda> repoXML = property(fget=lambda self: self._getRepoXML(),
> File : /usr/lib/python2.5/site-packages/yum/yumRepo.py , line 1053,
> in _getRepoXML raise Errors.RepoError, msg
> 
> In this case we should emit an error PK_ERROR_ENUM_FAILED_TO_DOWNLOAD
> metadata so we can tell the user what is going on rather than
> "Internal error".
> 
> If you give me a list of enums to add, I'll do them as quick as you
> like :-)

Here are the places where the yum2 backend is using INTERNAL_ERROR,
and my suggested replacements:

When the yum backend times out attempting to get a
lock: ERROR_CANNOT_GET_LOCK

When UpdateSystem is called, but there are no updates:
ERROR_NO_PACKAGES_TO_UPDATE

When we can't write to the repo config file (IOError):
ERROR_CANNOT_WRITE_REPO_CONFIG

When we can't install a 'local' rpm file: ERROR_LOCAL_INSTALL_ERROR

When there is a problem with the packages GPG signature (ie, the
package signature is corrupt or invalid, not just that the package is
signed with a signature that is not imported: ERROR_BAD_GPG_SIGNATURE

I'll add the aforementioned new error codes unless someone objects soon.

-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