install: Do not calculate the sum of cached file twice
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# 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
|
# 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)
|
cached_file = pisi.package.Package.is_cached(pkg_path)
|
||||||
if cached_file and util.sha1_file(cached_file) != pkg_hash:
|
if cached_file and util.sha1_file(cached_file) != pkg_hash:
|
||||||
os.unlink(cached_file)
|
os.unlink(cached_file)
|
||||||
|
cached_file = None
|
||||||
|
|
||||||
install_op = Install(pkg_path, ignore_dep)
|
install_op = Install(pkg_path, ignore_dep)
|
||||||
|
|
||||||
# Bug 4113
|
# Bug 4113
|
||||||
downloaded_file = install_op.package.filepath
|
if not cached_file:
|
||||||
if pisi.util.sha1_file(downloaded_file) != pkg_hash:
|
downloaded_file = install_op.package.filepath
|
||||||
raise pisi.Error(_("Download Error: Package does not match the repository package."))
|
if pisi.util.sha1_file(downloaded_file) != pkg_hash:
|
||||||
|
raise pisi.Error(_("Download Error: Package does not match the repository package."))
|
||||||
|
|
||||||
return install_op
|
return install_op
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user