* filter packages that are not installed (fixes: #335)
* clean removed package from both tracking packagedbs (3rdparty, installed)
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ def remove_single(package_name):
|
||||
else:
|
||||
os.unlink(fpath)
|
||||
installdb.remove(package_name)
|
||||
inst_packagedb.remove_package(package_name)
|
||||
packagedb.remove_package(package_name)
|
||||
if comard:
|
||||
# FIXME: (return value)...
|
||||
comard.remove(package_name)
|
||||
|
||||
@@ -138,5 +138,13 @@ def get_rev_deps(name):
|
||||
|
||||
return None
|
||||
|
||||
def remove_package(name):
|
||||
# remove the guy from the tracking databases
|
||||
inst_packagedb.remove_package(name)
|
||||
if thirdparty_packagedb.has_package(name):
|
||||
thirdparty_packagedb.remove_package(name)
|
||||
|
||||
# tracking databases for non-repository information
|
||||
|
||||
thirdparty_packagedb = PackageDB('thirdparty')
|
||||
inst_packagedb = PackageDB('installed')
|
||||
|
||||
+14
-2
@@ -132,11 +132,21 @@ def install_pkg_names(A):
|
||||
return True # everything went OK :)
|
||||
|
||||
def remove(A):
|
||||
"""remove set A of packages from system"""
|
||||
"""remove set A of packages from system (A is a list of package names)"""
|
||||
|
||||
# filter packages that are not installed
|
||||
Ap = []
|
||||
for x in A:
|
||||
if installdb.is_installed(x):
|
||||
Ap.append(x)
|
||||
else:
|
||||
ui.info('Package %s does not exist. Cannot remove.\n' % x)
|
||||
A = Ap
|
||||
|
||||
if len(A)==0:
|
||||
ui.info('No packages to remove.\n')
|
||||
return True
|
||||
|
||||
|
||||
# try to construct a pisi graph of packages to
|
||||
# install / reinstall
|
||||
|
||||
@@ -169,6 +179,8 @@ def remove(A):
|
||||
for x in l:
|
||||
if installdb.is_installed(x):
|
||||
operations.remove_single(x)
|
||||
else:
|
||||
ui.info('Package %s does not exist. Cannot remove.\n' % x)
|
||||
|
||||
return True # everything went OK :)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user