From 3992e73e569d1ab8f31fcd0829e8ddd2c51c684a Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Mon, 26 Mar 2007 19:11:16 +0300 Subject: Fix bug where we sometimes die if delta repository doesn't exist (Second try) Signed-off-by: Jonathan Dieter --- ChangeLog | 2 +- presto.py | 4 ++-- shared/prestoTransaction.py | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c34b504..6bd1dcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -* Mon Mar 26 2007 Jonathan Dieter - 0.2.6 +* Mon Mar 26 2007 Jonathan Dieter - 0.2.7 - Fix another mirrorlist bug - Minor optimization - Added logging to /var/log/presto.log diff --git a/presto.py b/presto.py index 5741961..a31615e 100644 --- a/presto.py +++ b/presto.py @@ -82,7 +82,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, installed, local) = prestoTransaction.find_available_drpms(conduit, newpkg) + (chosen_drpm, installed, local, drpm_enabled) = prestoTransaction.find_available_drpms(conduit, newpkg) # If a drpm was found, change certain package information so it reflects # the drpm, not the rpm. @@ -112,7 +112,7 @@ 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 installed and not local and newpkg.po.repo.p_repo.enabled: + if installed and drpm_enabled and not local: try: rpm_size += int(newpkg.po.simple['packagesize']) drpm_size += int(newpkg.po.simple['packagesize']) diff --git a/shared/prestoTransaction.py b/shared/prestoTransaction.py index 8a46211..71b90f3 100644 --- a/shared/prestoTransaction.py +++ b/shared/prestoTransaction.py @@ -29,8 +29,14 @@ def find_available_drpms(conduit, newpkg): try: p_repo = newpkg.po.repo.p_repo drpm_enabled = p_repo.enabled + if os.path.exists(newpkg.po.localpath): + is_local = True + else: + is_local = False except: + conduit.info(5, "No Presto repository information for %s.%s %i:%s-%s" % (newpkg.name, newpkg.arch, int(newpkg.epoch), newpkg.version, newpkg.release)) drpm_enabled = False + is_local = False chosen_drpm = None @@ -45,10 +51,6 @@ def find_available_drpms(conduit, newpkg): else: is_installed = True - if os.path.exists(newpkg.po.localpath): - is_local = True - else: - is_local = False if is_installed and drpm_enabled and not is_local: for oldpkg in installed: @@ -78,4 +80,4 @@ def find_available_drpms(conduit, newpkg): except: conduit.info(5, "Verification of %s failed" % seq) - return (chosen_drpm, installed, is_local) + return (chosen_drpm, installed, is_local, drpm_enabled) -- cgit