[yum-cvs] yum/yum config.py, 1.75, 1.76 constants.py, 1.4, 1.5 depsolve.py, 1.68, 1.69 transactioninfo.py, 1.19, 1.20

Paul Nasrat pnasrat at login.linux.duke.edu
Tue Oct 4 18:43:46 UTC 2005


Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv30884/yum

Modified Files:
	config.py constants.py depsolve.py transactioninfo.py 
Log Message:
Move to use constants for transaction states

Index: config.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/config.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- config.py	15 Sep 2005 15:52:54 -0000	1.75
+++ config.py	4 Oct 2005 18:43:44 -0000	1.76
@@ -240,10 +240,11 @@
                             }
 
         
-class yumconf(object):
+class yumconf(YumBaseConfig):
     """primary config class for yum"""
     
     def __init__(self, configfile = '/etc/yum.conf', root='/'):
+        YumBaseConfig.__init__(self)
         self.cfg = CFParser()
         configh = confpp(configfile)
         try:

Index: constants.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/constants.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- constants.py	27 Mar 2005 22:01:23 -0000	1.4
+++ constants.py	4 Oct 2005 18:43:44 -0000	1.5
@@ -21,7 +21,15 @@
 TS_ERASE = 40
 TS_OBSOLETED = 50
 TS_OBSOLETING = 60
+TS_AVAILABLE = 70
 
+# Transaction Relationships
+TR_UPDATES = (1, "updates")
+TR_UPDATEDBY = (2, "updatedby")
+TR_OBSOLETES = (3, "obsoletes")
+TR_OBSOLETEDBY = (4, "obsoletedby")
+TR_DEPENDS = (5, "dependencyof")
+TR_DEPENDSON = (6, "dependson")
 
 # package object file types
 PO_FILE = 1

Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- depsolve.py	21 Sep 2005 17:33:52 -0000	1.68
+++ depsolve.py	4 Oct 2005 18:43:44 -0000	1.69
@@ -28,6 +28,7 @@
 from repomd.packageSack import ListPackageSack
 from repomd.mdErrors import PackageSackError
 from Errors import DepError, RepoError
+from constants import *
 import packages
 
 class Depsolve:
@@ -176,7 +177,7 @@
                     if self.allowedMultipleInstalls(txmbr.po):
                         self.log(5, '%s converted to install' % (txmbr.po))
                         txmbr.ts_state = 'i'
-                        txmbr.output_state = 'installing'
+                        txmbr.output_state = TS_INSTALL
 
                 
                 self.ts.addInstall(hdr, (hdr, rpmfile), txmbr.ts_state)

Index: transactioninfo.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/transactioninfo.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- transactioninfo.py	22 Sep 2005 15:08:07 -0000	1.19
+++ transactioninfo.py	4 Oct 2005 18:43:44 -0000	1.20
@@ -20,6 +20,8 @@
 # remove the given txmbr and iterate to remove all those in depedent relationships
 # with the given txmbr. 
 
+from constants import *
+
 class TransactionData:
     """Data Structure designed to hold information on a yum Transaction Set"""
     def __init__(self):
@@ -151,28 +153,28 @@
         self.depupdated = []
         
         for txmbr in self.getMembers():
-            if txmbr.output_state == 'updating':
+            if txmbr.output_state == TS_UPDATE:
                 if txmbr.isDep:
                     self.depupdated.append(txmbr)
                 else:
                     self.updated.append(txmbr)
                     
-            elif txmbr.output_state == 'installing':
+            elif txmbr.output_state == TS_INSTALL or txmbr.output_state == TS_TRUEINSTALL:
                 if txmbr.isDep:
                     self.depinstalled.append(txmbr)
                 else:
                     self.installed.append(txmbr)
             
-            elif txmbr.output_state == 'erasing':
+            elif txmbr.output_state == TS_ERASE:
                 if txmbr.isDep:
                     self.depremoved.append(txmbr)
                 else:
                     self.removed.append(txmbr)
                     
-            elif txmbr.output_state == 'obsoleted':
+            elif txmbr.output_state == TS_OBSOLETED:
                 self.obsoleted.append(txmbr)
                 
-            elif txmbr.output_state == 'obsoleting':
+            elif txmbr.output_state == TS_OBSOLETING:
                 self.installed.append(txmbr)
                 
             else:
@@ -192,8 +194,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'repo'
-        txmbr.output_state = 'installing'
+        txmbr.current_state = TS_AVAILABLE
+        txmbr.output_state = TS_INSTALL
         txmbr.ts_state = 'u'
         txmbr.reason = 'user'
         self.add(txmbr)
@@ -204,8 +206,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'repo'
-        txmbr.output_state = 'installing'
+        txmbr.current_state = TS_AVAILABLE
+        txmbr.output_state = TS_TRUEINSTALL
         txmbr.ts_state = 'i'
         txmbr.reason = 'user'
         self.add(txmbr)
@@ -217,8 +219,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'installed'
-        txmbr.output_state = 'erasing'
+        txmbr.current_state = TS_INSTALL
+        txmbr.output_state = TS_ERASE
         txmbr.ts_state = 'e'
         self.add(txmbr)
         return txmbr
@@ -228,8 +230,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'repo'
-        txmbr.output_state = 'updating'
+        txmbr.current_state = TS_AVAILABLE
+        txmbr.output_state = TS_UPDATE
         txmbr.ts_state = 'u'
         if oldpo:
             txmbr.relatedto.append((oldpo.pkgtup, 'updates'))
@@ -241,8 +243,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'repo'
-        txmbr.output_state = 'obsoleting'
+        txmbr.current_state = TS_AVAILABLE
+        txmbr.output_state = TS_OBSOLETING
         txmbr.ts_state = 'u'
         txmbr.relatedto.append((oldpo, 'obsoletes'))
         self.add(txmbr)
@@ -253,8 +255,8 @@
            takes a packages object and returns a TransactionMember Object"""
     
         txmbr = TransactionMember(po)
-        txmbr.current_state = 'installed'
-        txmbr.output_state = 'obsoleted'
+        txmbr.current_state = TS_INSTALL
+        txmbr.output_state =  TS_OBSOLETED
         txmbr.ts_state = None
         txmbr.relatedto.append((obsoleting_po, 'obsoletedby'))
         self.add(txmbr)
@@ -310,20 +312,8 @@
     # and any related packages. A world of fun that will be, you betcha
     
     
-    # things to define:
-    # types of relationships
-    # types of reasons
-    # ts, current and output states
-    
-    # output states are:
-    # update, install, remove, obsoleted
-    
+    # definitions
+    # current and output states are defined in constants
+    # relationships are defined in constants
     # ts states are: u, i, e
     
-    # current_states are:
-    # installed, repo
-    
-    #relationships:
-    # obsoletedby, updates, obsoletes, updatedby, 
-    # dependencyof, dependson
-    




More information about the Yum-cvs-commits mailing list