From d65c0a7ca4e32226d4028a5156a4e81345e96f62 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Thu, 14 Feb 2008 10:01:45 +0000 Subject: [PATCH] Fix some twisted logic and add remove_permanent param to remove_file. From now on "pisi rm" operation will remove permanent files. Upgrades will continue to not remove them. BUG:FIXED:6938 --- pisi/atomicoperations.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 20339e18..f0843924 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -479,7 +479,7 @@ class Remove(AtomicOperation): self.run_preremove() for fileinfo in self.files.list: - self.remove_file(fileinfo, self.package_name) + self.remove_file(fileinfo, self.package_name, True) self.update_databases() @@ -495,7 +495,11 @@ class Remove(AtomicOperation): # is there any package who depends on this package? @staticmethod - def remove_file(fileinfo, package_name): + def remove_file(fileinfo, package_name, remove_permanent=False): + + if fileinfo.permanent and not remove_permanent: + return + fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) filesdb = pisi.db.filesdb.FilesDB() @@ -509,10 +513,7 @@ class Remove(AtomicOperation): ctx.ui.warning(_('Not removing conflicted file : %s') % fpath) return - if fileinfo.permanent: - # do not remove precious files :) - pass - elif fileinfo.type == ctx.const.conf: + if fileinfo.type == ctx.const.conf: # config files are precious, leave them as they are # unless they are the same as provided by package. try: