[yum-commits] 3 commits - yum/__init__.py yum/pkgtag_db.py
James Antill
james at osuosl.org
Wed Dec 7 14:40:42 UTC 2011
yum/__init__.py | 50 ++++++++++++++++++++++++++++++++++++++------------
yum/pkgtag_db.py | 1 +
2 files changed, 39 insertions(+), 12 deletions(-)
New commits:
commit 77a833e03ca2d24618958cd1030ecbbcc1709fed
Author: James Antill <james at and.org>
Date: Wed Dec 7 09:40:23 2011 -0500
Add the other compression types to metadata cleanup.
diff --git a/yum/__init__.py b/yum/__init__.py
index 3872566..9163ad0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2421,13 +2421,15 @@ class YumBase(depsolve.Depsolve):
def cleanSqlite(self):
"""Delete the sqlite files from the yum cache."""
- exts = ['sqlite', 'sqlite.bz2', 'sqlite-journal']
+ exts = ['sqlite', 'sqlite.bz2', 'sqlite.gz', 'sqlite.xz',
+ 'sqlite-journal']
return self._cleanFiles(exts, 'cachedir', 'sqlite')
def cleanMetadata(self):
"""Delete the metadata files from the yum cache."""
- exts = ['xml.gz', 'xml', 'cachecookie', 'mirrorlist.txt', 'asc']
+ exts = ['xml.gz', 'xml', 'cachecookie', 'mirrorlist.txt', 'asc',
+ 'xml.bz2', 'xml.xz']
# Metalink is also here, but is a *.xml file
return self._cleanFiles(exts, 'cachedir', 'metadata')
commit 56e101bedd62e98fbc55715193d8a38ea0c33c70
Author: James Antill <james at and.org>
Date: Tue Dec 6 15:36:30 2011 -0500
Give name of pkg. and GPG urls when failed to install key. CKS/YumCryptoFail.
diff --git a/yum/__init__.py b/yum/__init__.py
index 5c7e511..3872566 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -5169,6 +5169,13 @@ class YumBase(depsolve.Depsolve):
keyurls = repo.gpgkey
key_installed = False
+ def _prov_key_data(msg):
+ msg += _('\n\n\n'
+ ' Failing package is: %s\n'
+ ' GPG Keys are configured as: %s\n'
+ ) % (po, ", ".join(repo.gpgkey))
+ return msg
+
user_cb_fail = False
for keyurl in keyurls:
keys = self._retrievePublicKey(keyurl, repo)
@@ -5215,8 +5222,8 @@ class YumBase(depsolve.Depsolve):
ts = self.rpmdb.readOnlyTS()
result = ts.pgpImportPubkey(misc.procgpgkey(info['raw_key']))
if result != 0:
- raise Errors.YumBaseError, \
- _('Key import failed (code %d)') % result
+ msg = _('Key import failed (code %d)') % result
+ raise Errors.YumBaseError, _prov_key_data(msg)
self.logger.info(_('Key imported successfully'))
key_installed = True
@@ -5224,18 +5231,20 @@ class YumBase(depsolve.Depsolve):
raise Errors.YumBaseError, _("Didn't install any keys")
if not key_installed:
- raise Errors.YumBaseError, \
- _('The GPG keys listed for the "%s" repository are ' \
+ msg = _('The GPG keys listed for the "%s" repository are ' \
'already installed but they are not correct for this ' \
'package.\n' \
'Check that the correct key URLs are configured for ' \
- 'this repository.') % (repo.name)
+ 'this repository.') % repo.name
+ raise Errors.YumBaseError, _prov_key_data(msg)
# Check if the newly installed keys helped
result, errmsg = self.sigCheckPkg(po)
if result != 0:
- self.logger.info(_("Import of key(s) didn't help, wrong key(s)?"))
- raise Errors.YumBaseError, errmsg
+ msg = _("Import of key(s) didn't help, wrong key(s)?")
+ self.logger.info(msg)
+ errmsg = to_unicode(errmsg)
+ raise Errors.YumBaseError, _prov_key_data(errmsg)
def _getAnyKeyForRepo(self, repo, destdir, keyurl_list, is_cakey=False, callback=None):
"""
@@ -5252,6 +5261,18 @@ class YumBase(depsolve.Depsolve):
"""
key_installed = False
+
+ def _prov_key_data(msg):
+ cakeytxt = _("No")
+ if is_cakey:
+ cakeytxt = _("Yes")
+ msg += _('\n\n\n'
+ ' CA Key: %s\n'
+ ' Failing repo is: %s\n'
+ ' GPG Keys are configured as: %s\n'
+ ) % (cakeytxt, repo, ", ".join(keyurl_list))
+ return msg
+
user_cb_fail = False
for keyurl in keyurl_list:
keys = self._retrievePublicKey(keyurl, repo, getSig=not is_cakey)
@@ -5302,7 +5323,8 @@ class YumBase(depsolve.Depsolve):
# Import the key
result = misc.import_key_to_pubring(info['raw_key'], info['hexkeyid'], gpgdir=destdir)
if not result:
- raise Errors.YumBaseError, _('Key import failed')
+ msg = _('Key %s import failed') % info['hexkeyid']
+ raise Errors.YumBaseError, _prov_key_data(msg)
self.logger.info(_('Key imported successfully'))
key_installed = True
# write out the key id to imported_cakeys in the repos basedir
@@ -5318,14 +5340,16 @@ class YumBase(depsolve.Depsolve):
pass
if not key_installed and user_cb_fail:
- raise Errors.YumBaseError, _("Didn't install any keys for repo %s") % repo
+ msg = _("Didn't install any keys for repo %s") % repo
+ raise Errors.YumBaseError, _prov_key_data(msg)
if not key_installed:
- raise Errors.YumBaseError, \
+ msg = \
_('The GPG keys listed for the "%s" repository are ' \
'already installed but they are not correct.\n' \
'Check that the correct key URLs are configured for ' \
'this repository.') % (repo.name)
+ raise Errors.YumBaseError, _prov_key_data(msg)
def getKeyForRepo(self, repo, callback=None):
"""Retrieve a key for a repository. If needed, use the given
commit 6ea12320ee0ab63a5f01bfebbe438f8c1f47e4bc
Author: James Antill <james at and.org>
Date: Tue Dec 6 12:44:28 2011 -0500
Catch the sqlite error when we can't open the DB file.
diff --git a/yum/pkgtag_db.py b/yum/pkgtag_db.py
index afcc28d..934f246 100644
--- a/yum/pkgtag_db.py
+++ b/yum/pkgtag_db.py
@@ -46,6 +46,7 @@ def catchSqliteException(func):
class PackageTagDB(object):
+ @catchSqliteException
def __init__(self, repoid, sqlite_file):
self.sqlite_file = sqlite_file
self.repoid = repoid
More information about the Yum-commits
mailing list