Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > SVN: r757 - branches/current/1.6.0/src

Project highlights: Stable Version: 1.6.1, Development Version: 1.7.6

current
Discussion topic

Back to topic list

SVN: r757 - branches/current/1.6.0/src

Reply

Author jjneely at EOS dot NCSU dot EDU
Full name jjneely at EOS dot NCSU dot EDU
Date 2005-07-19 19:40:56 PDT
Message Author: jjneely at EOS dot NCSU dot EDU
Date: 2005-07-19 22:40:51 -0400 (Tue, 19 Jul 2005)
New Revision: 757

Modified:
   branches/current/1.6​.0/src/archtab.py
Log:
Bug #36

A bit of a rework for the arch table. I simply ripped out the table because
Current doesn't need it. We simply need to be able to figure the Cannon arch
for a given arch. Yum has some pretty decent code for this so that's what
we will use.


Modified: branches/current/1.6​.0/src/archtab.py
====================​====================​====================​=======
--- branches/current/1.6​.0/src/archtab.py 2005-07-20 01:53:34 UTC (rev 756)
+++ branches/current/1.6​.0/src/archtab.py 2005-07-20 02:40:51 UTC (rev 757)
@@ -4,25 +4,37 @@
 However, there are no mechanisms available to us for use on a _server_
 that may have a different arch than a client. So, we reinvent the wheel.
 
-Copyright 2002 Hunter Matthews
+Copyright 2002, 2005 Hunter Matthews and Jack Neely
 
 This software may be freely redistributed under the terms of the GNU Public
 License (GPL) v2.
 
-The compat_arches_table and related functions are from the up2dateUtils.py
-file from RH's up2date client. That files copyright info follows:
+Parts of the code taken from archwork.py in Yum Copyright 2002 Duke University.
 
- Client code for Update Agent
- Copyright (c) 1999-2001 Red Hat, Inc. Distributed under GPL.
-
- Author: Preston Brown <pbrown at redhat dot com>
- Adrian Likins <alikins at redhat dot com>
-
-
 """
 
+import os
+import re
+
 from logger import *
 
+def getArch(arch=None):
+ if not arch:
+ arch = os.uname()[4]
+ newarch = None
+ if re.search('86', arch):
+ newarch = 'i386'
+ if re.search('sparc', arch) or re.search('sun', arch):
+ newarch = 'sparc'
+ if re.search('alpha', arch):
+ newarch = 'alpha'
+ if re.search('ppc', arch):
+ newarch = 'ppc'
+ if re.search('x86_64', arch):
+ newarch = 'x86_64'
+ if not newarch:
+ newarch = arch
+ return newarch
 
 def getCannonArch(arch):
     """ Translate an arch into its base platform name.
@@ -38,42 +50,5 @@
     # We assume that we can split off of '-'s and take the first element.
     arch = arch.split('-')[0]
     
- assert arch in _compat_arches_table.keys(), \
- "Arch table does not contain %s architecture." % arch
- return _compat_arches_table[arch][0]
+ return getArch(arch)
 
-
-# NOTE: The order of the stuff in compat is in newest->oldest order
-# assuming backwards compability
-# I think there is a bug in rpm, in that althon's should not use i686
-# kernels, however, thats what we are duplicating, so thats whats in
-# the table.
-_compat_arches_table = {
- # ARCH : # CANON, # COMPAT
- "noarch" : [ "noarch", "noarch" ],
-
- "i386" : [ "i386", "i386", "noarch" ],
- "i486" : [ "i386", "i486", "i386", "noarch" ],
- "i586" : [ "i386", "i586", "i486", "i386", "noarch" ],
- "i686" : [ "i386", "i686", "i586", "i486", "i386", "noarch" ],
- "athlon" : [ "i386", "athlon", "i686", "i586", "i486", "i386", "noarch" ],
-
- "alpha" : [ "alpha", "alpha", "noarch" ],
- "alphaev5" : [ "alpha", "alphaev5", "alpha", "noarch" ],
- "alphaev56" : [ "alpha", "alphaev56", "alphaev5", "alpha", "noarch" ],
- "alphaca56" : [ "alpha", "alphaca56", "alphaev56", "alphaev5", "alpha", "noarch" ],
- "alphaev6" : [ "alpha", "alphaev6", "alphaca56", "alphaev56", "alphaev5", "alpha", "noarch" ],
- "alphaev67" : [ "alpha", "alphaev67", "alphaev6", "alphaca56", "alphaev56", "alphaev5", "alpha", "noarch" ],
-
- "sparc" : [ "sparc", "sparc", "noarch" ],
- "sparcv9" : [ "sparc", "sparcv9", "sparc", "noarch" ],
- "sparc64" : [ "sparc", "sparc64", "sparcv9", "sparc", "noarch" ],
-
- "ia64" : [ "ia64", "ia64", "i686", "noarch" ],
-
- "x86_64" : [ "x86_64", "noarch" ],
-
- "src" : [ "SRPMS", "src" ],
- }
-
-

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

SVN: r757 - branches/current/1.6.0/src jjneely at EOS dot NCSU dot EDU jjneely at EOS dot NCSU dot EDU 2005-07-19 19:40:56 PDT
Messages per page: