summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Dieter <jdieter@gmail.com>2007-03-24 21:50:35 +0200
committerJonathan Dieter <jdieter@gmail.com>2007-03-24 21:50:35 +0200
commitfff4696a43faa32f41d5c1726847b51c68db8d60 (patch)
treebd5cbaacfc5cde63a71fd3236d5fb0016a2234fe
parent4abf9bc75423551b2fb0a9e8eee53868c4fb875a (diff)
downloadpresto-fff4696a43faa32f41d5c1726847b51c68db8d60.zip
presto-fff4696a43faa32f41d5c1726847b51c68db8d60.tar.gz
presto-fff4696a43faa32f41d5c1726847b51c68db8d60.tar.xz
Fixed bug that breaks yum install
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
-rw-r--r--ChangeLog3
-rw-r--r--presto.py16
-rw-r--r--shared/prestoTransaction.py75
3 files changed, 54 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index 44c5044..8de0693 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+* Sat Mar 24 2007 Jonathan Dieter <jdieter@gmail.com> - 0.2.3
+ - Fixed bug that breaks yum install
+
* Sat Mar 24 2007 Jonathan Dieter <jdieter@gmail.com> - 0.2.2
- Fixed "not showing download error" bug
- Added --disablepresto yum command-line option
diff --git a/presto.py b/presto.py
index f084aa6..1427a90 100644
--- a/presto.py
+++ b/presto.py
@@ -80,7 +80,7 @@ def postresolve_hook(conduit):
# Cycle through packages to see if there's a deltarpm available
for newpkg in conduit.getTsInfo():
if newpkg.ts_state != "e":
- chosen_drpm = prestoTransaction.find_available_drpms(conduit, newpkg)
+ (chosen_drpm, installed, local) = prestoTransaction.find_available_drpms(conduit, newpkg)
# If a drpm was found, change certain package information so it reflects
# the drpm, not the rpm.
@@ -109,10 +109,12 @@ def postresolve_hook(conduit):
conduit.info(2, "Found deltarpm update for %s.%s %s:%s.%s" % (newpkg.name, newpkg.arch, newpkg.epoch, newpkg.version, newpkg.release))
else:
newpkg.po.hasdrpm = False
- if newpkg.po.repo.p_repo.enabled:
- rpm_size += int(newpkg.po.simple['packagesize'])
- drpm_size += int(newpkg.po.simple['packagesize'])
-
+ if installed and not local and newpkg.po.repo.p_repo.enabled:
+ try:
+ rpm_size += int(newpkg.po.simple['packagesize'])
+ drpm_size += int(newpkg.po.simple['packagesize'])
+ except:
+ pass
return
# Free up memory used by deleting Presto repositories
@@ -171,6 +173,6 @@ def posttrans_hook(conduit):
global drpm_size
if rpm_size > 0:
- conduit.info(2, "Size of all files downloaded from Presto-enabled repositories: %i bytes" % drpm_size)
- conduit.info(2, "Size that would have been downloaded if Presto wasn't enabled: %i bytes" % rpm_size)
+ conduit.info(2, "Size of all updates downloaded from Presto-enabled repositories: %i bytes" % drpm_size)
+ conduit.info(2, "Size updates would have been downloaded if Presto wasn't enabled: %i bytes" % rpm_size)
conduit.info(2, "This is a savings of %i percent" % (100 - ((drpm_size * 100) / rpm_size)))
diff --git a/shared/prestoTransaction.py b/shared/prestoTransaction.py
index bd3bfa1..15ad928 100644
--- a/shared/prestoTransaction.py
+++ b/shared/prestoTransaction.py
@@ -28,39 +28,48 @@ def find_available_drpms(conduit, newpkg):
p_repo = newpkg.po.repo.p_repo
chosen_drpm = None
- if p_repo.enabled:
- # Don't try to download deltarpm if full rpm already exists
- if not os.path.exists(newpkg.po.localpath):
- # First part of key when matching drpms
- key1 = "%s*%s*%i*%s*%s" % (newpkg.name, newpkg.arch, int(newpkg.epoch), newpkg.version, newpkg.release)
-
- # Find any installed packages that match the ones we want to download
- installed = rpmdb.searchNevra(newpkg.name, None, None, None, newpkg.arch)
+ # First part of key when matching drpms
+ key1 = "%s*%s*%i*%s*%s" % (newpkg.name, newpkg.arch, int(newpkg.epoch), newpkg.version, newpkg.release)
+
+ # Find any installed packages that match the ones we want to download
+ installed = rpmdb.searchNevra(newpkg.name, None, None, None, newpkg.arch)
- for oldpkg in installed:
- # Generate second part of key for matching drpms, then full key
- key2 = "%s*%s*%i*%s*%s" % (oldpkg.name, oldpkg.arch, int(oldpkg.epoch), oldpkg.version, oldpkg.release)
- key = "%s!!%s" % (key1, key2)
+ if installed == []:
+ is_installed = False
+ else:
+ is_installed = True
+
+ if os.path.exists(newpkg.po.localpath):
+ is_local = True
+ else:
+ is_local = False
+
+ if is_installed and p_repo.enabled and not is_local:
+ for oldpkg in installed:
+ # Generate second part of key for matching drpms, then full key
+ key2 = "%s*%s*%i*%s*%s" % (oldpkg.name, oldpkg.arch, int(oldpkg.epoch), oldpkg.version, oldpkg.release)
+ key = "%s!!%s" % (key1, key2)
+
+ # Check whether we have a matching drpm
+ if p_repo.deltalist.has_key(key):
+ # Check whether or not we already have a matching drpm, then choose smallest of the two if we do
+ if chosen_drpm == None or p_repo.deltalist[key]['size'] < chosen_drpm['size']:
- # Check whether we have a matching drpm
- if p_repo.deltalist.has_key(key):
- # Check whether or not we already have a matching drpm, then choose smallest of the two if we do
- if chosen_drpm == None or p_repo.deltalist[key]['size'] < chosen_drpm['size']:
+ # Get sequence code for drpm
+ sequence = p_repo.deltalist[key]['sequence']
+ if int(oldpkg.epoch) == 0:
+ seq = "%s-%s-%s-%s" % (oldpkg.name, oldpkg.version, oldpkg.release, sequence)
+ else:
+ seq = "%s-%i:%s-%s-%s" % (oldpkg.name, int(oldpkg.epoch), oldpkg.version, oldpkg.release, sequence)
+ drpm = deltarpm.DeltaRpmWrapper(conduit)
- # Get sequence code for drpm
- sequence = p_repo.deltalist[key]['sequence']
- if int(oldpkg.epoch) == 0:
- seq = "%s-%s-%s-%s" % (oldpkg.name, oldpkg.version, oldpkg.release, sequence)
- else:
- seq = "%s-%i:%s-%s-%s" % (oldpkg.name, int(oldpkg.epoch), oldpkg.version, oldpkg.release, sequence)
- drpm = deltarpm.DeltaRpmWrapper(conduit)
-
- # Attempt to apply sequence code for drpm. If this fails, drpm will not apply cleanly, so
- # don't even try to download it.
- try:
- drpm.verifySequence(seq)
- chosen_drpm = p_repo.deltalist[key]
- chosen_drpm['baseurl'] = p_repo.baseurl[0]
- except:
- conduit.info(5, "Verification of %s failed" % seq)
- return chosen_drpm
+ # Attempt to apply sequence code for drpm. If this fails, drpm will not apply cleanly, so
+ # don't even try to download it.
+ try:
+ drpm.verifySequence(seq)
+ chosen_drpm = p_repo.deltalist[key]
+ chosen_drpm['baseurl'] = p_repo.baseurl[0]
+ except:
+ conduit.info(5, "Verification of %s failed" % seq)
+
+ return (chosen_drpm, installed, is_local)