[Uludag-commits] r14616 - branches/pisi-1.1/pisi

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
2 Tem 2007 Pzt 10:58:33 EEST


Author: faik
Date: Mon Jul  2 10:58:32 2007
New Revision: 14616

Modified:
   branches/pisi-1.1/pisi/api.py
   branches/pisi-1.1/pisi/operations.py
   branches/pisi-1.1/pisi/packagedb.py
Log:
- pisi up for replace



Modified: branches/pisi-1.1/pisi/api.py
=================================================================
--- branches/pisi-1.1/pisi/api.py	(original)
+++ branches/pisi-1.1/pisi/api.py	Mon Jul  2 10:58:32 2007
@@ -163,7 +163,7 @@
     return set(ctx.packagedb.list_packages(repo = repo))
 
 def list_upgradable():
-    return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed())
+    return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed()) + ctx.packagedb.get_replaces().keys()
 
 def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False):
     """Construct a package relations graph.

Modified: branches/pisi-1.1/pisi/operations.py
=================================================================
--- branches/pisi-1.1/pisi/operations.py	(original)
+++ branches/pisi-1.1/pisi/operations.py	Mon Jul  2 10:58:32 2007
@@ -376,12 +376,13 @@
     ignore_build = ctx.get_option('ignore_build_no')
     security_only = ctx.get_option('security_only')
 
+    replaced = []
+    replaces = ctx.packagedb.get_replaces()
+
     if not A:
         # if A is empty, then upgrade all packages
         A = ctx.installdb.list_installed()
 
-    replaced = []
-
     A_0 = A = set(A)
 
     Ap = []
@@ -389,6 +390,11 @@
         if x.endswith(ctx.const.package_suffix):
             ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))
 
+        if x in replaces.keys():
+            Ap.append(replaces[x])
+            replaced.append(x)
+            continue
+
         if not ctx.installdb.is_installed(x):
             ctx.ui.info(_('Package %s is not installed.') % x, True)
             continue
@@ -417,7 +423,7 @@
                 ctx.ui.info(_('Package %s is already at the latest build %s.')
                             % (pkg.name, pkg.build), True)
 
-
+                
     A = set(Ap)
 
     if len(A)==0:
@@ -451,7 +457,7 @@
     if ctx.get_option('dry_run'):
         return
 
-    if set(order) - A_0:
+    if set(order) - A_0 - set(replaces.values()):
         if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
             return False
 

Modified: branches/pisi-1.1/pisi/packagedb.py
=================================================================
--- branches/pisi-1.1/pisi/packagedb.py	(original)
+++ branches/pisi-1.1/pisi/packagedb.py	Mon Jul  2 10:58:32 2007
@@ -67,6 +67,7 @@
     def which_repo(self, name, txn = None):
         return self.d.which_repo(name, txn=txn)
 
+    # replacesdb holds the info about the replaced packages (ex. gaim -> pidgin)
     def get_replaces(self, repo = None):
         pairs = {}
         for pkg_name in self.drp.list(repo):


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi