Merge lp:~cr3/ubuntu/lucid/checkbox/0.9.2 into lp:ubuntu/lucid/checkbox

Proposed by Marc Tardif
Status: Needs review
Proposed branch: lp:~cr3/ubuntu/lucid/checkbox/0.9.2
Merge into: lp:ubuntu/lucid/checkbox
Diff against target: 822 lines (+253/-247)
20 files modified
backend (+12/-3)
checkbox/job.py (+1/-1)
checkbox/resource.py (+3/-2)
checkbox/user_interface.py (+7/-2)
debian/changelog (+17/-0)
debian/control (+1/-0)
jobs/disk.txt.in (+1/-2)
jobs/local.txt.in (+1/-1)
jobs/resource.txt.in (+1/-0)
plugins/backend_info.py (+15/-17)
plugins/begin_prompt.py (+33/-0)
plugins/launchpad_exchange.py (+2/-1)
plugins/persist_info.py (+2/-2)
po/checkbox.pot (+10/-10)
scripts/ansi_parser (+2/-1)
scripts/device_list (+0/-168)
scripts/disk_test (+0/-33)
scripts/run_templates (+142/-0)
scripts/suspend_test (+2/-3)
scripts/udev_resource (+1/-1)
To merge this branch: bzr merge lp:~cr3/ubuntu/lucid/checkbox/0.9.2
Reviewer Review Type Date Requested Status
Mathias Gug Needs Fixing
Review via email: mp+28341@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mathias Gug (mathiaz) wrote :

In order to get this branch uploaded to lucid a proper SRU is required:

 1. debian/changelog: the target should be lucid-proposed instead of lucid.

 2. Every bug attached to the SRU proposal should be turned into a proper SRU report as outlined in https://wiki.ubuntu.com/StableReleaseUpdates#Procedure.

review: Needs Fixing
Revision history for this message
Mathias Gug (mathiaz) wrote :

The bug list may be trimmed to fix only high-impact bugs and get the SRU published earlier.

Revision history for this message
hawthornso23 (hawthorn) wrote :

What is happening with this. Bug 553328 is serious and potentially shortens the life of hardware. It leaves a CPU perpetually running at 100% until the next reboot (even logout/login wont stop it). Users of an LTS in particular often go months between reboots. I've just discovered that I have apparently been running a CPU at 100% for several weeks. No wonder it was running hot!

There seems to have been no activity here for six months. Is there a way of injecting more urgency into this process?

Unmerged revisions

16. By Marc Tardif

New upstream release (LP: #567568):
* Added referer when sending submissions to Launchpad (LP: #550973)
* Added suggests to checkbox package in debian/control file (LP: #352740)
* Fixed udev_resource script to be more resilient (LP: #556824)
* Fixed cdimage_resource script to read casper.log (LP: #558728)
* Fixed reporting all resources found for a job (LP: #560948)
* Fixed stalling when using kdesudo to start backend (LP: #557443)
* Fixed starting the appropriate default browser on UNR (LP: #563050)
* Fixed ansi_parser script when outputting to stdout (LP: #560952)
* Fixed opening the report with the gconf preferred browser (LP: #562580)
* Fixed suspend_test to use relative time for wakealarm (LP: #349768)
* Fixed backend not getting terminated upon closing (LP: #553328)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'backend'
--- backend 2010-03-07 15:05:44 +0000
+++ backend 2010-06-23 19:15:40 +0000
@@ -1,32 +1,41 @@
1#!/usr/bin/python1#!/usr/bin/python
22
3import os
3import sys4import sys
45
5from optparse import OptionParser6from optparse import OptionParser
6from checkbox.lib.fifo import FifoReader, FifoWriter7from checkbox.lib.fifo import FifoReader, FifoWriter
78
8from checkbox.job import Job9from checkbox.job import Job, FAIL
910
1011
11def main(args):12def main(args):
12 usage = "Usage: %prog INPUT OUTPUT"13 usage = "Usage: %prog INPUT OUTPUT"
13 parser = OptionParser(usage=usage)14 parser = OptionParser(usage=usage)
15 parser.add_option("-p", "--path",
16 help="PATH variable to replace in the environment")
14 (options, args) = parser.parse_args(args)17 (options, args) = parser.parse_args(args)
1518
16 if len(args) < 2:19 if len(args) < 2:
17 parser.error("Missing INPUT and OUTPUT")20 parser.error("Missing INPUT and OUTPUT")
1821
22 if options.path:
23 os.environ["PATH"] = options.path
24
19 reader = FifoReader(args[0])25 reader = FifoReader(args[0])
20 writer = FifoWriter(args[1])26 writer = FifoWriter(args[1])
2127
22 while True:28 while True:
23 try:29 try:
24 message = reader.read_object()30 message = reader.read_object()
25 if message:31 if isinstance(message, dict) and "command" in message:
26 job = Job(message["command"], message.get("environ"),32 job = Job(message["command"], message.get("environ"),
27 message.get("timeout"))33 message.get("timeout"))
28 result = job.execute()34 result = job.execute()
29 writer.write_object(result)35 else:
36 result = (FAIL, "", 0,)
37
38 writer.write_object(result)
30 except IOError, e:39 except IOError, e:
31 break40 break
3241
3342
=== modified file 'checkbox/job.py'
--- checkbox/job.py 2010-03-09 16:58:36 +0000
+++ checkbox/job.py 2010-06-23 19:15:40 +0000
@@ -89,7 +89,7 @@
8989
90 duration = process.endtime - process.starttime90 duration = process.endtime - process.starttime
9191
92 return (status, data, duration)92 return (status, data, duration,)
9393
9494
95class JobStore(MessageStore):95class JobStore(MessageStore):
9696
=== modified file 'checkbox/resource.py'
--- checkbox/resource.py 2010-03-07 15:05:44 +0000
+++ checkbox/resource.py 2010-06-23 19:15:40 +0000
@@ -52,15 +52,16 @@
52 return self._try(other, lambda a, b: a != b)52 return self._try(other, lambda a, b: a != b)
5353
54 def _try(self, other, function, until=True, default=False):54 def _try(self, other, function, until=True, default=False):
55 found = False
55 for item in self._list:56 for item in self._list:
56 if self._name in item:57 if self._name in item:
57 value = self._convert(item[self._name])58 value = self._convert(item[self._name])
58 if function(value, other) == until:59 if function(value, other) == until:
59 # Append item to list of results60 # Append item to list of results
60 self._list._map._results.append(item)61 self._list._map._results.append(item)
61 return until62 found = True
6263
63 return default64 return until if found else default
6465
6566
66class ResourceList(list):67class ResourceList(list):
6768
=== modified file 'checkbox/user_interface.py'
--- checkbox/user_interface.py 2010-03-07 15:05:44 +0000
+++ checkbox/user_interface.py 2010-06-23 19:15:40 +0000
@@ -175,21 +175,26 @@
175 # with respectively -new-window and --new-window175 # with respectively -new-window and --new-window
176 try:176 try:
177 if os.getenv("DISPLAY") and \177 if os.getenv("DISPLAY") and \
178 subprocess.call(["pgrep", "-x", "-u", str(uid), "gnome-panel"],178 subprocess.call(["pgrep", "-x", "-u", str(uid), "gnome-panel|gconfd-2"],
179 stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:179 stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:
180 gct = subprocess.Popen(sudo_prefix + ["gconftool", "--get",180 gct = subprocess.Popen(sudo_prefix + ["gconftool", "--get",
181 "/desktop/gnome/url-handlers/http/command"],181 "/desktop/gnome/url-handlers/http/command"],
182 stdout=subprocess.PIPE, stderr=subprocess.PIPE)182 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
183 if gct.returncode == 0:183 if gct.wait() == 0:
184 preferred_browser = gct.communicate()[0]184 preferred_browser = gct.communicate()[0]
185 browser = re.match("((firefox|seamonkey|flock)[^\s]*)", preferred_browser)185 browser = re.match("((firefox|seamonkey|flock)[^\s]*)", preferred_browser)
186 if browser:186 if browser:
187 subprocess.call(sudo_prefix + [browser.group(0), "-new-window", url])187 subprocess.call(sudo_prefix + [browser.group(0), "-new-window", url])
188 sys.exit(0)188 sys.exit(0)
189
189 browser = re.match("(epiphany[^\s]*)", preferred_browser)190 browser = re.match("(epiphany[^\s]*)", preferred_browser)
190 if browser:191 if browser:
191 subprocess.call(sudo_prefix + [browser.group(0), "--new-window", url])192 subprocess.call(sudo_prefix + [browser.group(0), "--new-window", url])
192 sys.exit(0)193 sys.exit(0)
194
195 subprocess.call(sudo_prefix + [preferred_browser % url], shell=True)
196 sys.exit(0)
197
193 if subprocess.call(sudo_prefix + ["gnome-open", url]) == 0:198 if subprocess.call(sudo_prefix + ["gnome-open", url]) == 0:
194 sys.exit(0)199 sys.exit(0)
195 except OSError:200 except OSError:
196201
=== modified file 'debian/changelog'
--- debian/changelog 2010-03-07 15:05:44 +0000
+++ debian/changelog 2010-06-23 19:15:40 +0000
@@ -1,3 +1,20 @@
1checkbox (0.9.2) lucid; urgency=low
2
3 New upstream release (LP: #567568):
4 * Added referer when sending submissions to Launchpad (LP: #550973)
5 * Added suggests to checkbox package in debian/control file (LP: #352740)
6 * Fixed udev_resource script to be more resilient (LP: #556824)
7 * Fixed cdimage_resource script to read casper.log (LP: #558728)
8 * Fixed reporting all resources found for a job (LP: #560948)
9 * Fixed stalling when using kdesudo to start backend (LP: #557443)
10 * Fixed starting the appropriate default browser on UNR (LP: #563050)
11 * Fixed ansi_parser script when outputting to stdout (LP: #560952)
12 * Fixed opening the report with the gconf preferred browser (LP: #562580)
13 * Fixed suspend_test to use relative time for wakealarm (LP: #349768)
14 * Fixed backend not getting terminated upon closing (LP: #553328)
15
16 -- Marc Tardif <marc@ubuntu.com> Tue, 06 Apr 2010 14:17:46 -0400
17
1checkbox (0.9.1) lucid; urgency=low18checkbox (0.9.1) lucid; urgency=low
219
3 New upstream release (LP: #548800):20 New upstream release (LP: #548800):
421
=== modified file 'debian/control'
--- debian/control 2010-03-09 16:58:36 +0000
+++ debian/control 2010-06-23 19:15:40 +0000
@@ -15,6 +15,7 @@
15Provides: hwtest15Provides: hwtest
16Depends: ${misc:Depends}, ${python:Depends}, debconf, udev16Depends: ${misc:Depends}, ${python:Depends}, debconf, udev
17Recommends: dpkg, lsb-release, python-apport, python-apt, python-gst0.1017Recommends: dpkg, lsb-release, python-apport, python-apt, python-gst0.10
18Suggests: checkbox-cli | checkbox-gtk
18Conflicts: hwtest (<< 0.1-0ubuntu12)19Conflicts: hwtest (<< 0.1-0ubuntu12)
19XB-Python-Version: ${python:Versions}20XB-Python-Version: ${python:Versions}
20Description: Checkbox System Testing21Description: Checkbox System Testing
2122
=== modified file 'jobs/disk.txt.in'
--- jobs/disk.txt.in 2010-03-07 15:05:44 +0000
+++ jobs/disk.txt.in 2010-06-23 19:15:40 +0000
@@ -1,7 +1,6 @@
1plugin: manual1plugin: manual
2name: disk_test2name: disk_test
3user: root3command: udev_resource | filter_templates -w "category=DISK" | awk -F': ' '$1 == "product" { print $2 }'
4command: disk_test
5_description:4_description:
6 The following hard drives were detected:5 The following hard drives were detected:
7 .6 .
87
=== modified file 'jobs/local.txt.in'
--- jobs/local.txt.in 2010-03-07 15:05:44 +0000
+++ jobs/local.txt.in 2010-06-23 19:15:40 +0000
@@ -59,7 +59,7 @@
5959
60name: dmesg60name: dmesg
61plugin: attachment61plugin: attachment
62command: cat /var/log/dmesg62command: cat /var/log/dmesg | ansi_parser
6363
64name: dmi64name: dmi
65plugin: attachment65plugin: attachment
6666
=== modified file 'jobs/resource.txt.in'
--- jobs/resource.txt.in 2010-03-09 16:58:36 +0000
+++ jobs/resource.txt.in 2010-06-23 19:15:40 +0000
@@ -4,6 +4,7 @@
44
5name: cdimage5name: cdimage
6plugin: resource6plugin: resource
7user: root
7command: cdimage_resource8command: cdimage_resource
89
9name: dpkg10name: dpkg
1011
=== modified file 'plugins/backend_info.py'
--- plugins/backend_info.py 2010-03-07 15:05:44 +0000
+++ plugins/backend_info.py 2010-06-23 19:15:40 +0000
@@ -18,7 +18,6 @@
18#18#
19import os19import os
20import shutil20import shutil
21import signal
2221
23from subprocess import call, PIPE22from subprocess import call, PIPE
24from tempfile import mkdtemp23from tempfile import mkdtemp
@@ -44,7 +43,12 @@
44 # Backend should run as early as possible43 # Backend should run as early as possible
45 self._manager.reactor.call_on("gather", self.gather, -100)44 self._manager.reactor.call_on("gather", self.gather, -100)
4645
47 def get_root_command(self, command):46 def get_command(self, *args):
47 command = [self.command, "--path=%s" % os.environ["PATH"]]
48
49 return command + list(args)
50
51 def get_root_command(self, *args):
48 uid = os.getuid()52 uid = os.getuid()
49 if uid == 0:53 if uid == 0:
50 prefix = []54 prefix = []
@@ -59,17 +63,11 @@
59 stdout=PIPE, stderr=PIPE) == 0 and \63 stdout=PIPE, stderr=PIPE) == 0 and \
60 call(["pgrep", "-x", "-u", str(uid), "gnome-panel|gconfd-2"],64 call(["pgrep", "-x", "-u", str(uid), "gnome-panel|gconfd-2"],
61 stdout=PIPE, stderr=PIPE) == 0:65 stdout=PIPE, stderr=PIPE) == 0:
62 prefix = ["gksu", "-k", "--"]66 prefix = ["gksu", "--"]
63 else:67 else:
64 prefix = ["sudo", "-E"]68 prefix = ["sudo"]
6569
66 # Append PATH70 return prefix + self.get_command(*args)
67 prefix.append("PATH=%s" % os.environ["PATH"])
68
69 # Extend command
70 prefix.extend(command)
71
72 return prefix
7371
74 def gather(self):72 def gather(self):
75 self.directory = mkdtemp(prefix="checkbox")73 self.directory = mkdtemp(prefix="checkbox")
@@ -82,8 +80,7 @@
82 self.parent_reader = FifoReader(child_output)80 self.parent_reader = FifoReader(child_output)
8381
84 else:82 else:
85 command = [self.command, child_input, child_output]83 root_command = self.get_root_command(child_input, child_output)
86 root_command = self.get_root_command(command)
87 os.execvp(root_command[0], root_command)84 os.execvp(root_command[0], root_command)
88 # Should never get here85 # Should never get here
8986
@@ -95,10 +92,11 @@
95 self._manager.reactor.fire("message-result", *result)92 self._manager.reactor.fire("message-result", *result)
9693
97 def stop(self):94 def stop(self):
98 os.kill(self.pid, signal.SIGHUP)95 self.parent_writer.close()
96 self.parent_reader.close()
97 shutil.rmtree(self.directory)
98
99 os.waitpid(self.pid, 0)99 os.waitpid(self.pid, 0)
100100
101 shutil.rmtree(self.directory)
102
103101
104factory = BackendInfo102factory = BackendInfo
105103
=== added file 'plugins/begin_prompt.py'
--- plugins/begin_prompt.py 1970-01-01 00:00:00 +0000
+++ plugins/begin_prompt.py 2010-06-23 19:15:40 +0000
@@ -0,0 +1,33 @@
1#
2# This file is part of Checkbox.
3#
4# Copyright 2010 Canonical Ltd.
5#
6# Checkbox is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# Checkbox is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
18#
19from checkbox.plugin import Plugin
20
21
22class BeginPrompt(Plugin):
23
24 def register(self, manager):
25 super(BeginPrompt, self).register(manager)
26
27 self._manager.reactor.call_on("prompt-begin", self.prompt_begin)
28
29 def prompt_begin(self, interface):
30 self._manager.reactor.fire("begin")
31
32
33factory = BeginPrompt
034
=== modified file 'plugins/launchpad_exchange.py'
--- plugins/launchpad_exchange.py 2010-03-07 15:05:44 +0000
+++ plugins/launchpad_exchange.py 2010-06-23 19:15:40 +0000
@@ -60,7 +60,8 @@
60 def register(self, manager):60 def register(self, manager):
61 super(LaunchpadExchange, self).register(manager)61 super(LaunchpadExchange, self).register(manager)
6262
63 self._headers = {}63 self._headers = {
64 "Referer": self.transport_url}
64 self._form = {65 self._form = {
65 "field.private": "False",66 "field.private": "False",
66 "field.contactable": "False",67 "field.contactable": "False",
6768
=== modified file 'plugins/persist_info.py'
--- plugins/persist_info.py 2010-03-09 16:58:36 +0000
+++ plugins/persist_info.py 2010-06-23 19:15:40 +0000
@@ -33,14 +33,14 @@
33 self.persist = None33 self.persist = None
3434
35 for (rt, rh) in [35 for (rt, rh) in [
36 ("prompt-begin", self.prompt_begin),36 ("begin", self.begin),
37 ("prompt-job", self.save)]:37 ("prompt-job", self.save)]:
38 self._manager.reactor.call_on(rt, rh, -100)38 self._manager.reactor.call_on(rt, rh, -100)
3939
40 # Save persist data last40 # Save persist data last
41 self._manager.reactor.call_on("stop", self.save, 1000)41 self._manager.reactor.call_on("stop", self.save, 1000)
4242
43 def prompt_begin(self, interface):43 def begin(self):
44 self.persist = Persist(self.filename)44 self.persist = Persist(self.filename)
45 self._manager.reactor.fire("begin-persist", self.persist)45 self._manager.reactor.fire("begin-persist", self.persist)
4646
4747
=== modified file 'po/checkbox.pot'
--- po/checkbox.pot 2010-03-07 15:05:44 +0000
+++ po/checkbox.pot 2010-06-23 19:15:40 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2010-04-01 17:14-0400\n"11"POT-Creation-Date: 2010-04-14 18:05-0400\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -68,13 +68,13 @@
68msgstr ""68msgstr ""
6969
70#. description70#. description
71#: ../jobs/audio.txt.in:7 ../jobs/disk.txt.in:17 ../jobs/network.txt.in:1671#: ../jobs/audio.txt.in:7 ../jobs/disk.txt.in:16 ../jobs/network.txt.in:16
72#: ../jobs/video.txt.in:2672#: ../jobs/video.txt.in:26
73msgid "$output"73msgid "$output"
74msgstr ""74msgstr ""
7575
76#. description76#. description
77#: ../jobs/audio.txt.in:7 ../jobs/disk.txt.in:5 ../jobs/network.txt.in:1677#: ../jobs/audio.txt.in:7 ../jobs/disk.txt.in:4 ../jobs/network.txt.in:16
78#: ../jobs/video.txt.in:2678#: ../jobs/video.txt.in:26
79msgid "Is this correct?"79msgid "Is this correct?"
80msgstr ""80msgstr ""
@@ -128,17 +128,17 @@
128msgstr ""128msgstr ""
129129
130#. description130#. description
131#: ../jobs/disk.txt.in:5131#: ../jobs/disk.txt.in:4
132msgid "The following hard drives were detected:"132msgid "The following hard drives were detected:"
133msgstr ""133msgstr ""
134134
135#. description135#. description
136#: ../jobs/disk.txt.in:17136#: ../jobs/disk.txt.in:16
137msgid "Disk benchmark:"137msgid "Disk benchmark:"
138msgstr ""138msgstr ""
139139
140#. description140#. description
141#: ../jobs/disk.txt.in:17141#: ../jobs/disk.txt.in:16
142msgid "Is this ok?"142msgid "Is this ok?"
143msgstr ""143msgstr ""
144144
@@ -693,12 +693,12 @@
693"your system."693"your system."
694msgstr ""694msgstr ""
695695
696#: ../plugins/launchpad_exchange.py:116696#: ../plugins/launchpad_exchange.py:117
697#, python-format697#, python-format
698msgid "Failed to process form: %s"698msgid "Failed to process form: %s"
699msgstr ""699msgstr ""
700700
701#: ../plugins/launchpad_exchange.py:139701#: ../plugins/launchpad_exchange.py:140
702#, python-format702#, python-format
703msgid ""703msgid ""
704"Failed to contact server. Please try\n"704"Failed to contact server. Please try\n"
@@ -709,13 +709,13 @@
709"https://launchpad.net/+hwdb/+submit"709"https://launchpad.net/+hwdb/+submit"
710msgstr ""710msgstr ""
711711
712#: ../plugins/launchpad_exchange.py:148712#: ../plugins/launchpad_exchange.py:149
713msgid ""713msgid ""
714"Failed to upload to server,\n"714"Failed to upload to server,\n"
715"please try again later."715"please try again later."
716msgstr ""716msgstr ""
717717
718#: ../plugins/launchpad_exchange.py:160718#: ../plugins/launchpad_exchange.py:161
719msgid "Information not posted to Launchpad."719msgid "Information not posted to Launchpad."
720msgstr ""720msgstr ""
721721
722722
=== modified file 'scripts/ansi_parser'
--- scripts/ansi_parser 2010-03-07 15:05:44 +0000
+++ scripts/ansi_parser 2010-06-23 19:15:40 +0000
@@ -150,7 +150,8 @@
150 for arg in args:150 for arg in args:
151 output.write(parse_filename(arg))151 output.write(parse_filename(arg))
152152
153 output.close()153 if options.output and options.output != "-":
154 output.close()
154155
155 return 0156 return 0
156157
157158
=== removed file 'scripts/device_list'
--- scripts/device_list 2010-03-07 15:05:44 +0000
+++ scripts/device_list 1970-01-01 00:00:00 +0000
@@ -1,168 +0,0 @@
1#! /bin/sh -e
2TYPE="$1"
3
4case $TYPE in
5 maybe-floppy)
6 logger -t list-devices "deprecated parameter maybe-floppy"
7 TYPE=floppy
8 ;;
9 cd|disk|partition|floppy|maybe-usb-floppy|usb-partition) ;;
10 *)
11 echo "Usage: $0 cd|disk|partition|floppy|maybe-usb-floppy|usb-partition" >&2
12 exit 2
13 ;;
14esac
15
16if [ ! -d /sys/block ]; then
17 exit 0
18fi
19if type udevadm >/dev/null 2>&1; then
20 device_info () {
21 udevadm info -q "$1" -p "$2" 2>/dev/null
22 }
23elif type udevinfo >/dev/null 2>&1; then
24 device_info () {
25 udevinfo -q "$1" -p "$2" 2>/dev/null
26 }
27else
28 exit 0
29fi
30
31device_name () {
32 local name
33 if ! name="$(device_info name "$1")"; then
34 name="$(printf %s "${1##*/}" | \
35 sed 's,!,/,g')"
36 fi
37 echo "/dev/$name"
38}
39
40is_sataraid () {
41 grep -qs ^DMRAID- "$1/dm/uuid"
42}
43
44is_sataraid_partition () {
45 # dmraid partitions are always slaved to another dm device
46 for slave in "$1"/slaves/dm-*; do
47 if [ -e "$slave" ]; then
48 return 0
49 fi
50 done
51 return 1
52}
53
54if type dmraid >/dev/null 2>&1; then
55 raiddevs="$(dmraid -r -c || true)"
56else
57 raiddevs=
58fi
59
60# cloned-and-hacked from partman-base/init.d/parted
61part_of_sataraid () {
62 local raiddev
63 for raiddev in $raiddevs; do
64 if [ "$(readlink -f "$raiddev")" = "$1" ]; then
65 return 0
66 fi
67 done
68 return 1
69}
70
71syspaths=
72scan_partition=false
73case $TYPE in
74 partition)
75 for x in /sys/block/*/*[0-9]; do
76 [ -d "$x" ] || continue
77 syspaths="${syspaths:+$syspaths }$x"
78 done
79 for x in /sys/block/dm-*; do
80 [ -d "$x" ] || continue
81 (is_sataraid "$x" && is_sataraid_partition "$x") || continue
82 syspaths="${syspaths:+$syspaths }$x"
83 done
84 TYPE=disk
85 # Also allow misdetected USB devices
86 scan_partition=:
87 ;;
88 usb-partition)
89 for x in /sys/block/*/*; do
90 [ -d "$x" ] || continue
91 syspaths="${syspaths:+$syspaths }$x"
92 done
93 ;;
94 *)
95 for x in /sys/block/*; do
96 [ -d "$x" ] || continue
97 case $x in
98 /sys/block/dm-*)
99 if is_sataraid "$x" && is_sataraid_partition "$x"; then
100 continue
101 fi
102 ;;
103 *)
104 name="$(device_name "$x")"
105 if part_of_sataraid "$name"; then
106 continue
107 fi
108 ;;
109 esac
110 syspaths="${syspaths:+$syspaths }$x"
111 done
112 ;;
113esac
114for x in $syspaths; do
115 devpath="${x#/sys}"
116 match=false
117 case $TYPE in
118 floppy)
119 # TODO ugly special case for non-IDE floppies
120 case $devpath in
121 /block/fd[0-9]*)
122 match=:
123 ;;
124 esac
125 ;;
126 esac
127 if ! $match && [ "$TYPE" = cd ]; then
128 if device_info env "$devpath" | grep -q '^ID_CDROM='; then
129 match=:
130 fi
131 fi
132 if ! $match; then
133 if device_info env "$devpath" | grep -q "^ID_TYPE=$TYPE"; then
134 match=:
135 fi
136 fi
137 if ! $match && [ "$TYPE" = disk ]; then
138 case $devpath in
139 /block/cciss\!*|/block/ida\!*|/block/rd\!*|/block/mmcblk*)
140 match=:
141 ;;
142 /block/dm-*)
143 # for now, we only understand dmraid
144 if is_sataraid "/sys$devpath"; then
145 match=:
146 fi
147 ;;
148 esac
149 fi
150 # Some USB sticks and CD drives are misdetected as floppy
151 # This allows to scan for those
152 if ! $match && ( $scan_partition || [ "$TYPE" = maybe-usb-floppy ] ); then
153 if device_info env "$devpath" | grep -q '^ID_BUS=usb' && \
154 device_info env "$devpath" | grep -q '^ID_TYPE=floppy'; then
155 match=:
156 fi
157 fi
158 # Disk partitions, but only on USB drives
159 if ! $match && [ "$TYPE" = usb-partition ]; then
160 if device_info env "$devpath" | grep -q '^ID_BUS=usb' && \
161 device_info env "$devpath" | grep -q '^ID_TYPE=disk'; then
162 match=:
163 fi
164 fi
165 if $match; then
166 device_name "/sys$devpath"
167 fi
168done
1690
=== removed file 'scripts/disk_test'
--- scripts/disk_test 2010-03-07 15:05:44 +0000
+++ scripts/disk_test 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1#!/usr/bin/python
2
3import os
4import sys
5
6from subprocess import Popen, PIPE
7
8
9def main(args):
10 directory = os.path.dirname(__file__)
11 script = os.path.join(directory, "device_list")
12 disk_devices_string = Popen([script, "disk"], stdout=PIPE).communicate()[0]
13 disk_devices_string = disk_devices_string.strip()
14
15 if not disk_devices_string:
16 print "None"
17 else:
18 disk_devices = disk_devices_string.split("\n")
19 for disk_device in disk_devices:
20 disk = os.path.basename(disk_device)
21 model_path = "/sys/block/%s/device/model" % disk
22 model_file = open(model_path)
23 try:
24 model_name = model_file.read().strip()
25 print model_name
26 finally:
27 model_file.close()
28
29 return 0
30
31
32if __name__ == "__main__":
33 sys.exit(main(sys.argv[1:]))
340
=== added file 'scripts/run_templates'
--- scripts/run_templates 1970-01-01 00:00:00 +0000
+++ scripts/run_templates 2010-06-23 19:15:40 +0000
@@ -0,0 +1,142 @@
1#!/usr/bin/env python
2
3import os
4import re
5import sys
6import uuid
7
8from optparse import OptionParser
9from subprocess import Popen, PIPE
10
11from checkbox.lib.template import Template
12
13
14DEFAULT_INPUT = "-"
15DEFAULT_OUTPUT = "-"
16
17COMMAND_TEMPLATE = """cat <<%(separator)s
18%(input)s
19%(separator)s"""
20
21
22class Runner(object):
23
24 def __init__(self, input, output):
25 self.input = input
26 self.output = output
27
28 def get_args(self, record):
29 return []
30
31 def get_env(self, record):
32 env = dict(os.environ)
33 env["NF"] = str(len(record))
34
35 return env
36
37 def process(self, args, shell=False):
38 process = Popen(args, shell=shell, stdout=PIPE)
39 records = self.process_output(process.stdout)
40
41 for nr, record in enumerate(records):
42 args = self.get_args(record)
43 env = self.get_env(record)
44 env["NR"] = str(nr)
45
46 command_string = COMMAND_TEMPLATE % {
47 "input": self.input,
48 "separator": uuid.uuid4()}
49 command = ["sh", "-c", command_string] + args
50
51 process = Popen(command,
52 env=env,
53 stdout=self.output)
54 process.communicate()
55
56 def process_output(self, output):
57 raise NotImplementedError
58
59
60class LineRunner(Runner):
61
62 field_separator = r"\s+"
63 record_separator = r"(?:\r?\n)"
64
65 def get_args(self, record):
66 args = [record]
67 args.extend(re.split(self.field_separator, record))
68
69 return args
70
71 def process_output(self, file):
72 # Strip trailing separator
73 data = re.sub(r"%s$" % self.record_separator, "", file.read())
74
75 return re.split(self.record_separator, data)
76
77
78class TemplateRunner(Runner):
79
80 def get_env(self, record):
81 env = super(TemplateRunner, self).get_env(record)
82 env.update(record)
83
84 return env
85
86 def process_output(self, output):
87 template = Template()
88 return template.load_file(output)
89
90
91def main(args):
92 usage = "Usage: %prog [OPTIONS] [COMMAND]"
93 parser = OptionParser(usage=usage)
94 parser.add_option("-i", "--input",
95 metavar="FILE",
96 default=DEFAULT_INPUT,
97 help="Input from the given file name, - for stdin")
98 parser.add_option("-o", "--output",
99 metavar="FILE",
100 default=DEFAULT_OUTPUT,
101 help="Output to the given file name, - for stdout")
102 parser.add_option("-s", "--shell",
103 action="store_true",
104 help="Run the command as a shell script")
105 parser.add_option("-t", "--template",
106 action="store_true",
107 help="Interpret the command output as a template")
108 (options, args) = parser.parse_args(args)
109
110 # Default args to echo command
111 if not args:
112 args = ["echo"]
113
114 # Read input
115 if options.input == "-":
116 input = sys.stdin.read()
117 else:
118 input_file = open(options.input, "r")
119 try:
120 input = input_file.read()
121 finally:
122 input_file.close()
123
124 # Open output
125 if options.output == "-":
126 output_file = sys.stdout
127 else:
128 output_file = open(options.output, "w")
129
130 # Determine runner class
131 if options.template:
132 runner_class = TemplateRunner
133 else:
134 runner_class = LineRunner
135
136 runner = runner_class(input, output_file)
137 runner.process(args, options.shell)
138
139 return 0
140
141if __name__ == "__main__":
142 sys.exit(main(sys.argv[1:]))
0143
=== modified file 'scripts/suspend_test'
--- scripts/suspend_test 2009-03-17 09:46:16 +0000
+++ scripts/suspend_test 2010-06-23 19:15:40 +0000
@@ -109,11 +109,10 @@
109 #109 #
110 ctl='/sys/class/rtc/rtc0/wakealarm'110 ctl='/sys/class/rtc/rtc0/wakealarm'
111 if [ -f "$ctl" ]; then111 if [ -f "$ctl" ]; then
112 time=`date '+%s' -d "+ $timeout seconds"`
113 # Cancel any outstanding timers.112 # Cancel any outstanding timers.
114 echo "0" >"$ctl"113 echo "0" >"$ctl"
115 # rtcN/wakealarm uses absolute time in seconds114 # rtcN/wakealarm can use relative time in seconds
116 echo "$time" >"$ctl"115 echo "+$timeout" >"$ctl"
117 return 0116 return 0
118 fi117 fi
119 ctl='/proc/acpi/alarm'118 ctl='/proc/acpi/alarm'
120119
=== modified file 'scripts/udev_resource'
--- scripts/udev_resource 2010-03-07 15:05:44 +0000
+++ scripts/udev_resource 2010-06-23 19:15:40 +0000
@@ -476,7 +476,7 @@
476 def devices(self):476 def devices(self):
477 devices = []477 devices = []
478 line_pattern = re.compile(r"(?P<key>\w):\s*(?P<value>.*)")478 line_pattern = re.compile(r"(?P<key>\w):\s*(?P<value>.*)")
479 multi_pattern = re.compile(r"(?P<key>\w+)=(?P<value>.*)")479 multi_pattern = re.compile(r"(?P<key>[^=]+)=(?P<value>.*)")
480480
481 output = Popen(COMMAND, stdout=PIPE, shell=True).communicate()[0]481 output = Popen(COMMAND, stdout=PIPE, shell=True).communicate()[0]
482 for record in output.split("\n\n"):482 for record in output.split("\n\n"):

Subscribers

People subscribed via source and target branches

to all changes: