From ec92efcadb05f9c76e8b1ebcc9523fed9b998f21 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Tue, 13 Feb 2007 15:02:53 +0000 Subject: [PATCH] Added a patch from Andrew Gaffney to fix up the problems with using all of the various subarch settings. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1217 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 7 +++ arch/alpha.py | 7 +-- arch/amd64.py | 4 +- arch/arm.py | 6 +-- arch/hppa.py | 7 +-- arch/ia64.py | 4 +- arch/mips.py | 6 +-- arch/ppc.py | 5 +- arch/ppc64.py | 6 ++- arch/s390.py | 4 +- arch/sh.py | 6 +-- arch/sparc.py | 4 +- arch/sparc64.py | 4 +- arch/x86.py | 7 +-- catalyst | 2 +- modules/generic_stage_target.py | 88 ++++++++++++++++----------------- 16 files changed, 90 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6366fae7..9a3ad615 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 # $Id: $ + 13 Feb 2007; Chris Gianelloni 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 to fix up the + problems with using all of the various subarch settings. + 13 Feb 2007; Chris Gianelloni targets/support/bootloader-setup.sh, targets/support/create-iso.sh: Disabled deleting of /boot so we actually can work with EFI/grub, made EFI diff --git a/arch/alpha.py b/arch/alpha.py index 49a265d2..3fd9b3db 100644 --- a/arch/alpha.py +++ b/arch/alpha.py @@ -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", )) diff --git a/arch/amd64.py b/arch/amd64.py index b652df13..9801370d 100644 --- a/arch/amd64.py +++ b/arch/amd64.py @@ -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", )) diff --git a/arch/arm.py b/arch/arm.py index 96125681..75a7f469 100644 --- a/arch/arm.py +++ b/arch/arm.py @@ -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") ) - }) diff --git a/arch/hppa.py b/arch/hppa.py index 32b694bd..a222524a 100644 --- a/arch/hppa.py +++ b/arch/hppa.py @@ -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") ) + diff --git a/arch/ia64.py b/arch/ia64.py index 64433209..825af704 100644 --- a/arch/ia64.py +++ b/arch/ia64.py @@ -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", )) diff --git a/arch/mips.py b/arch/mips.py index f52d4db0..ba48a9f4 100644 --- a/arch/mips.py +++ b/arch/mips.py @@ -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")) diff --git a/arch/ppc.py b/arch/ppc.py index 3968dd10..e9d843fe 100644 --- a/arch/ppc.py +++ b/arch/ppc.py @@ -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")) diff --git a/arch/ppc64.py b/arch/ppc64.py index 709ebaa3..4ef76e60 100644 --- a/arch/ppc64.py +++ b/arch/ppc64.py @@ -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")) + diff --git a/arch/s390.py b/arch/s390.py index 1c218048..21198157 100644 --- a/arch/s390.py +++ b/arch/s390.py @@ -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", )) diff --git a/arch/sh.py b/arch/sh.py index dc5fbc18..8fb97056 100644 --- a/arch/sh.py +++ b/arch/sh.py @@ -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")) diff --git a/arch/sparc.py b/arch/sparc.py index d3f311f9..6804a407 100644 --- a/arch/sparc.py +++ b/arch/sparc.py @@ -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", )) diff --git a/arch/sparc64.py b/arch/sparc64.py index d72da92a..df8b8e91 100644 --- a/arch/sparc64.py +++ b/arch/sparc64.py @@ -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", )) diff --git a/arch/x86.py b/arch/x86.py index 4b675e22..dded4781 100644 --- a/arch/x86.py +++ b/arch/x86.py @@ -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')) diff --git a/catalyst b/catalyst index 6a14c691..b5de64a7 100755 --- a/catalyst +++ b/catalyst @@ -8,7 +8,7 @@ import os,sys,imp,string,getopt import pdb __maintainer__="Chris Gianelloni " -__version__="2.0.2" +__version__="2.0.3_pre2" conf_values={} diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 64cf6965..1ea286cb 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -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) -- 2.26.2