[yum-commits] Branch 'yum-3_2_X' - 4 commits - yum/__init__.py yum/misc.py yum/packages.py yum/yumRepo.py
James Antill
james at osuosl.org
Tue Sep 14 14:01:28 UTC 2010
yum/__init__.py | 4 ++--
yum/misc.py | 2 +-
yum/packages.py | 9 ++++++---
yum/yumRepo.py | 9 +++++----
4 files changed, 14 insertions(+), 10 deletions(-)
New commits:
commit 3e05536ef876fc761553b632495449fd96bb4b9e
Author: James Antill <james at and.org>
Date: Tue Sep 14 09:48:23 2010 -0400
Can't keep ts around, due to rpmdb.auto_close. BZ 622179.
This kind of sucks as we have to remember in all future code not to
keep a ts over any .rpmdb call, it's even better because almost nobody
will hit it. It works though, and is simple.
We could maybe fix this "better" by using a weakref in rpmdb, and doing
it that way. Or having some manual way to mark auto_close as off. Or
just rm'ing auto_close as a bad idea.
diff --git a/yum/__init__.py b/yum/__init__.py
index b5e9213..5c689e5 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4301,12 +4301,11 @@ class YumBase(depsolve.Depsolve):
keyurls = repo.gpgkey
key_installed = False
- ts = self.rpmdb.readOnlyTS()
-
for keyurl in keyurls:
keys = self._retrievePublicKey(keyurl, repo)
for info in keys:
+ ts = self.rpmdb.readOnlyTS()
# Check if key is already installed
if misc.keyInstalled(ts, info['keyid'], info['timestamp']) >= 0:
self.logger.info(_('GPG key at %s (0x%s) is already installed') % (
@@ -4331,6 +4330,7 @@ class YumBase(depsolve.Depsolve):
raise Errors.YumBaseError, _("Not installing key")
# Import the key
+ ts = self.rpmdb.readOnlyTS()
result = ts.pgpImportPubkey(misc.procgpgkey(info['raw_key']))
if result != 0:
raise Errors.YumBaseError, \
commit 598b1f767559c0203eb86a8dc2d37cdfd942b90f
Author: James Antill <james at and.org>
Date: Mon Sep 13 10:49:27 2010 -0400
Check all checksums for repomd, from metalink, validation.
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index b501d61..4016ce5 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -1119,6 +1119,7 @@ class YumRepository(Repository, config.RepoConf):
if repoXML.length != repomd.size:
return False
+ done = False
for checksum in repoXML.checksums:
if checksum not in repomd.chksums:
continue
@@ -1126,11 +1127,11 @@ class YumRepository(Repository, config.RepoConf):
if repoXML.checksums[checksum] != repomd.chksums[checksum]:
return False
- # If we don't trust the checksum, then don't generate it in
- # repoMDObject().
- return True
+ # All checksums should be trusted, but if we have more than one
+ # then we might as well check them all ... paranoia is good.
+ done = True
- return False
+ return done
def _checkRepoMetalink(self, repoXML=None, metalink_data=None):
""" Check the repomd.xml against the metalink data, if we have it. """
commit 3d333a56665871f72d43c7e1c083ffff4faf9038
Author: James Antill <james at and.org>
Date: Mon Sep 13 10:40:55 2010 -0400
Add sha384 to available_checksums, so repos. can use it. BZ 633270
diff --git a/yum/misc.py b/yum/misc.py
index 0f80d7d..7e2d745 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -35,7 +35,7 @@ except ImportError:
gpgme = None
try:
import hashlib
- _available_checksums = set(['md5', 'sha1', 'sha256', 'sha512'])
+ _available_checksums = set(['md5', 'sha1', 'sha256', 'sha384', 'sha512'])
_default_checksums = ['sha256']
except ImportError:
# Python-2.4.z ... gah!
commit e91d4b2bc267fa5b79672202d31f49e49373a49c
Author: James Antill <james at and.org>
Date: Mon Sep 13 10:29:05 2010 -0400
Provide the package name on header open failures, use RepoError. BZ 615326
diff --git a/yum/packages.py b/yum/packages.py
index e83c0d5..38f305c 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -806,7 +806,10 @@ class YumAvailablePackage(PackageObject, RpmBase):
def returnHeaderFromPackage(self):
rpmfile = self.localPkg()
ts = rpmUtils.transaction.initReadOnlyTransaction()
- hdr = rpmUtils.miscutils.hdrFromPackage(ts, rpmfile)
+ try:
+ hdr = rpmUtils.miscutils.hdrFromPackage(ts, rpmfile)
+ except rpmUtils.RpmUtilsError:
+ raise Errors.RepoError, 'Package Header %s: RPM Cannot open' % self
return hdr
def returnLocalHeader(self):
@@ -818,9 +821,9 @@ class YumAvailablePackage(PackageObject, RpmBase):
hlist = rpm.readHeaderListFromFile(self.localHdr())
hdr = hlist[0]
except (rpm.error, IndexError):
- raise Errors.RepoError, 'Cannot open package header'
+ raise Errors.RepoError, 'Package Header %s: Cannot open' % self
else:
- raise Errors.RepoError, 'Package Header Not Available'
+ raise Errors.RepoError, 'Package Header %s: Not Available' % self
return hdr
More information about the Yum-commits
mailing list