]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Fix and faster creation of the repository index.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Jul 2011 15:41:14 +0000 (17:41 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Jul 2011 15:41:14 +0000 (17:41 +0200)
pakfire/repository/local.py

index 00d3f84b519e0743815071b4ce4bfd9c76dcf546..5ba0fd448fcf2fbc4225d2bbf97b580609546165 100644 (file)
@@ -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