diff --git a/pisi/operations.py b/pisi/operations.py index dcf29f1e..34f24325 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -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) diff --git a/pisi/packagedb.py b/pisi/packagedb.py index b620d114..17795414 100644 --- a/pisi/packagedb.py +++ b/pisi/packagedb.py @@ -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') diff --git a/pisi/toplevel.py b/pisi/toplevel.py index ed681ae3..b6470912 100644 --- a/pisi/toplevel.py +++ b/pisi/toplevel.py @@ -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 :)