Merge lp:~cr3/checkbox/rename into lp:checkbox

Proposed by Marc Tardif
Status: Merged
Merged at revision: 1133
Proposed branch: lp:~cr3/checkbox/rename
Merge into: lp:checkbox
Diff against target: 147 lines (+20/-10)
9 files modified
debian/changelog (+4/-1)
debian/checkbox-cli.postinst (+1/-0)
debian/checkbox-gtk.postinst (+1/-0)
debian/checkbox-urwid.postinst (+1/-0)
debian/hwtest-cli.postinst (+1/-0)
debian/hwtest-gtk.postinst (+1/-0)
debian/hwtest.postinst (+1/-0)
install/config (+4/-5)
install/postinst (+6/-4)
To merge this branch: bzr merge lp:~cr3/checkbox/rename
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+83851@code.launchpad.net

Description of the change

This branch refactors the install script to be agnostic of variant name because it previously assumed (cli|gtk|urwid), which broken when the checkbox-certification-client and checkbox-certification-server packages were introduced.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

Looks simple but there's a lot of magic going on in here.

The magic seems to work, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-11-28 14:27:10 +0000
3+++ debian/changelog 2011-11-29 20:27:24 +0000
4@@ -8,7 +8,10 @@
5 [Gabor Kelemen]
6 * Fixed last two remaining strings with backslashes (LP: #868571)
7
8- -- Daniel Manrique <daniel.manrique@canonical.com> Fri, 25 Nov 2011 13:04:55 -0500
9+ [Marc Tardif]
10+ * Refactored install script to be agnostic of variant name.
11+
12+ -- Marc Tardif <marc@ubuntu.com> Tue, 29 Nov 2011 12:39:07 -0500
13
14 checkbox (0.13) precise; urgency=low
15
16
17=== modified file 'debian/checkbox-cli.postinst'
18--- debian/checkbox-cli.postinst 2008-08-13 20:04:12 +0000
19+++ debian/checkbox-cli.postinst 2011-11-29 20:27:24 +0000
20@@ -1,5 +1,6 @@
21 #! /bin/sh -e
22
23+base_package="checkbox"
24 . /usr/share/debconf/confmodule
25 . /usr/share/checkbox/install/postinst
26
27
28=== modified file 'debian/checkbox-gtk.postinst'
29--- debian/checkbox-gtk.postinst 2008-08-13 20:04:12 +0000
30+++ debian/checkbox-gtk.postinst 2011-11-29 20:27:24 +0000
31@@ -1,5 +1,6 @@
32 #! /bin/sh -e
33
34+base_package="checkbox"
35 . /usr/share/debconf/confmodule
36 . /usr/share/checkbox/install/postinst
37
38
39=== modified file 'debian/checkbox-urwid.postinst'
40--- debian/checkbox-urwid.postinst 2010-05-20 09:00:22 +0000
41+++ debian/checkbox-urwid.postinst 2011-11-29 20:27:24 +0000
42@@ -1,5 +1,6 @@
43 #! /bin/sh -e
44
45+base_package="checkbox"
46 . /usr/share/debconf/confmodule
47 . /usr/share/checkbox/install/postinst
48
49
50=== modified file 'debian/hwtest-cli.postinst'
51--- debian/hwtest-cli.postinst 2008-12-16 00:46:19 +0000
52+++ debian/hwtest-cli.postinst 2011-11-29 20:27:24 +0000
53@@ -1,5 +1,6 @@
54 #! /bin/sh -e
55
56+base_package="checkbox"
57 . /usr/share/debconf/confmodule
58 . /usr/share/checkbox/install/postinst
59
60
61=== modified file 'debian/hwtest-gtk.postinst'
62--- debian/hwtest-gtk.postinst 2008-12-16 00:46:19 +0000
63+++ debian/hwtest-gtk.postinst 2011-11-29 20:27:24 +0000
64@@ -1,5 +1,6 @@
65 #! /bin/sh -e
66
67+base_package="checkbox"
68 . /usr/share/debconf/confmodule
69 . /usr/share/checkbox/install/postinst
70
71
72=== modified file 'debian/hwtest.postinst'
73--- debian/hwtest.postinst 2008-12-16 00:46:19 +0000
74+++ debian/hwtest.postinst 2011-11-29 20:27:24 +0000
75@@ -1,5 +1,6 @@
76 #! /bin/sh -e
77
78+base_package="checkbox"
79 . /usr/share/debconf/confmodule
80 . /usr/share/checkbox/install/postinst
81
82
83=== modified file 'install/config'
84--- install/config 2011-03-01 20:56:39 +0000
85+++ install/config 2011-11-29 20:27:24 +0000
86@@ -69,10 +69,10 @@
87 configs_base = "/usr/share/%(base_name)s/configs/%(name)s.ini"
88 examples_base = "/usr/share/%(base_name)s/examples/%(name)s.ini"
89
90- def __init__(self, name, configs_path=None, examples_path=None,
91- templates_path=None):
92+ def __init__(self, name, base_name=None, configs_path=None,
93+ examples_path=None, templates_path=None):
94 self.name = name
95- self.base_name = re.sub(r"(-cli|-urwid|-gtk)$", "", name)
96+ self.base_name = name if base_name is None else base_name
97 self._configs_path = configs_path or self.configs_base \
98 % {"name": name, "base_name": self.base_name}
99 self._examples_path = examples_path or self.examples_base \
100@@ -147,8 +147,7 @@
101 if len(args) < 1:
102 return 1
103
104- package = args.pop(0)
105- install = Install(package)
106+ install = Install(*args)
107
108 if options.output == "-":
109 file = sys.stdout
110
111=== modified file 'install/postinst'
112--- install/postinst 2010-05-24 18:54:44 +0000
113+++ install/postinst 2011-11-29 20:27:24 +0000
114@@ -1,11 +1,13 @@
115 package=`basename $0 .postinst`
116+if [ -z "$base_package" ]; then
117+ base_package="$package"
118+fi
119 config="/etc/checkbox.d/$package.ini"
120
121 patch_configuration()
122 {
123 version="$1"
124 previous_version=""
125- base_package=`echo $package | sed -e 's/hwtest/checkbox/' -e 's/\(-cli\|-urwid\|-gtk\)//'`
126
127 while [ -n "$version" ]; do
128 patch_file=""
129@@ -43,15 +45,15 @@
130
131 update_configuration()
132 {
133- base_package=`echo $package | cut -d '-' -f '1'`
134+ root_package=`echo $package | cut -d '-' -f '1'`
135
136- if [ "$base_package" != "hwtest" ]; then
137+ if [ "$root_package" != "hwtest" ]; then
138 # Create a temporary file to generate the suggested
139 # configuration file.
140 tempfile=`tempfile -m 0644 -p checkbox`
141
142 # Update the temporary file with preseeded values.
143- /usr/share/checkbox/install/config --output=$tempfile $package
144+ /usr/share/checkbox/install/config --output=$tempfile $package $base_package
145
146 # Clobber the old config file.
147 cp $tempfile $config

Subscribers

People subscribed via source and target branches