Added a patch from Andrew Gaffney <agaffney@gentoo.org> to fix up the problems with...
authorChris Gianelloni <wolf31o2@gentoo.org>
Tue, 13 Feb 2007 15:02:53 +0000 (15:02 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Tue, 13 Feb 2007 15:02:53 +0000 (15:02 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1217 d1e1f19c-881f-0410-ab34-b69fee027534

16 files changed:
ChangeLog
arch/alpha.py
arch/amd64.py
arch/arm.py
arch/hppa.py
arch/ia64.py
arch/mips.py
arch/ppc.py
arch/ppc64.py
arch/s390.py
arch/sh.py
arch/sparc.py
arch/sparc64.py
arch/x86.py
catalyst
modules/generic_stage_target.py

index 6366fae74096e56d0c9aae1c4c788911247aa7c9..9a3ad615a1620f4200fddc7707bbff51ff639b9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Id: $
 
+  13 Feb 2007; Chris Gianelloni <wolf31o2@gentoo.org> arch/alpha.py,
+  arch/amd64.py, arch/arm.py, arch/hppa.py, arch/ia64.py, arch/mips.py,
+  arch/ppc.py, arch/ppc64.py, arch/s390.py, arch/sh.py, arch/sparc.py,
+  arch/sparc64.py, arch/x86.py, catalyst, modules/generic_stage_target.py:
+  Added a patch from Andrew Gaffney <agaffney@gentoo.org> to fix up the
+  problems with using all of the various subarch settings.
+
   13 Feb 2007; Chris Gianelloni <wolf31o2@gentoo.org>
   targets/support/bootloader-setup.sh, targets/support/create-iso.sh:
   Disabled deleting of /boot so we actually can work with EFI/grub, made EFI
index 49a265d24c56460207fac8d545a474ef0d6f082a..3fd9b3db1124d3639dedcc7671c79b94934a54d0 100644 (file)
@@ -67,8 +67,9 @@ class arch_ev67(generic_alpha):
                self.settings["CHOST"]="alphaev67-unknown-linux-gnu"
                self.settings["HOSTUSE"]=["ev6"]
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({ "alpha":arch_alpha, "ev4":arch_ev4, "ev45":arch_ev45,
+       return ({ "alpha":arch_alpha, "ev4":arch_ev4, "ev45":arch_ev45,
                "ev5":arch_ev5, "ev56":arch_ev56, "pca56":arch_pca56,
-               "ev6":arch_ev6, "ev67":arch_ev67 })
+               "ev6":arch_ev6, "ev67":arch_ev67 }, 
+       ("alpha", ))
index b652df13a36b4782b2e1711f37105d779aad9bf9..9801370d79d75bf8260397ff197ea36ff9335414 100644 (file)
@@ -14,7 +14,7 @@ class arch_amd64(generic_amd64):
                self.settings["CFLAGS"]="-O2 -pipe"
                self.settings["CHOST"]="x86_64-pc-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"amd64":arch_amd64})
+       return ({"amd64":arch_amd64}, ("x86_64", ))
 
index 961256814ebe54e4cdc33b9f4f5b5058de92cef4..75a7f469452144a170ab63361570161cffcc927d 100644 (file)
@@ -44,12 +44,12 @@ class arch_armv5b(generic_arm):
                self.settings["CFLAGS"]+=" -mcpu=xscale"
                self.settings["CHOST"]="armv5b-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({
+       return ({
                "arm"    : arch_arm,
                "armv4l" : arch_armv4l,
                "armeb"  : arch_armeb,
                "armv5b" : arch_armv5b
+       }, ("arm", "armv4l", "armeb", "armv5b") )
 
-       })
index 32b694bd4035e63ca61b531bc0449d920752a80e..a222524a07097415d3024e4d00ea5cfa003f3f66 100644 (file)
@@ -31,10 +31,11 @@ class arch_hppa2_0(generic_hppa):
                self.settings["CFLAGS"]+=" -march=2.0"
                self.settings["CHOST"]="hppa2.0-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({
+       return ({
                        "hppa":         arch_hppa,
                        "hppa1.1":      arch_hppa1_1,
                        "hppa2.0":      arch_hppa2_0
-       })
+       }, ("parisc","parisc64","hppa","hppa64") )
+
index 64433209a1d9dc8ac2dd30b6d7da1a3e0dee3ccd..825af7040f0ccee9f0e9cda6008b1f2e065a5c65 100644 (file)
@@ -11,6 +11,6 @@ class arch_ia64(builder.generic):
                self.settings["CFLAGS"]="-O2 -pipe"
                self.settings["CHOST"]="ia64-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({ "ia64":arch_ia64 })
+       return ({ "ia64":arch_ia64 }, ("ia64", ))
index f52d4db06d6257d379e2c5b5edeb6ad7df831020..ba48a9f4e35641187b631028d1bfeb4a7b010650 100644 (file)
@@ -73,9 +73,9 @@ class arch_mipsel4(generic_mipsel):
 
 
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({ 
+       return ({ 
                        "mips"          :arch_mips1,
                        "mips1"         :arch_mips1,
                        "mips2"         :arch_mips2,
@@ -91,4 +91,4 @@ def register(foo):
                        "sgir5k"        :arch_mips4,
                        "sgir10kplus"   :arch_mips4,
                        "cobalt"        :arch_mipsel4
-        })
+       }, ("mips","mips64"))
index 3968dd107882dca6e08616014c92058d78cb83c7..e9d843fee97573aae714afdc7c49a87319e675b4 100644 (file)
@@ -55,7 +55,8 @@ class arch_g5(generic_ppc):
                self.settings["CFLAGS"]="-O2 -mcpu=G5 -mtune=G5 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
                self.settings["HOSTUSE"]=["altivec"]
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"ppc":arch_ppc,"power":arch_power,"power-ppc":arch_power_ppc,"g3":arch_g3,"g4":arch_g4,"g5":arch_g5})
+       return ({"ppc":arch_ppc,"power":arch_power,"power-ppc":arch_power_ppc,"g3":arch_g3,"g4":arch_g4,"g5":arch_g5}, 
+       ("ppc","powerpc"))
 
index 709ebaa38d9db3bfec0cc07e5853f6568c88c0f6..4ef76e60d447f50f6b7a8d0e76639ee977920fdf 100644 (file)
@@ -44,7 +44,9 @@ class arch_power5(arch_ppc64):
                self.settings["CFLAGS"]="-O2 -pipe -mcpu=power5 -mtune=power5"
                self.settings["CXXFLAGS"]="-O2 -pipe -mcpu=power5 -mtune=power5"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"ppc64":arch_ppc64,"970":arch_970,"power3":arch_power3,"power4":arch_power4,"power5":arch_power5})
+       return ({"ppc64":arch_ppc64,"970":arch_970,"power3":arch_power3,"power4":arch_power4,"power5":arch_power5},
+       ("ppc64","powerpc64"))
+
 
index 1c218048c7c270fe9eccf4606ffdffc0551bd81b..21198157aff033837ba5ddd862d4e08223f7197d 100644 (file)
@@ -15,6 +15,6 @@ class arch_s390(generic_s390):
                self.settings["CFLAGS"]="-O2 -pipe"
                self.settings["CHOST"]="s390-ibm-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"s390":arch_s390})
+       return ({"s390":arch_s390}, ("s390", ))
index dc5fbc1818bbbaa7c4ae9518c87aa3f13a02fcec..8fb970567bdabf99f7e69cc4e55a507eaab6eb47 100644 (file)
@@ -70,9 +70,9 @@ class arch_sh4eb(generic_sheb):
                self.settings["CFLAGS"]="-O2 -m4 -pipe"
                self.settings["CHOST"]="sh4eb-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({
+       return ({
                        "sh"    :arch_sh,
                        "sh2"   :arch_sh2,
                        "sh3"   :arch_sh3,
@@ -81,4 +81,4 @@ def register(foo):
                        "sh2eb" :arch_sh2eb,
                        "sh3eb" :arch_sh3eb,
                        "sh4eb" :arch_sh4eb
-       })
+       }, ("sh2","sh3","sh4","sh2eb","sh3eb","sh4eb"))
index d3f311f90c65e461561e1a198f8e19b024b69a46..6804a407cef339898a28b9490b900e319464f6ae 100644 (file)
@@ -22,6 +22,6 @@ class arch_sparc(generic_sparc):
                self.settings["CXXFLAGS"]="-O2 -pipe"
                self.settings["CHOST"]="sparc-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"sparc":arch_sparc})
+       return ({"sparc":arch_sparc}, ("sparc", ))
index d72da92a932e400bd51ccb42f31189869bf5bb0a..df8b8e91173ec98ee3c185378407dabe337e406c 100644 (file)
@@ -16,6 +16,6 @@ class arch_sparc64(generic_sparc64):
                self.settings["CXXFLAGS"]="-O2 -mcpu=ultrasparc -pipe"
                self.settings["CHOST"]="sparc-unknown-linux-gnu"
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"sparc64":arch_sparc64})
+       return ({"sparc64":arch_sparc64}, ("sparc64", ))
index 4b675e22c28f5252fee3a5f3caf35d3d78beb473..dded47811f16f910263a5906fa4a391bdb6868c2 100644 (file)
@@ -80,8 +80,9 @@ class arch_pentium3(generic_x86):
                self.settings["CHOST"]="i686-pc-linux-gnu"
                self.settings["HOSTUSE"]=["mmx","sse"]
 
-def register(foo):
+def register():
        "Inform main catalyst program of the contents of this plugin."
-       foo.update({"pentium4":arch_pentium4,"x86":arch_x86,"i386":arch_i386,"i486":arch_i486,"i586":arch_i586,"i686":arch_i686,"athlon":arch_athlon,
-       "athlon-xp":arch_athlon_xp,"athlon-mp":arch_athlon_xp,"pentium3":arch_pentium3,"pentium-mmx":arch_pentium_mmx})
+       return ({"pentium4":arch_pentium4,"x86":arch_x86,"i386":arch_i386,"i486":arch_i486,"i586":arch_i586,"i686":arch_i686,"athlon":arch_athlon,
+       "athlon-xp":arch_athlon_xp,"athlon-mp":arch_athlon_xp,"pentium3":arch_pentium3,"pentium-mmx":arch_pentium_mmx},
+       ('i386', 'i486', 'i586', 'i686'))
 
index 6a14c691edd208b06e0d5e0676935032118da3c3..b5de64a72c9491103e67900e5f7b40a1350fb0cf 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -8,7 +8,7 @@ import os,sys,imp,string,getopt
 import pdb
 
 __maintainer__="Chris Gianelloni <wolf31o2@gentoo.org>"
-__version__="2.0.2"
+__version__="2.0.3_pre2"
 
 conf_values={}
 
index 64cf6965c650789b642ef2bdb399917f15ecba00..1ea286cbd27477d1cbf7606fce4639b0fa692c3e 100644 (file)
@@ -22,38 +22,50 @@ class generic_stage_target(generic_target):
                
                self.set_valid_build_kernel_vars(addlargs)
                generic_target.__init__(self,myspec,addlargs)
-               machinemap={
-                               "i386" : "x86",
-                               "i486" : "x86",
-                               "i586" : "x86",
-                               "i686" : "x86",
-                               "x86_64" : "amd64",
-                               "sparc" : "sparc",
-                               "sparc64" : "sparc64",
-                               "ia64" : "ia64",
-                               "alpha" : "alpha",
-                               "sh2" : "sh",
-                               "sh3" : "sh",
-                               "sh4" : "sh",
-                               "sh2eb" : "sh",
-                               "sh3eb" : "sh",
-                               "sh4eb" : "sh",
-                               "s390" : "s390",
-                               "ppc" : "ppc",
-                               "ppc64" : "ppc64",
-                               "powerpc" : "ppc",
-                               "powerpc64" : "ppc64",
-                               "parisc" : "hppa",
-                               "parisc64" : "hppa",
-                               "hppa" : "hppa",
-                               "hppa64" : "hppa",
-                               "mips" : "mips",
-                               "mips64" : "mips",
-                               "arm" : "arm",
-                               "armv4l" : "arm",
-                               "armeb" : "arm",
-                               "armv5b" : "arm"
-               }
+
+               # The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
+               # work better with vapier's CBUILD stuff. I've removed the "monolithic"
+               # machinemap from this file and split up its contents amongst the various
+               # arch/foo.py files.
+               #
+               # When register() is called on each module in the arch/ dir, it now returns
+               # a tuple instead of acting on the subarchmap dict that is passed to it.
+               # The tuple contains the values that were previously added to subarchmap
+               # as well as a new list of CHOSTs that go along with that arch. This allows
+               # us to build machinemap on the fly based on the keys in subarchmap and
+               # the values of the 2nd list returned (tmpmachinemap).
+               #
+               # Also, after talking with vapier. I have a slightly better idea of what
+               # certain variables are used for and what they should be set to. Neither
+               # 'buildarch' or 'hostarch' are used directly, so their value doesn't
+               # really matter. They are just compared to determine if we are
+               # cross-compiling. Because of this, they are just set to the name of the
+               # module in arch/ that the subarch is part of to make things simpler. The
+               # entire build process is still based off of 'subarch' like it was
+               # previously. -agaffney
+
+               self.archmap = {}
+               self.subarchmap = {}
+               machinemap = {}
+               for x in [x[:-3] for x in os.listdir(self.settings["sharedir"]+"/arch/") if x.endswith(".py")]:
+                       try:
+                               fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
+                               # This next line loads the plugin as a module and assigns it to
+                               # archmap[x]
+                               self.archmap[x]=imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
+                               # This next line registers all the subarches supported in the
+                               # plugin
+                               tmpsubarchmap, tmpmachinemap = self.archmap[x].register()
+                               self.subarchmap.update(tmpsubarchmap)
+                               for machine in tmpmachinemap:
+                                       machinemap[machine] = x
+                               for subarch in tmpsubarchmap:
+                                       machinemap[subarch] = x
+                               fh.close()      
+                       except IOError:
+                               # This message should probably change a bit, since everything in the dir should
+                               # load just fine. If it doesn't, it's probably a syntax error in the module
+                               msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
 
                if self.settings.has_key("chost"):
                        hostmachine = self.settings["chost"].split("-")[0]
@@ -73,19 +85,7 @@ class generic_stage_target(generic_target):
                        raise CatalystError, "Unknown build machine type "+buildmachine
                self.settings["buildarch"] = machinemap[buildmachine]
                self.settings["crosscompile"] = (self.settings["hostarch"] != self.settings["buildarch"])
-               self.archmap = {}
-               self.subarchmap = {}
                
-               x = self.settings["hostarch"]
-               try:
-                       fh = open(self.settings["sharedir"]+"/arch/"+x+".py")
-                       # this next line loads the plugin as a module and assigns it to archmap[x]
-                       self.archmap[x] = imp.load_module(x,fh,"arch/"+x+".py",(".py","r",imp.PY_SOURCE))
-                       # this next line registers all the subarches supported in the plugin
-                       self.archmap[x].register(self.subarchmap)
-                       fh.close()
-               except IOError:
-                       msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
                # Call arch constructor, pass our settings
                try:
                        self.arch=self.subarchmap[self.settings["subarch"]](self.settings)