summaryrefslogtreecommitdiff
path: root/SoftwareProperties/aptsources.py
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-02-24 18:16:52 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-02-24 18:16:52 +0100
commit52c686391e543bbc1084ec15f40abe8e58b1d514 (patch)
treec662ba4d1acf5f2d7f68e917145aa20ce6df9c81 /SoftwareProperties/aptsources.py
parent8cfca4a5ed2b0fd1ef52b645eedbce3c64e03c6b (diff)
downloadpython-apt-52c686391e543bbc1084ec15f40abe8e58b1d514.tar.gz
* Remove all obsolete backup files before backup
Diffstat (limited to 'SoftwareProperties/aptsources.py')
-rw-r--r--SoftwareProperties/aptsources.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index 604af097..397ebb38 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -314,6 +314,18 @@ class SourcesList:
def remove(self, source_entry):
self.list.remove(source_entry)
+ def clearBackup(self, backup_ext):
+ " remove backuped sources.list files based on the backup extension "
+ dir = apt_pkg.Config.FindDir("Dir::Etc")
+ file = apt_pkg.Config.Find("Dir::Etc::sourcelist")
+ if os.path.exists(dir+file+backup_ext):
+ os.remove(dir+file+backup_ext)
+ # now sources.list.d
+ partsdir = apt_pkg.Config.FindDir("Dir::Etc::sourceparts")
+ for file in glob.glob("%s/*.list" % partsdir):
+ if os.path.exists(file+backup_ext):
+ os.remove(file+backup_ext)
+
def restoreBackup(self, backup_ext):
" restore sources.list files based on the backup extension "
dir = apt_pkg.Config.FindDir("Dir::Etc")