]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
Remove old repository metadata when writing new.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Aug 2011 09:37:53 +0000 (11:37 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Aug 2011 09:37:53 +0000 (11:37 +0200)
pakfire/repository/local.py

index 5831c4bb474f1aaa8968c8c3fecaa2ac302ccd69..5ca12fc3212b89e39502e27e01f82bbb64aafba9 100644 (file)
@@ -118,14 +118,13 @@ class RepositoryDir(base.RepositoryFactory):
                db_path = os.path.join(metapath, METADATA_DATABASE_FILE)
                md_path = os.path.join(metapath, METADATA_DOWNLOAD_FILE)
 
-               if not os.path.exists(metapath):
-                       os.makedirs(metapath)
+               # Remove all pre-existing metadata.
+               if os.path.exists(metapath):
+                       print "Removing", metapath
+                       util.rm(metapath)
 
-               else:
-                       # If a database is present, we remove it because we want to start
-                       # with a clean environment.
-                       if os.path.exists(db_path):
-                               os.unlink(db_path)
+               # Create directory for metdadata.
+               os.makedirs(metapath)
 
                # Save the database to path and get the filename.
                self.index.write(db_path)