From: Michael Tremer Date: Fri, 29 Jul 2011 15:41:14 +0000 (+0200) Subject: Fix and faster creation of the repository index. X-Git-Tag: 0.9.4~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0d68cb88b84ca21f4cc05a203c51eb6cac50d55;p=people%2Fms%2Fpakfire.git Fix and faster creation of the repository index. --- diff --git a/pakfire/repository/local.py b/pakfire/repository/local.py index 00d3f84b5..5ba0fd448 100644 --- a/pakfire/repository/local.py +++ b/pakfire/repository/local.py @@ -47,16 +47,15 @@ class RepositoryDir(base.RepositoryFactory): # files are really equal. if os.path.exists(repo_filename): pkg_exists = packages.open(self.pakfire, self, repo_filename) + copy = False # Check UUID at first (faster) and check the file hash to be # absolutely sure. - if pkg.uuid == pkg_exists.uuid and pkg.hash1 == pkg_exists.hash1: - # Do not copy the file if it is already okay. - copy = False - # Otherwise, unlink the existing file and replace it with the # new one. - else: + if pkg.uuid != pkg_exists.uuid and pkg.hash1 != pkg_exists.hash1: + # Do not copy the file if it is already okay. + copy = True os.unlink(repo_filename) del pkg_exists