diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 581: [Fu Wei] Add Fedora support

Message ID 20130417141213.25459.85193.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro April 17, 2013, 2:12 p.m. UTC
Merge authors:
  Fu Wei (fu-wei)
Related merge proposals:
  https://code.launchpad.net/~fu-wei/lava-dispatcher/modularize-distro-add-fedora-support/+merge/159399
  proposed by: Fu Wei (fu-wei)
------------------------------------------------------------
revno: 581 [merge]
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Wed 2013-04-17 11:10:40 -0300
message:
  [Fu Wei] Add Fedora support
added:
  lava_test_shell/distro/fedora/
  lava_test_shell/distro/fedora/lava-install-packages
  lava_test_shell/distro/fedora/lava-installed-packages
  lava_test_shell/distro/fedora/lava-os-build
modified:
  lava_dispatcher/actions/deploy.py
  lava_dispatcher/actions/lava_test_shell.py
  lava_dispatcher/device/master.py
  lava_dispatcher/device/target.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py	2012-11-20 13:34:19 +0000
+++ lava_dispatcher/actions/deploy.py	2013-04-17 08:23:50 +0000
@@ -97,7 +97,7 @@ 
     parameters_schema = {
         'type': 'object',
         'properties': {
-            'type': {'type': 'string', 'enum':['ubuntu', 'oe', 'android']},
+            'type': {'type': 'string', 'enum':['ubuntu', 'oe', 'android', 'fedora']},
             },
         'additionalProperties': False,
         }

=== modified file 'lava_dispatcher/actions/lava_test_shell.py'
--- lava_dispatcher/actions/lava_test_shell.py	2013-04-15 19:21:33 +0000
+++ lava_dispatcher/actions/lava_test_shell.py	2013-04-16 02:59:05 +0000
@@ -148,6 +148,11 @@ 
 Target.oe_deployment_data['lava_test_dir'] = '/lava'
 Target.oe_deployment_data['lava_test_results_part_attr'] = 'root_part'
 
+Target.fedora_deployment_data['distro'] = 'fedora'
+Target.fedora_deployment_data['lava_test_sh_cmd'] = '/bin/bash'
+Target.fedora_deployment_data['lava_test_dir'] = '/lava'
+Target.fedora_deployment_data['lava_test_results_part_attr'] = 'root_part'
+
 # 755 file permissions
 XMOD = stat.S_IRWXU | stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH
 

=== modified file 'lava_dispatcher/device/master.py'
--- lava_dispatcher/device/master.py	2013-04-07 13:37:43 +0000
+++ lava_dispatcher/device/master.py	2013-04-16 02:59:05 +0000
@@ -67,14 +67,17 @@ 
         Target.android_deployment_data['boot_cmds'] = 'boot_cmds_android'
         Target.ubuntu_deployment_data['boot_cmds'] = 'boot_cmds'
         Target.oe_deployment_data['boot_cmds'] = 'boot_cmds_oe'
+        Target.fedora_deployment_data['boot_cmds'] = 'boot_cmds'
 
         # used for tarballcache logic to get proper boot_cmds
         Target.ubuntu_deployment_data['data_type'] = 'ubuntu'
         Target.oe_deployment_data['data_type'] = 'oe'
+        Target.fedora_deployment_data['data_type'] = 'fedora'
         self.target_map = {
             'android': Target.android_deployment_data,
             'oe': Target.oe_deployment_data,
             'ubuntu': Target.ubuntu_deployment_data,
+            'fedora': Target.fedora_deployment_data,
             }
 
         self.master_ip = None

=== modified file 'lava_dispatcher/device/target.py'
--- lava_dispatcher/device/target.py	2013-03-26 15:05:41 +0000
+++ lava_dispatcher/device/target.py	2013-04-17 13:39:40 +0000
@@ -58,6 +58,11 @@ 
         'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
         'TESTER_PS1_INCLUDES_RC': True,
     }
+    fedora_deployment_data = {
+        'TESTER_PS1': "linaro-test [rc=$(echo \$?)]# ",
+        'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
+        'TESTER_PS1_INCLUDES_RC': True,
+    }
 
     def __init__(self, context, device_config):
         self.context = context
@@ -163,11 +168,29 @@ 
         with open('%s/etc/hostname' % rootdir, 'w') as f:
             f.write('%s\n' % self.config.hostname)
 
+    def _customize_fedora(self, rootdir):
+        self.deployment_data = Target.fedora_deployment_data
+        with open('%s/etc/profile' % rootdir, 'a') as f:
+            f.write('export PS1="%s"\n' % self.deployment_data['TESTER_PS1'])
+        with open('%s/etc/hostname' % rootdir, 'w') as f:
+            f.write('%s\n' % self.config.hostname)
+
     def _customize_linux(self, image):
         root_part = self.config.root_part
+        os_release_id = 'linux'
         with image_partition_mounted(image, root_part) as mnt:
-            if os.path.exists('%s/etc/debian_version' % mnt):
+            os_release_file = '%s/etc/os-release' % mnt
+            if os.path.exists(os_release_file):
+                for line in open(os_release_file):
+                    if line.startswith('ID='):
+                        os_release_id = line[(len('ID=')):]
+                        os_release_id = os_release_id.strip('\"\n')
+                        break
+            if os_release_id == 'debian' or os_release_id == 'ubuntu' or \
+                    os.path.exists('%s/etc/debian_version' % mnt):
                 self._customize_ubuntu(mnt)
+            elif os_release_id == 'fedora':
+                self._customize_fedora(mnt)
             else:
                 # assume an OE based image. This is actually pretty safe
                 # because we are doing pretty standard linux stuff, just

=== added directory 'lava_test_shell/distro/fedora'
=== added file 'lava_test_shell/distro/fedora/lava-install-packages'
--- lava_test_shell/distro/fedora/lava-install-packages	1970-01-01 00:00:00 +0000
+++ lava_test_shell/distro/fedora/lava-install-packages	2013-04-16 02:59:05 +0000
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+sudo yum -e 0 -y -q install "$@"

=== added file 'lava_test_shell/distro/fedora/lava-installed-packages'
--- lava_test_shell/distro/fedora/lava-installed-packages	1970-01-01 00:00:00 +0000
+++ lava_test_shell/distro/fedora/lava-installed-packages	2013-04-16 02:59:05 +0000
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+rpm -qa --qf "package: %{NAME} : %{VERSION}-%{RELEASE} \n"

=== added file 'lava_test_shell/distro/fedora/lava-os-build'
--- lava_test_shell/distro/fedora/lava-os-build	1970-01-01 00:00:00 +0000
+++ lava_test_shell/distro/fedora/lava-os-build	2013-04-16 02:59:05 +0000
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+cat /etc/os-release | grep PRETTY_NAME | cut -d\" -f2