* 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:
|
else:
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
installdb.remove(package_name)
|
installdb.remove(package_name)
|
||||||
inst_packagedb.remove_package(package_name)
|
packagedb.remove_package(package_name)
|
||||||
if comard:
|
if comard:
|
||||||
# FIXME: (return value)...
|
# FIXME: (return value)...
|
||||||
comard.remove(package_name)
|
comard.remove(package_name)
|
||||||
|
|||||||
@@ -138,5 +138,13 @@ def get_rev_deps(name):
|
|||||||
|
|
||||||
return None
|
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')
|
thirdparty_packagedb = PackageDB('thirdparty')
|
||||||
inst_packagedb = PackageDB('installed')
|
inst_packagedb = PackageDB('installed')
|
||||||
|
|||||||
+14
-2
@@ -132,11 +132,21 @@ def install_pkg_names(A):
|
|||||||
return True # everything went OK :)
|
return True # everything went OK :)
|
||||||
|
|
||||||
def remove(A):
|
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:
|
if len(A)==0:
|
||||||
|
ui.info('No packages to remove.\n')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# try to construct a pisi graph of packages to
|
# try to construct a pisi graph of packages to
|
||||||
# install / reinstall
|
# install / reinstall
|
||||||
|
|
||||||
@@ -169,6 +179,8 @@ def remove(A):
|
|||||||
for x in l:
|
for x in l:
|
||||||
if installdb.is_installed(x):
|
if installdb.is_installed(x):
|
||||||
operations.remove_single(x)
|
operations.remove_single(x)
|
||||||
|
else:
|
||||||
|
ui.info('Package %s does not exist. Cannot remove.\n' % x)
|
||||||
|
|
||||||
return True # everything went OK :)
|
return True # everything went OK :)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user