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
This commit is contained in:
@@ -479,7 +479,7 @@ class Remove(AtomicOperation):
|
|||||||
|
|
||||||
self.run_preremove()
|
self.run_preremove()
|
||||||
for fileinfo in self.files.list:
|
for fileinfo in self.files.list:
|
||||||
self.remove_file(fileinfo, self.package_name)
|
self.remove_file(fileinfo, self.package_name, True)
|
||||||
|
|
||||||
self.update_databases()
|
self.update_databases()
|
||||||
|
|
||||||
@@ -495,7 +495,11 @@ class Remove(AtomicOperation):
|
|||||||
# is there any package who depends on this package?
|
# is there any package who depends on this package?
|
||||||
|
|
||||||
@staticmethod
|
@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)
|
fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path)
|
||||||
|
|
||||||
filesdb = pisi.db.filesdb.FilesDB()
|
filesdb = pisi.db.filesdb.FilesDB()
|
||||||
@@ -509,10 +513,7 @@ class Remove(AtomicOperation):
|
|||||||
ctx.ui.warning(_('Not removing conflicted file : %s') % fpath)
|
ctx.ui.warning(_('Not removing conflicted file : %s') % fpath)
|
||||||
return
|
return
|
||||||
|
|
||||||
if fileinfo.permanent:
|
if fileinfo.type == ctx.const.conf:
|
||||||
# do not remove precious files :)
|
|
||||||
pass
|
|
||||||
elif fileinfo.type == ctx.const.conf:
|
|
||||||
# config files are precious, leave them as they are
|
# config files are precious, leave them as they are
|
||||||
# unless they are the same as provided by package.
|
# unless they are the same as provided by package.
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user