From 26cdf0ed369973e22166b9aa1e5cdd30df99c4c2 Mon Sep 17 00:00:00 2001
From: Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Date: Mon, 24 Nov 2008 11:15:18 +0000
Subject: [PATCH] cleanup the arch stuff, only personality is needed

---
 system/TestMain.py                   |  6 ------
 system/TestPlc.py                    | 13 ++++++++++---
 system/config_1testbox.py            | 10 ++++++----
 system/template-qemu/qemu-start-node | 12 +++++-------
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/system/TestMain.py b/system/TestMain.py
index 75c79ff..7d082e2 100755
--- a/system/TestMain.py
+++ b/system/TestMain.py
@@ -166,12 +166,6 @@ steps refer to a method in TestPlc or to a step_* module
                 utils.header('* Using %s = %s'%(recname,getattr(self.options,recname)))
 
 
-        if self.options.personality == "linux32":
-            self.options.arch = "i386"
-        elif self.options.personality == "linux64":
-            self.options.arch = "x86_64"
-        else:
-            raise Exception, "Unsupported personality %r"%self.options.personality
         # steps
         if not self.options.steps:
             #default (all) steps
diff --git a/system/TestPlc.py b/system/TestPlc.py
index 88a4a41..9b5a32f 100644
--- a/system/TestPlc.py
+++ b/system/TestPlc.py
@@ -485,7 +485,7 @@ class TestPlc:
         if self.run_in_host(build_checkout) != 0:
             return False
         # the repo url is taken from arch-rpms-url 
-        # with the last step (i386.) removed
+        # with the last step (i386) removed
         repo_url = self.options.arch_rpms_url
         for level in [ 'arch' ]:
 	    repo_url = os.path.dirname(repo_url)
@@ -507,8 +507,15 @@ class TestPlc:
 
     ### install_rpm 
     def install_rpm(self):
-        return self.run_in_guest("yum -y install myplc-native")==0 \
-            and self.run_in_guest("yum -y install noderepo-%s-%s"%(self.options.pldistro,self.options.arch))==0
+        if self.options.personality == "linux32":
+            arch = "i386"
+        elif self.options.personality == "linux64":
+            arch = "x86_64"
+        else:
+            raise Exception, "Unsupported personality %r"%self.options.personality
+        return \
+            self.run_in_guest("yum -y install myplc-native")==0 and \
+            self.run_in_guest("yum -y install noderepo-%s-%s"%(self.options.pldistro,arch))==0
 
     ### 
     def configure(self):
diff --git a/system/config_1testbox.py b/system/config_1testbox.py
index e4b6c3d..a80a52a 100644
--- a/system/config_1testbox.py
+++ b/system/config_1testbox.py
@@ -6,16 +6,18 @@ from TestMapper import TestMapper
 
 def config (plcs, options):
 
-    if options.arch == "i386":
+    if options.personality == "linux32":
         plc_box   ='speedball.inria.fr'
         node_box1 = 'testbox64_1.onelab.eu'
         node_box2 = 'testbox64_2.onelab.eu'
-    elif options.arch == "x86_64":
+        label="32"
+    elif options.personality == "linux64":
         plc_box =   'speedball.inria.fr'
         node_box1 = 'testbox64_1.onelab.eu'
         node_box2 = 'testbox64_2.onelab.eu'
+        label="64"
     else:
-        print 'Unsupported arch %s'%options.arch
+        print 'Unsupported personality %s'%options.personality
         sys.exit(1)
 
     mapper = {'plc': [ ('*' , {'hostname':plc_box,
@@ -23,7 +25,7 @@ def config (plcs, options):
                                'PLC_API_HOST':plc_box,
                                'PLC_BOOT_HOST':plc_box,
                                'PLC_WWW_HOST':plc_box,
-                               'name':'%s-'+options.arch } ) 
+                               'name':'%s-'+label } ) 
                        ],
               'node': [ ('node1' , {'host_box': node_box1 } ),
                         ('node2' , {'host_box': node_box2 } ),
diff --git a/system/template-qemu/qemu-start-node b/system/template-qemu/qemu-start-node
index 8556f4f..f201d94 100755
--- a/system/template-qemu/qemu-start-node
+++ b/system/template-qemu/qemu-start-node
@@ -19,14 +19,12 @@ CONFIG=qemu.conf
 [ -f "$CONFIG" ] || { echo "Config file for qemu $CONFIG not found in $(pwd)" ; exit 1 ; }
 . $CONFIG
 
-# the launcher, depending on local/target archs
+# the launcher, depending on target arch
 # make sure to check qemu-kill-node for consistency
-archs="$(uname -i)+$TARGET_ARCH"
-case $archs in
-    i386+i386)		QEMU=qemu;;
-    i386+x86_64)	QEMU=qemu-system-x86_64;;
-    x86_64+i386)	QEMU=qemu;;
-    x86_64+x86_64)	QEMU=qemu-system-x86_64;;
+case $TARGET_ARCH in
+    i386)		QEMU=qemu;;
+    x86_64)		QEMU=qemu-system-x86_64;;
+    *)			echo "Cannot handle TARGET_ARCH=$TARGET_ARCH"; exit 1 ;;
 esac
 
 echo "Running $COMMAND in $(pwd)"
-- 
2.47.0