From 8c12b2ea030b9fdfa42ea633c8ef2ca8c2ffb3bf Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Tue, 13 Jan 2009 20:11:30 -0600 Subject: [PATCH] Fix up a few runtime errors --- ChangeLog | 11 ++++++++ modules/catalyst/arch/alpha.py | 4 +-- modules/catalyst/arch/amd64.py | 4 +-- modules/catalyst/arch/arm.py | 4 +-- modules/catalyst/arch/hppa.py | 4 +-- modules/catalyst/arch/ia64.py | 4 +-- modules/catalyst/arch/mips.py | 4 +-- modules/catalyst/arch/powerpc.py | 4 +-- modules/catalyst/arch/s390.py | 4 +-- modules/catalyst/arch/sh.py | 4 +-- modules/catalyst/arch/sparc.py | 4 +-- modules/catalyst/arch/x86.py | 4 +-- modules/catalyst/lock.py | 1 + modules/catalyst/target/generic.py | 3 +++ modules/catalyst/target/generic_stage.py | 33 ++++++++++++------------ 15 files changed, 54 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 160a27f1..b16bd384 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,17 @@ # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 14 Jan 2009; Andrew Gaffney + modules/catalyst/arch/alpha.py, modules/catalyst/arch/amd64.py, + modules/catalyst/arch/arm.py, modules/catalyst/arch/hppa.py, + modules/catalyst/arch/ia64.py, modules/catalyst/arch/mips.py, + modules/catalyst/arch/powerpc.py, modules/catalyst/arch/s390.py, + modules/catalyst/arch/sh.py, modules/catalyst/arch/sparc.py, + modules/catalyst/arch/x86.py, modules/catalyst/lock.py, + modules/catalyst/target/generic.py, + modules/catalyst/target/generic_stage.py: + Fix up a few runtime errors + 13 Jan 2009; Andrew Gaffney +modules/catalyst/target/system.py, +targets/system/system-chroot.sh, +targets/system/system-controller.sh, diff --git a/modules/catalyst/arch/alpha.py b/modules/catalyst/arch/alpha.py index 75f11327..71e3e652 100644 --- a/modules/catalyst/arch/alpha.py +++ b/modules/catalyst/arch/alpha.py @@ -66,7 +66,7 @@ class arch_ev67(generic_alpha): self.settings["CHOST"]="alphaev67-unknown-linux-gnu" self.settings["HOSTUSE"]=["ev6"] -__subarch_map = { +_subarch_map = { "alpha": arch_alpha, "ev4": arch_ev4, "ev45": arch_ev45, @@ -77,4 +77,4 @@ __subarch_map = { "ev67": arch_ev67 } -__machine_map = ("alpha", ) +_machine_map = ("alpha", ) diff --git a/modules/catalyst/arch/amd64.py b/modules/catalyst/arch/amd64.py index 3743ef76..ce70ccb5 100644 --- a/modules/catalyst/arch/amd64.py +++ b/modules/catalyst/arch/amd64.py @@ -54,7 +54,7 @@ class arch_amdfam10(generic_amd64): self.settings["CHOST"]="x86_64-pc-linux-gnu" self.settings["HOSTUSE"]=["mmx","sse","sse2","3dnow"] -__subarch_map = { +_subarch_map = { "amd64" : arch_amd64, "k8" : arch_k8, "opteron" : arch_k8, @@ -70,5 +70,5 @@ __subarch_map = { # "barcelona" : arch_amdfam10 } -__machine_map = ("x86_64","amd64","nocona") +_machine_map = ("x86_64","amd64","nocona") diff --git a/modules/catalyst/arch/arm.py b/modules/catalyst/arch/arm.py index 7aa9fb2c..e7005aa2 100644 --- a/modules/catalyst/arch/arm.py +++ b/modules/catalyst/arch/arm.py @@ -43,13 +43,13 @@ class arch_armv5b(generic_arm): self.settings["CFLAGS"]+=" -mcpu=xscale" self.settings["CHOST"]="armv5b-unknown-linux-gnu" -__subarch_map = { +_subarch_map = { "arm" : arch_arm, "armv4l" : arch_armv4l, "armeb" : arch_armeb, "armv5b" : arch_armv5b } -__machine_map = ("arm", "armv4l", "armeb", "armv5b", "armv5tel") +_machine_map = ("arm", "armv4l", "armeb", "armv5b", "armv5tel") diff --git a/modules/catalyst/arch/hppa.py b/modules/catalyst/arch/hppa.py index 716d4d8d..3c75c388 100644 --- a/modules/catalyst/arch/hppa.py +++ b/modules/catalyst/arch/hppa.py @@ -30,11 +30,11 @@ class arch_hppa2_0(generic_hppa): self.settings["CFLAGS"]+=" -march=2.0" self.settings["CHOST"]="hppa2.0-unknown-linux-gnu" -__subarch_map = { +_subarch_map = { "hppa": arch_hppa, "hppa1.1": arch_hppa1_1, "hppa2.0": arch_hppa2_0 } -__machine_map = ("parisc","parisc64","hppa","hppa64") +_machine_map = ("parisc","parisc64","hppa","hppa64") diff --git a/modules/catalyst/arch/ia64.py b/modules/catalyst/arch/ia64.py index ec52e274..be7f636e 100644 --- a/modules/catalyst/arch/ia64.py +++ b/modules/catalyst/arch/ia64.py @@ -10,9 +10,9 @@ class arch_ia64(catalyst.arch.generic_arch): self.settings["CFLAGS"]="-O2 -pipe" self.settings["CHOST"]="ia64-unknown-linux-gnu" -__subarch_map = { +_subarch_map = { "ia64": arch_ia64 } -__machine_map = ("ia64", ) +_machine_map = ("ia64", ) diff --git a/modules/catalyst/arch/mips.py b/modules/catalyst/arch/mips.py index 54dd83fb..6d3b22df 100644 --- a/modules/catalyst/arch/mips.py +++ b/modules/catalyst/arch/mips.py @@ -162,7 +162,7 @@ class arch_ip30_n32(generic_mipsel): arch_mips4_n32.__init__(self,myspec) self.settings["HOSTUSE"]=["ip30","n32"] -__subarch_map = { +_subarch_map = { "cobalt" : arch_cobalt, "cobalt_n32" : arch_cobalt_n32, "ip27" : arch_ip27, @@ -189,5 +189,5 @@ __subarch_map = { "loongson" : arch_mipsel3, } -__machine_map = ("mips","mips64") +_machine_map = ("mips","mips64") diff --git a/modules/catalyst/arch/powerpc.py b/modules/catalyst/arch/powerpc.py index 410437c3..d75e23d5 100644 --- a/modules/catalyst/arch/powerpc.py +++ b/modules/catalyst/arch/powerpc.py @@ -105,7 +105,7 @@ class arch_power6(arch_ppc64): self.settings["CFLAGS"]="-O2 -pipe -mcpu=power6 -mtune=power6" self.settings["HOSTUSE"]=["altivec","ibm"] -__subarch_map = { +_subarch_map = { "970" : arch_970, "cell" : arch_cell, "g3" : arch_g3, @@ -121,5 +121,5 @@ __subarch_map = { "ppc64" : arch_ppc64 } -__machine_map = ("ppc","ppc64","powerpc","powerpc64") +_machine_map = ("ppc","ppc64","powerpc","powerpc64") diff --git a/modules/catalyst/arch/s390.py b/modules/catalyst/arch/s390.py index a21609ed..107a7e91 100644 --- a/modules/catalyst/arch/s390.py +++ b/modules/catalyst/arch/s390.py @@ -27,10 +27,10 @@ class arch_s390x(generic_s390x): self.settings["CFLAGS"]="-O2 -pipe" self.settings["CHOST"]="s390x-ibm-linux-gnu" -__subarch_map = { +_subarch_map = { "s390": arch_s390, "s390x": arch_s390x } -__machine_map = ("s390", "s390x") +_machine_map = ("s390", "s390x") diff --git a/modules/catalyst/arch/sh.py b/modules/catalyst/arch/sh.py index 4b77b36a..8f4ce71c 100644 --- a/modules/catalyst/arch/sh.py +++ b/modules/catalyst/arch/sh.py @@ -69,7 +69,7 @@ class arch_sh4eb(generic_sheb): self.settings["CFLAGS"]="-O2 -m4 -pipe" self.settings["CHOST"]="sh4eb-unknown-linux-gnu" -__subarch_map = { +_subarch_map = { "sh" :arch_sh, "sh2" :arch_sh2, "sh3" :arch_sh3, @@ -80,5 +80,5 @@ __subarch_map = { "sh4eb" :arch_sh4eb } -__machine_map = ("sh2","sh3","sh4","sh2eb","sh3eb","sh4eb") +_machine_map = ("sh2","sh3","sh4","sh2eb","sh3eb","sh4eb") diff --git a/modules/catalyst/arch/sparc.py b/modules/catalyst/arch/sparc.py index 129e9c1d..14ee1e0f 100644 --- a/modules/catalyst/arch/sparc.py +++ b/modules/catalyst/arch/sparc.py @@ -34,10 +34,10 @@ class arch_sparc64(generic_sparc64): self.settings["CFLAGS"]="-O2 -mcpu=ultrasparc -pipe" self.settings["CHOST"]="sparc-unknown-linux-gnu" -__subarch_map = { +_subarch_map = { "sparc" : arch_sparc, "sparc64" : arch_sparc64 } -__machine_map = ("sparc","sparc64") +_machine_map = ("sparc","sparc64") diff --git a/modules/catalyst/arch/x86.py b/modules/catalyst/arch/x86.py index 8fe038a9..f4e76a0b 100644 --- a/modules/catalyst/arch/x86.py +++ b/modules/catalyst/arch/x86.py @@ -123,7 +123,7 @@ class arch_athlon_xp(generic_x86): self.settings["CHOST"]="i686-pc-linux-gnu" self.settings["HOSTUSE"]=["mmx","3dnow","sse"] -__subarch_map = { +_subarch_map = { "x86" : arch_x86, "i386" : arch_i386, "i486" : arch_i486, @@ -149,5 +149,5 @@ __subarch_map = { "athlon-mp" : arch_athlon_xp } -__machine_map = ('i386', 'i486', 'i586', 'i686') +_machine_map = ('i386', 'i486', 'i586', 'i686') diff --git a/modules/catalyst/lock.py b/modules/catalyst/lock.py index ea423107..8e79ac87 100644 --- a/modules/catalyst/lock.py +++ b/modules/catalyst/lock.py @@ -5,6 +5,7 @@ import os import stat import sys import time +from os.path import normpath from catalyst.output import * def writemsg(mystr): diff --git a/modules/catalyst/target/generic.py b/modules/catalyst/target/generic.py index 944043cd..20b84224 100644 --- a/modules/catalyst/target/generic.py +++ b/modules/catalyst/target/generic.py @@ -17,6 +17,9 @@ class generic_target: self.settings = self.config.get_spec().get_values() self.settings.update(self.config.get_conf()) + self.required_values = [] + self.valid_values = [] + self.env={} self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" diff --git a/modules/catalyst/target/generic_stage.py b/modules/catalyst/target/generic_stage.py index 45fa1f90..0bee86b5 100644 --- a/modules/catalyst/target/generic_stage.py +++ b/modules/catalyst/target/generic_stage.py @@ -25,7 +25,7 @@ class generic_stage_target(generic_target): "cflags","cxxflags","ldflags","cbuild","hostuse","portage_overlay",\ "distcc_hosts","makeopts","pkgcache_path","kerncache_path"]) - self.set_valid_build_kernel_vars(addlargs) + self.set_valid_build_kernel_vars() """ The semantics of subarchmap and machinemap changed a bit in 2.0.3 to @@ -57,11 +57,11 @@ class generic_stage_target(generic_target): arches = catalyst.arch.get_arches() for x in arches: - self.subarchmap.update(arches[x].__subarch_map) - for machine in arches[x].__machine_map: - machinemap[machine] = arches[x] - for subarch in arches[x].__subarch_map: - machinemap[subarch] = arches[x] + self.subarchmap.update(arches[x]._subarch_map) + for machine in arches[x]._machine_map: + machinemap[machine] = x + for subarch in arches[x]._subarch_map: + machinemap[subarch] = x if "chost" in self.settings: hostmachine = self.settings["chost"].split("-")[0] @@ -434,12 +434,12 @@ class generic_stage_target(generic_target): """ ROOT= variable for emerges """ self.settings["root_path"]="/" - def set_valid_build_kernel_vars(self,addlargs): - if "boot/kernel" in addlargs: - if type(addlargs["boot/kernel"])==types.StringType: - loopy=[addlargs["boot/kernel"]] + def set_valid_build_kernel_vars(self): + if "boot/kernel" in self.settings: + if type(self.settings["boot/kernel"])==types.StringType: + loopy=[self.settings["boot/kernel"]] else: - loopy=addlargs["boot/kernel"] + loopy=self.settings["boot/kernel"] for x in loopy: self.valid_values.append("boot/kernel/"+x+"/aliases") @@ -454,11 +454,11 @@ class generic_stage_target(generic_target): self.valid_values.append("boot/kernel/"+x+"/softlevel") self.valid_values.append("boot/kernel/"+x+"/use") self.valid_values.append("boot/kernel/"+x+"/packages") - if "boot/kernel/"+x+"/packages" in addlargs: - if type(addlargs["boot/kernel/"+x+\ + if "boot/kernel/"+x+"/packages" in self.settings: + if type(self.settings["boot/kernel/"+x+\ "/packages"])==types.StringType: - addlargs["boot/kernel/"+x+"/packages"]=\ - [addlargs["boot/kernel/"+x+"/packages"]] + self.settings["boot/kernel/"+x+"/packages"]=\ + [self.settings["boot/kernel/"+x+"/packages"]] def kill_chroot_pids(self): msg("Checking for processes running in chroot and killing them.") @@ -1122,7 +1122,8 @@ class generic_stage_target(generic_target): msg("--- Running action sequence: " + x) sys.stdout.flush() try: - apply(getattr(self,x)) + func = getattr(self, x) + func() except: self.mount_safety_check() raise -- 2.26.2