* filter packages that are not installed (fixes: #335)

* clean removed package from both tracking packagedbs (3rdparty, installed)
This commit is contained in:
Eray Özkural
2005-08-09 10:38:45 +00:00
parent 1e47af7f06
commit 12b2f94538
3 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -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)
+8
View File
@@ -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
View File
@@ -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 :)