From 9f0bcfa35844834d7cee8be92e14e58068a24d87 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 7 Aug 2011 11:37:53 +0200 Subject: [PATCH] Remove old repository metadata when writing new. --- pakfire/repository/local.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) -- 2.39.5