From 9c3b99470f16a531a837ed980ca5848ea3c3a29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Tue, 28 Sep 2010 06:21:37 +0000 Subject: [PATCH] install: Do not calculate the sum of cached file twice --- pisi/atomicoperations.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index fffa344a..fcfaf335 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2005 - 2007, TUBITAK/UEKAE +# Copyright (C) 2005-2010, TUBITAK/UEKAE # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -105,13 +105,15 @@ class Install(AtomicOperation): cached_file = pisi.package.Package.is_cached(pkg_path) if cached_file and util.sha1_file(cached_file) != pkg_hash: os.unlink(cached_file) + cached_file = None install_op = Install(pkg_path, ignore_dep) # Bug 4113 - downloaded_file = install_op.package.filepath - if pisi.util.sha1_file(downloaded_file) != pkg_hash: - raise pisi.Error(_("Download Error: Package does not match the repository package.")) + if not cached_file: + downloaded_file = install_op.package.filepath + if pisi.util.sha1_file(downloaded_file) != pkg_hash: + raise pisi.Error(_("Download Error: Package does not match the repository package.")) return install_op else: