fedora-cvs-commits@redhat.com
[Top] [All Lists]

rpms/yum/devel yum-2.4-tsconsts.patch,NONE,1.1

Subject: rpms/yum/devel yum-2.4-tsconsts.patch,NONE,1.1
From:
Date: Tue, 4 Oct 2005 15:07:45 -0400
Author: pnasrat

Update of /cvs/dist/rpms/yum/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2332

Added Files:
        yum-2.4-tsconsts.patch 
Log Message:
backport ts constsants work

yum-2.4-tsconsts.patch:
 callback.py             |   19 +++++++++++-----
 cli.py                  |    3 +-
 repomd/packageObject.py |    3 +-
 yum/constants.py        |    8 +++++++
 yum/depsolve.py         |    3 +-
 yum/transactioninfo.py  |   54 +++++++++++++++++++-----------------------------
 6 files changed, 49 insertions(+), 41 deletions(-)

--- NEW FILE yum-2.4-tsconsts.patch ---
--- yum-2.4.0/repomd/packageObject.py.tsconst   2005-10-04 15:03:54.000000000 
-0400
+++ yum-2.4.0/repomd/packageObject.py   2005-10-04 15:04:06.000000000 -0400
@@ -421,7 +421,8 @@
                     e = reader.GetAttribute('epoch')
                     v = reader.GetAttribute('ver')
                     r = reader.GetAttribute('rel')
-                    objlist.append((name, flag, (e, v, r)))
+                    pre = reader.GetAttribte('pre')
+                    objlist.append((name, flag, (e, v, r), pre))
 
             ret = reader.Read()
             continue
--- yum-2.4.0/callback.py.tsconst       2005-10-04 15:03:54.000000000 -0400
+++ yum-2.4.0/callback.py       2005-10-04 15:04:06.000000000 -0400
@@ -18,6 +18,7 @@
 import rpm
 import os
 import sys
+from yum.constants import *
 
 from i18n import _
 
@@ -33,12 +34,18 @@
         self.marks = 27
         self.filelog = None
 
-        self.myprocess = { 'updating': 'Updating', 'erasing': 'Erasing',
-                           'installing': 'Installing', 'obsoleted': 
'Obsoleted',
-                           'obsoleting': 'Installing'}
-        self.mypostprocess = { 'updating': 'Updated', 'erasing': 'Erased',
-                               'installing': 'Installed', 'obsoleted': 
'Obsoleted',
-                               'obsoleting': 'Installed'}
+        self.myprocess = { TS_UPDATE : 'Updating', 
+                           TS_ERASE: 'Erasing',
+                           TS_INSTALL: 'Installing', 
+                           TS_TRUEINSTALL : 'Installing',
+                           TS_OBSOLETED: 'Obsoleted',
+                           TS_OBSOLETING: 'Installing'}
+        self.mypostprocess = { TS_UPDATE: 'Updated', 
+                               TS_ERASE: 'Erased',
+                               TS_INSTALL: 'Installed', 
+                               TS_TRUEINSTALL: 'Installed', 
+                               TS_OBSOLETED: 'Obsoleted',
+                               TS_OBSOLETING: 'Installed'}
 
         self.tsInfo = None # this needs to be set for anything else to work
 
--- yum-2.4.0/yum/transactioninfo.py.tsconst    2005-10-04 15:03:54.000000000 
-0400
+++ yum-2.4.0/yum/transactioninfo.py    2005-10-04 15:04:06.000000000 -0400
@@ -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
-    
--- yum-2.4.0/yum/constants.py.tsconst  2005-10-04 15:03:54.000000000 -0400
+++ yum-2.4.0/yum/constants.py  2005-10-04 15:04:06.000000000 -0400
@@ -21,7 +21,15 @@
 TS_ERASE = 40
 TS_OBSOLETED = 50
 TS_OBSOLETING = 60
+TS_AVAILABLE = 70
 
+# Transaction Relationships
+TR_UPDATES = 1
+TR_UPDATEDBY = 2
+TR_OBSOLETES = 3
+TR_OBSOLETEDBY = 4
+TR_DEPENDS = 5
+TR_DEPENDSON = 6
 
 # package object file types
 PO_FILE = 1
--- yum-2.4.0/yum/depsolve.py.tsconst   2005-10-04 15:03:54.000000000 -0400
+++ yum-2.4.0/yum/depsolve.py   2005-10-04 15:04:06.000000000 -0400
@@ -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)
--- yum-2.4.0/cli.py.tsconst    2005-10-04 15:03:54.000000000 -0400
+++ yum-2.4.0/cli.py    2005-10-04 15:04:06.000000000 -0400
@@ -29,6 +29,7 @@
 import output
 import shell
 import yum
+from yum.constants import *
 import yum.Errors
 import yum.misc
 import rpmUtils.arch
@@ -965,7 +966,7 @@
             for (new, old) in updates:
                 txmbrs = self.tsInfo.getMembers(pkgtup=old)
 
-                if txmbrs and txmbrs[0].output_state == 'obsoleted':
+                if txmbrs and txmbrs[0].output_state == TS_OBSOLETED: 
                     self.log(5, 'Not Updating Package that is already 
obsoleted: %s.%s %s:%s-%s' % old)
                 else:
                     updating_pkg = self.getPackageObject(new)

-- 
fedora-cvs-commits mailing list
fedora-cvs-commits@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-cvs-commits

<Prev in Thread] Current Thread [Next in Thread>
  • rpms/yum/devel yum-2.4-tsconsts.patch,NONE,1.1, fedora-cvs-commits <=