* fix: read package info in remove component

* implement componentwise package ops, just take a look at this beauty:

nebula:pisi$ ./pisi-cli -B -Dtmp it system.base
The following minimal list of packages will be installed
in the respective order to satisfy dependencies:
file
Installing file, version 4.12, release 1, build 2
Extracting files
Storing files.xml,
Storing metadata.xml.
Regenerating /etc/ld.so.cache...
Updating environment...
running /sbin/ldconfig -X -r /home/exa/code/projects/pisi/tmp
Installed file
nebula:pisi$ ./pisi-cli -B -Dtmp rm system.base
The following minimal list of packages will be removed
in the respective order to satisfy dependencies:
file
Removing package file
Not removing non-file, non-link
/home/exa/code/projects/pisi/tmp/usr/share/man/man5
Removed file
This commit is contained in:
Eray Özkural
2005-11-14 16:19:14 +00:00
parent 05708da9db
commit 64c69ecaa1
3 changed files with 15 additions and 5 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ Legend:
+ query list of packages in a component + query list of packages in a component
+ index: update component database(s) + index: update component database(s)
+ bug fixing + bug fixing
- install/remove components + install/remove/upgrade components
- safety switch: preserve system.base, install system.devel for build, etc. - safety switch: preserve system.base, install system.devel for build, etc.
+ multiple package repository (eray) + multiple package repository (eray)
+ decide how to implement + decide how to implement
+13 -4
View File
@@ -174,13 +174,22 @@ def check_conflicts(order):
#raise Error(_("Package %s conflicts installed package %s") % (x, pkg)) #raise Error(_("Package %s conflicts installed package %s") % (x, pkg))
raise Error(_("Conflicts remain")) raise Error(_("Conflicts remain"))
def expand_components(A):
Ap = set()
for x in A:
if ctx.componentdb.has_component(x):
Ap = Ap.union(ctx.componentdb.get_component(x).packages)
else:
Ap.append(x)
return Ap
def install_pkg_names(A): def install_pkg_names(A):
"""This is the real thing. It installs packages from """This is the real thing. It installs packages from
the repository, trying to perform a minimum number of the repository, trying to perform a minimum number of
installs""" installs"""
A_0 = A = set(A) # A was a list, remove duplicates # A was a list, remove duplicates and expand components
A_0 = A = expand_components(set(A))
ctx.ui.debug('A = %s' % str(A)) ctx.ui.debug('A = %s' % str(A))
if len(A)==0: if len(A)==0:
@@ -245,7 +254,7 @@ def upgrade_pkg_names(A = []):
A = ctx.installdb.list_installed() A = ctx.installdb.list_installed()
# filter packages that are not upgradable # filter packages that are not upgradable
A_0 = A = set(A) A_0 = A = expand_components(set(A))
Ap = [] Ap = []
for x in A: for x in A:
if x.endswith('.pisi'): if x.endswith('.pisi'):
@@ -369,7 +378,7 @@ def remove(A):
"""remove set A of packages from system (A is a list of package names)""" """remove set A of packages from system (A is a list of package names)"""
# filter packages that are not installed # filter packages that are not installed
A_0 = A = set(A) A_0 = A = expand_components(set(A))
Ap = [] Ap = []
for x in A: for x in A:
if ctx.installdb.is_installed(x): if ctx.installdb.is_installed(x):
+1
View File
@@ -86,6 +86,7 @@ class PackageDB(object):
def remove_package(self, name): def remove_package(self, name):
name = str(name) name = str(name)
package_info = self.d[name]
del self.d[name] del self.d[name]
#FIXME: what's happening to dr? #FIXME: what's happening to dr?
ctx.componentdb.remove_package(package_info.partOf, package_info.name) ctx.componentdb.remove_package(package_info.partOf, package_info.name)