From: Michael Tremer Date: Sun, 7 Aug 2011 09:37:53 +0000 (+0200) Subject: Remove old repository metadata when writing new. X-Git-Tag: 0.9.9~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f0bcfa35844834d7cee8be92e14e58068a24d87;p=pakfire.git Remove old repository metadata when writing new. --- diff --git a/pakfire/repository/local.py b/pakfire/repository/local.py index 5831c4bb4..5ca12fc32 100644 --- a/pakfire/repository/local.py +++ b/pakfire/repository/local.py @@ -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)