Merge lp:~mbp/launchpad/800295-delete-buildd-again into lp:launchpad
- 800295-delete-buildd-again
- Merge into devel
Proposed by
Martin Pool
Status: | Merged |
---|---|
Approved by: | Martin Pool |
Approved revision: | no longer in the source branch. |
Merged at revision: | 14344 |
Proposed branch: | lp:~mbp/launchpad/800295-delete-buildd-again |
Merge into: | lp:launchpad |
Diff against target: |
9033 lines (+18/-8598) 63 files modified
.bzrignore (+0/-8) buildout.cfg (+4/-2) lib/canonical/buildd/Makefile (+0/-19) lib/canonical/buildd/README (+0/-47) lib/canonical/buildd/__init__.py (+0/-5) lib/canonical/buildd/binarypackage.py (+0/-133) lib/canonical/buildd/buildd-config.py (+0/-54) lib/canonical/buildd/buildd-slave-example.conf (+0/-25) lib/canonical/buildd/buildd-slave.tac (+0/-55) lib/canonical/buildd/buildrecipe (+0/-220) lib/canonical/buildd/check-implicit-pointer-functions (+0/-118) lib/canonical/buildd/debian.py (+0/-239) lib/canonical/buildd/debian/changelog (+0/-698) lib/canonical/buildd/debian/compat (+0/-1) lib/canonical/buildd/debian/control (+0/-17) lib/canonical/buildd/debian/launchpad-buildd.cron.daily (+0/-10) lib/canonical/buildd/debian/launchpad-buildd.examples (+0/-1) lib/canonical/buildd/debian/launchpad-buildd.init (+0/-98) lib/canonical/buildd/debian/postinst (+0/-101) lib/canonical/buildd/debian/rules (+0/-96) lib/canonical/buildd/debian/source/format (+0/-1) lib/canonical/buildd/debian/upgrade-config (+0/-122) lib/canonical/buildd/generate-translation-templates (+0/-66) lib/canonical/buildd/mount-chroot (+0/-25) lib/canonical/buildd/override-sources-list (+0/-31) lib/canonical/buildd/pottery/generate_translation_templates.py (+0/-114) lib/canonical/buildd/pottery/intltool.py (+0/-342) lib/canonical/buildd/remove-build (+0/-25) lib/canonical/buildd/sbuild (+0/-3658) lib/canonical/buildd/sbuild-package (+0/-92) lib/canonical/buildd/sbuild.conf (+0/-155) lib/canonical/buildd/sbuildrc (+0/-32) lib/canonical/buildd/scan-for-processes (+0/-43) lib/canonical/buildd/slave.py (+0/-686) lib/canonical/buildd/sourcepackagerecipe.py (+0/-144) lib/canonical/buildd/template-buildd-slave.conf (+0/-32) lib/canonical/buildd/test_buildd_generatetranslationtemplates (+0/-33) lib/canonical/buildd/test_buildd_recipe (+0/-48) lib/canonical/buildd/tests/__init__.py (+0/-4) lib/canonical/buildd/tests/buildd-slave-test.conf (+0/-27) lib/canonical/buildd/tests/buildlog (+0/-23) lib/canonical/buildd/tests/buildlog.long (+0/-82) lib/canonical/buildd/tests/harness.py (+0/-139) lib/canonical/buildd/tests/test_1.diff (+0/-17) lib/canonical/buildd/tests/test_2.diff (+0/-32) lib/canonical/buildd/tests/test_buildd_slave.py (+0/-198) lib/canonical/buildd/tests/test_check_implicit_pointer_functions.py (+0/-43) lib/canonical/buildd/tests/test_harness.py (+0/-10) lib/canonical/buildd/tests/test_translationtemplatesbuildmanager.py (+0/-173) lib/canonical/buildd/translationtemplates.py (+0/-99) lib/canonical/buildd/umount-chroot (+0/-40) lib/canonical/buildd/unpack-chroot (+0/-52) lib/canonical/buildd/update-debian-chroot (+0/-45) lib/canonical/launchpad/daemons/readyservice.py (+0/-6) lib/lp/buildmaster/model/builder.py (+2/-3) lib/lp/buildmaster/tests/mock_slaves.py (+1/-1) lib/lp/buildmaster/tests/test_builder.py (+2/-1) lib/lp/buildmaster/tests/test_manager.py (+2/-1) lib/lp/testing/factory.py (+0/-1) lib/lp/translations/tests/test_generate_translation_templates.py (+5/-2) lib/lp/translations/tests/test_pottery_detect_intltool.py (+1/-1) scripts/rosetta/pottery-generate-intltool.py (+1/-1) utilities/snakefood/lp-sfood-packages (+0/-1) |
To merge this branch: | bzr merge lp:~mbp/launchpad/800295-delete-buildd-again |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Launchpad code reviewers | Pending | ||
Review via email: mp+82836@code.launchpad.net |
Commit message
[no-qa] [r=mbp] delete canonical.buildd, now it has moved to launchpad-buildd
Description of the change
Try again to delete canonical.buildd, now that the dependencies are in place.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-11-17 19:41:24 +0000 | |||
3 | +++ .bzrignore 2011-11-20 23:45:00 +0000 | |||
4 | @@ -63,14 +63,6 @@ | |||
5 | 63 | twistd.pid | 63 | twistd.pid |
6 | 64 | lib/canonical/launchpad/apidoc | 64 | lib/canonical/launchpad/apidoc |
7 | 65 | *.prof | 65 | *.prof |
8 | 66 | lib/canonical/launchpad-buildd_*.dsc | ||
9 | 67 | lib/canonical/launchpad-buildd_*.tar.gz | ||
10 | 68 | lib/canonical/launchpad-buildd_*_all.deb | ||
11 | 69 | lib/canonical/launchpad-buildd_*.changes | ||
12 | 70 | lib/canonical/launchpad-buildd_*_source.build | ||
13 | 71 | lib/canonical/launchpad-buildd_*_source.changes | ||
14 | 72 | lib/canonical/buildd/debian/* | ||
15 | 73 | lib/canonical/buildd/launchpad-files/* | ||
16 | 74 | .project | 66 | .project |
17 | 75 | .pydevproject | 67 | .pydevproject |
18 | 76 | librarian.log | 68 | librarian.log |
19 | 77 | 69 | ||
20 | === modified file 'buildout.cfg' | |||
21 | --- buildout.cfg 2011-11-17 19:41:24 +0000 | |||
22 | +++ buildout.cfg 2011-11-20 23:45:00 +0000 | |||
23 | @@ -1,4 +1,4 @@ | |||
25 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
26 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
27 | 3 | 3 | ||
28 | 4 | [buildout] | 4 | [buildout] |
29 | @@ -57,7 +57,9 @@ | |||
30 | 57 | zc.zservertracelog | 57 | zc.zservertracelog |
31 | 58 | # XXX gary 2009-5-12 bug 375751: | 58 | # XXX gary 2009-5-12 bug 375751: |
32 | 59 | # Make mailman built and installed in a more normal way. | 59 | # Make mailman built and installed in a more normal way. |
34 | 60 | extra-paths = ${buildout:directory}/lib/mailman | 60 | extra-paths = |
35 | 61 | ${buildout:directory}/lib/mailman | ||
36 | 62 | /usr/lib/launchpad-buildd | ||
37 | 61 | include-site-packages = true | 63 | include-site-packages = true |
38 | 62 | allowed-eggs-from-site-packages = | 64 | allowed-eggs-from-site-packages = |
39 | 63 | interpreter = py | 65 | interpreter = py |
40 | 64 | 66 | ||
41 | === removed directory 'lib/canonical/buildd' | |||
42 | === removed file 'lib/canonical/buildd/Makefile' | |||
43 | --- lib/canonical/buildd/Makefile 2011-11-17 22:06:34 +0000 | |||
44 | +++ lib/canonical/buildd/Makefile 1970-01-01 00:00:00 +0000 | |||
45 | @@ -1,19 +0,0 @@ | |||
46 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
47 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
48 | 3 | |||
49 | 4 | all: deb | ||
50 | 5 | |||
51 | 6 | src: clean | ||
52 | 7 | dpkg-buildpackage -rfakeroot -uc -us -S | ||
53 | 8 | |||
54 | 9 | deb: clean | ||
55 | 10 | dpkg-buildpackage -rfakeroot -uc -us | ||
56 | 11 | |||
57 | 12 | clean: | ||
58 | 13 | fakeroot debian/rules clean | ||
59 | 14 | rm -f ../launchpad-buildd*tar.gz | ||
60 | 15 | rm -f ../launchpad-buildd*dsc | ||
61 | 16 | rm -f ../launchpad-buildd*deb | ||
62 | 17 | rm -f ../launchpad-buildd*changes | ||
63 | 18 | |||
64 | 19 | .PHONY: all clean deb | ||
65 | 20 | 0 | ||
66 | === removed file 'lib/canonical/buildd/README' | |||
67 | --- lib/canonical/buildd/README 2011-11-17 22:06:34 +0000 | |||
68 | +++ lib/canonical/buildd/README 1970-01-01 00:00:00 +0000 | |||
69 | @@ -1,47 +0,0 @@ | |||
70 | 1 | In order to build the package you need dpkg-dev and fakeroot | ||
71 | 2 | |||
72 | 3 | To build the package do: | ||
73 | 4 | |||
74 | 5 | cd ..../lib/canonical/buildd | ||
75 | 6 | debian/rules package | ||
76 | 7 | dpkg-buildpackage -rfakeroot -b | ||
77 | 8 | |||
78 | 9 | It will "fail" because the package built in the "wrong" place. Don't | ||
79 | 10 | worry about that. | ||
80 | 11 | |||
81 | 12 | To clean up, do: | ||
82 | 13 | |||
83 | 14 | fakeroot debian/rules clean | ||
84 | 15 | rm launchpad-buildd*deb | ||
85 | 16 | rm ../launchpad-buildd*changes | ||
86 | 17 | |||
87 | 18 | ----------------------------------------------------------------------- | ||
88 | 19 | |||
89 | 20 | How to use the chroot tool: | ||
90 | 21 | |||
91 | 22 | buildd-slave-chroot-tool --intervene <chroot tarball> | ||
92 | 23 | |||
93 | 24 | ...will unpack the chroot tarball, mount up the proc etc filesystems | ||
94 | 25 | in it and chroot into it. | ||
95 | 26 | |||
96 | 27 | When you leave the chroot, it will ask you if you want to repack the | ||
97 | 28 | tarball. If you answer yes then it will repack it, if you answer no, | ||
98 | 29 | then it will merely clean up and exit. | ||
99 | 30 | |||
100 | 31 | If you wish to build a new chroot then first copy the example.chroot | ||
101 | 32 | file from /usr/share/doc/launchpad-buildd/ and edit it to your | ||
102 | 33 | requirements. | ||
103 | 34 | |||
104 | 35 | Next run buildd-slave-chroot-tool --generate config.filename | ||
105 | 36 | |||
106 | 37 | You must have sudo capability and ideally you would run this as the | ||
107 | 38 | buildd user on a machine with launchpad-buildd installed. | ||
108 | 39 | |||
109 | 40 | Once you have completed the chroot building, you will be left with a | ||
110 | 41 | file named chroot-<distro>-<distrorelease>-<arch>.tar.bz2 which should | ||
111 | 42 | be uploaded to the librarian from a machine with librarian access and | ||
112 | 43 | then marked as the chroot for the given pocket. | ||
113 | 44 | |||
114 | 45 | You should retain the configuration file so that we know how the | ||
115 | 46 | chroot was built in case we need to rebuild it at a later date. | ||
116 | 47 | |||
117 | 48 | 0 | ||
118 | === removed file 'lib/canonical/buildd/__init__.py' | |||
119 | --- lib/canonical/buildd/__init__.py 2011-11-17 22:06:34 +0000 | |||
120 | +++ lib/canonical/buildd/__init__.py 1970-01-01 00:00:00 +0000 | |||
121 | @@ -1,5 +0,0 @@ | |||
122 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
123 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
124 | 3 | |||
125 | 4 | from canonical.buildd.slave import XMLRPCBuildDSlave | ||
126 | 5 | from canonical.buildd.debian import DebianBuildManager | ||
127 | 6 | 0 | ||
128 | === removed file 'lib/canonical/buildd/binarypackage.py' | |||
129 | --- lib/canonical/buildd/binarypackage.py 2011-11-17 22:06:34 +0000 | |||
130 | +++ lib/canonical/buildd/binarypackage.py 1970-01-01 00:00:00 +0000 | |||
131 | @@ -1,133 +0,0 @@ | |||
132 | 1 | # Copyright 2009, 2010 Canonical Ltd. This software is licensed under the | ||
133 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
134 | 3 | |||
135 | 4 | |||
136 | 5 | import re | ||
137 | 6 | |||
138 | 7 | from canonical.buildd.debian import DebianBuildManager, DebianBuildState | ||
139 | 8 | |||
140 | 9 | |||
141 | 10 | class SBuildExitCodes: | ||
142 | 11 | """SBUILD process result codes.""" | ||
143 | 12 | OK = 0 | ||
144 | 13 | DEPFAIL = 1 | ||
145 | 14 | GIVENBACK = 2 | ||
146 | 15 | PACKAGEFAIL = 3 | ||
147 | 16 | BUILDERFAIL = 4 | ||
148 | 17 | |||
149 | 18 | |||
150 | 19 | class BuildLogRegexes: | ||
151 | 20 | """Build log regexes for performing actions based on regexes, and extracting dependencies for auto dep-waits""" | ||
152 | 21 | GIVENBACK = [ | ||
153 | 22 | ("^E: There are problems and -y was used without --force-yes"), | ||
154 | 23 | ] | ||
155 | 24 | DEPFAIL = [ | ||
156 | 25 | ("(?P<pk>[\-+.\w]+)\(inst [^ ]+ ! >> wanted (?P<v>[\-.+\w:~]+)\)","\g<pk> (>> \g<v>)"), | ||
157 | 26 | ("(?P<pk>[\-+.\w]+)\(inst [^ ]+ ! >?= wanted (?P<v>[\-.+\w:~]+)\)","\g<pk> (>= \g<v>)"), | ||
158 | 27 | ("(?s)^E: Couldn't find package (?P<pk>[\-+.\w]+)(?!.*^E: Couldn't find package)","\g<pk>"), | ||
159 | 28 | ("(?s)^E: Package '?(?P<pk>[\-+.\w]+)'? has no installation candidate(?!.*^E: Package)","\g<pk>"), | ||
160 | 29 | ("(?s)^E: Unable to locate package (?P<pk>[\-+.\w]+)(?!.*^E: Unable to locate package)", "\g<pk>"), | ||
161 | 30 | ] | ||
162 | 31 | |||
163 | 32 | |||
164 | 33 | class BinaryPackageBuildState(DebianBuildState): | ||
165 | 34 | SBUILD = "SBUILD" | ||
166 | 35 | |||
167 | 36 | |||
168 | 37 | class BinaryPackageBuildManager(DebianBuildManager): | ||
169 | 38 | """Handle buildd building for a debian style binary package build""" | ||
170 | 39 | |||
171 | 40 | initial_build_state = BinaryPackageBuildState.SBUILD | ||
172 | 41 | |||
173 | 42 | def __init__(self, slave, buildid): | ||
174 | 43 | DebianBuildManager.__init__(self, slave, buildid) | ||
175 | 44 | self._sbuildpath = slave._config.get("binarypackagemanager", "sbuildpath") | ||
176 | 45 | self._sbuildargs = slave._config.get("binarypackagemanager", | ||
177 | 46 | "sbuildargs").split(" ") | ||
178 | 47 | |||
179 | 48 | def initiate(self, files, chroot, extra_args): | ||
180 | 49 | """Initiate a build with a given set of files and chroot.""" | ||
181 | 50 | |||
182 | 51 | self._dscfile = None | ||
183 | 52 | for f in files: | ||
184 | 53 | if f.endswith(".dsc"): | ||
185 | 54 | self._dscfile = f | ||
186 | 55 | if self._dscfile is None: | ||
187 | 56 | raise ValueError, files | ||
188 | 57 | |||
189 | 58 | self.archive_purpose = extra_args.get('archive_purpose') | ||
190 | 59 | self.suite = extra_args.get('suite') | ||
191 | 60 | self.component = extra_args['ogrecomponent'] | ||
192 | 61 | self.arch_indep = extra_args.get('arch_indep', False) | ||
193 | 62 | self.build_debug_symbols = extra_args.get('build_debug_symbols', False) | ||
194 | 63 | |||
195 | 64 | super(BinaryPackageBuildManager, self).initiate( | ||
196 | 65 | files, chroot, extra_args) | ||
197 | 66 | |||
198 | 67 | def doRunBuild(self): | ||
199 | 68 | """Run the sbuild process to build the package.""" | ||
200 | 69 | args = ["sbuild-package", self._buildid, self.arch_tag] | ||
201 | 70 | if self.suite: | ||
202 | 71 | args.extend([self.suite]) | ||
203 | 72 | args.extend(self._sbuildargs) | ||
204 | 73 | args.extend(["--dist=" + self.suite]) | ||
205 | 74 | else: | ||
206 | 75 | args.extend(['autobuild']) | ||
207 | 76 | args.extend(self._sbuildargs) | ||
208 | 77 | args.extend(["--dist=autobuild"]) | ||
209 | 78 | if self.arch_indep: | ||
210 | 79 | args.extend(["-A"]) | ||
211 | 80 | if self.archive_purpose: | ||
212 | 81 | args.extend(["--purpose=" + self.archive_purpose]) | ||
213 | 82 | if self.build_debug_symbols: | ||
214 | 83 | args.extend(["--build-debug-symbols"]) | ||
215 | 84 | args.extend(["--architecture=" + self.arch_tag]) | ||
216 | 85 | args.extend(["--comp=" + self.component]) | ||
217 | 86 | args.extend([self._dscfile]) | ||
218 | 87 | self.runSubProcess( self._sbuildpath, args ) | ||
219 | 88 | |||
220 | 89 | def iterate_SBUILD(self, success): | ||
221 | 90 | """Finished the sbuild run.""" | ||
222 | 91 | tmpLog = self.getTmpLogContents() | ||
223 | 92 | if success != SBuildExitCodes.OK: | ||
224 | 93 | if (success == SBuildExitCodes.DEPFAIL or | ||
225 | 94 | success == SBuildExitCodes.PACKAGEFAIL): | ||
226 | 95 | for rx in BuildLogRegexes.GIVENBACK: | ||
227 | 96 | mo = re.search(rx, tmpLog, re.M) | ||
228 | 97 | if mo: | ||
229 | 98 | success = SBuildExitCodes.GIVENBACK | ||
230 | 99 | |||
231 | 100 | if success == SBuildExitCodes.DEPFAIL: | ||
232 | 101 | for rx, dep in BuildLogRegexes.DEPFAIL: | ||
233 | 102 | mo = re.search(rx, tmpLog, re.M) | ||
234 | 103 | if mo: | ||
235 | 104 | if not self.alreadyfailed: | ||
236 | 105 | print("Returning build status: DEPFAIL") | ||
237 | 106 | print("Dependencies: " + mo.expand(dep)) | ||
238 | 107 | self._slave.depFail(mo.expand(dep)) | ||
239 | 108 | success = SBuildExitCodes.DEPFAIL | ||
240 | 109 | break | ||
241 | 110 | else: | ||
242 | 111 | success = SBuildExitCodes.PACKAGEFAIL | ||
243 | 112 | |||
244 | 113 | if success == SBuildExitCodes.GIVENBACK: | ||
245 | 114 | if not self.alreadyfailed: | ||
246 | 115 | print("Returning build status: GIVENBACK") | ||
247 | 116 | self._slave.giveBack() | ||
248 | 117 | elif success == SBuildExitCodes.PACKAGEFAIL: | ||
249 | 118 | if not self.alreadyfailed: | ||
250 | 119 | print("Returning build status: PACKAGEFAIL") | ||
251 | 120 | self._slave.buildFail() | ||
252 | 121 | elif success >= SBuildExitCodes.BUILDERFAIL: | ||
253 | 122 | # anything else is assumed to be a buildd failure | ||
254 | 123 | if not self.alreadyfailed: | ||
255 | 124 | print("Returning build status: BUILDERFAIL") | ||
256 | 125 | self._slave.builderFail() | ||
257 | 126 | self.alreadyfailed = True | ||
258 | 127 | self._state = DebianBuildState.REAP | ||
259 | 128 | self.doReapProcesses() | ||
260 | 129 | else: | ||
261 | 130 | print("Returning build status: OK") | ||
262 | 131 | self.gatherResults() | ||
263 | 132 | self._state = DebianBuildState.REAP | ||
264 | 133 | self.doReapProcesses() | ||
265 | 134 | 0 | ||
266 | === removed file 'lib/canonical/buildd/buildd-config.py' | |||
267 | --- lib/canonical/buildd/buildd-config.py 2011-11-17 22:06:34 +0000 | |||
268 | +++ lib/canonical/buildd/buildd-config.py 1970-01-01 00:00:00 +0000 | |||
269 | @@ -1,54 +0,0 @@ | |||
270 | 1 | #!/usr/bin/python | ||
271 | 2 | # | ||
272 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
273 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
274 | 5 | |||
275 | 6 | import os | ||
276 | 7 | |||
277 | 8 | archtag = os.popen("dpkg --print-architecture").read().strip() | ||
278 | 9 | |||
279 | 10 | from optparse import OptionParser | ||
280 | 11 | |||
281 | 12 | parser = OptionParser() | ||
282 | 13 | parser.add_option("-n", "--name", dest="NAME", | ||
283 | 14 | help="the name for this buildd", | ||
284 | 15 | metavar="NAME", | ||
285 | 16 | default="default") | ||
286 | 17 | |||
287 | 18 | parser.add_option("-H", "--host", dest="BINDHOST", | ||
288 | 19 | help="the IP/host this buildd binds to", | ||
289 | 20 | metavar="HOSTNAME", | ||
290 | 21 | default="localhost") | ||
291 | 22 | |||
292 | 23 | parser.add_option("-p", "--port", dest="BINDPORT", | ||
293 | 24 | help="the port this buildd binds to", | ||
294 | 25 | metavar="PORT", | ||
295 | 26 | default="8221") | ||
296 | 27 | |||
297 | 28 | parser.add_option("-a", "--arch", dest="ARCHTAG", | ||
298 | 29 | help="the arch tag this buildd claims", | ||
299 | 30 | metavar="ARCHTAG", | ||
300 | 31 | default=archtag) | ||
301 | 32 | |||
302 | 33 | parser.add_option("-t", "--template", dest="TEMPLATE", | ||
303 | 34 | help="the template file to use", | ||
304 | 35 | metavar="FILE", | ||
305 | 36 | default="/usr/share/launchpad-buildd/template-buildd-slave.conf") | ||
306 | 37 | |||
307 | 38 | (options, args) = parser.parse_args() | ||
308 | 39 | |||
309 | 40 | template = open(options.TEMPLATE, "r").read() | ||
310 | 41 | |||
311 | 42 | replacements = { | ||
312 | 43 | "@NAME@": options.NAME, | ||
313 | 44 | "@BINDHOST@": options.BINDHOST, | ||
314 | 45 | "@ARCHTAG@": options.ARCHTAG, | ||
315 | 46 | "@BINDPORT@": options.BINDPORT, | ||
316 | 47 | } | ||
317 | 48 | |||
318 | 49 | for replacement_key in replacements: | ||
319 | 50 | template = template.replace(replacement_key, | ||
320 | 51 | replacements[replacement_key]) | ||
321 | 52 | |||
322 | 53 | print template | ||
323 | 54 | |||
324 | 55 | 0 | ||
325 | === removed file 'lib/canonical/buildd/buildd-slave-example.conf' | |||
326 | --- lib/canonical/buildd/buildd-slave-example.conf 2011-11-17 22:06:34 +0000 | |||
327 | +++ lib/canonical/buildd/buildd-slave-example.conf 1970-01-01 00:00:00 +0000 | |||
328 | @@ -1,25 +0,0 @@ | |||
329 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
330 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
331 | 3 | |||
332 | 4 | # Example buildd slave configuration | ||
333 | 5 | # This should be refactored into a nice central configuration format when | ||
334 | 6 | # such a beast becomes available | ||
335 | 7 | |||
336 | 8 | [slave] | ||
337 | 9 | architecturetag = i386 | ||
338 | 10 | filecache = /home/buildd/filecache | ||
339 | 11 | bindhost = localhost | ||
340 | 12 | bindport = 8221 | ||
341 | 13 | |||
342 | 14 | [allmanagers] | ||
343 | 15 | unpackpath = /home/buildd/slavebin/unpack-chroot | ||
344 | 16 | cleanpath = /home/buildd/slavebin/remove-build | ||
345 | 17 | mountpath = /home/buildd/slavebin/mount-chroot | ||
346 | 18 | umountpath = /home/buildd/slavebin/umount-chroot | ||
347 | 19 | |||
348 | 20 | [debianmanager] | ||
349 | 21 | sbuildpath = /home/buildd/slavebin/sbuild-package | ||
350 | 22 | sbuildargs = -dautobuild --nolog --batch -A | ||
351 | 23 | updatepath = /home/buildd/slavebin/update-debian-chroot | ||
352 | 24 | processscanpath = /home/buildd/slavebin/scan-for-processes | ||
353 | 25 | ogrepath = /home/buildd/slavebin/apply-ogre-model | ||
354 | 26 | 0 | ||
355 | === removed file 'lib/canonical/buildd/buildd-slave.tac' | |||
356 | --- lib/canonical/buildd/buildd-slave.tac 2011-11-17 22:06:34 +0000 | |||
357 | +++ lib/canonical/buildd/buildd-slave.tac 1970-01-01 00:00:00 +0000 | |||
358 | @@ -1,55 +0,0 @@ | |||
359 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | ||
360 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
361 | 3 | |||
362 | 4 | # CAUTION: The only modules in the Launchpad tree that this is permitted to | ||
363 | 5 | # depend on are canonical.buildd, since buildds are deployed by copying that | ||
364 | 6 | # directory only. (See also bug=800295.) | ||
365 | 7 | |||
366 | 8 | # Buildd Slave implementation | ||
367 | 9 | # XXX: dsilvers: 2005/01/21: Currently everything logged in the slave gets | ||
368 | 10 | # passed through to the twistd log too. this could get dangerous/big | ||
369 | 11 | |||
370 | 12 | from twisted.application import service, strports | ||
371 | 13 | from canonical.buildd import XMLRPCBuildDSlave | ||
372 | 14 | from canonical.buildd.binarypackage import BinaryPackageBuildManager | ||
373 | 15 | from canonical.buildd.sourcepackagerecipe import ( | ||
374 | 16 | SourcePackageRecipeBuildManager) | ||
375 | 17 | from canonical.buildd.translationtemplates import ( | ||
376 | 18 | TranslationTemplatesBuildManager) | ||
377 | 19 | |||
378 | 20 | from twisted.web import server, resource, static | ||
379 | 21 | from ConfigParser import SafeConfigParser | ||
380 | 22 | |||
381 | 23 | import os | ||
382 | 24 | |||
383 | 25 | conffile = os.environ.get('BUILDD_SLAVE_CONFIG', 'buildd-slave-example.conf') | ||
384 | 26 | |||
385 | 27 | conf = SafeConfigParser() | ||
386 | 28 | conf.read(conffile) | ||
387 | 29 | slave = XMLRPCBuildDSlave(conf) | ||
388 | 30 | |||
389 | 31 | # 'debian' is the old name. It remains here for compatibility. | ||
390 | 32 | slave.registerBuilder(BinaryPackageBuildManager, "debian") | ||
391 | 33 | slave.registerBuilder(BinaryPackageBuildManager, "binarypackage") | ||
392 | 34 | slave.registerBuilder(SourcePackageRecipeBuildManager, "sourcepackagerecipe") | ||
393 | 35 | slave.registerBuilder( | ||
394 | 36 | TranslationTemplatesBuildManager, 'translation-templates') | ||
395 | 37 | |||
396 | 38 | application = service.Application('BuildDSlave') | ||
397 | 39 | builddslaveService = service.IServiceCollection(application) | ||
398 | 40 | |||
399 | 41 | root = resource.Resource() | ||
400 | 42 | root.putChild('rpc', slave) | ||
401 | 43 | root.putChild('filecache', static.File(conf.get('slave', 'filecache'))) | ||
402 | 44 | slavesite = server.Site(root) | ||
403 | 45 | |||
404 | 46 | strports.service(slave.slave._config.get("slave","bindport"), | ||
405 | 47 | slavesite).setServiceParent(builddslaveService) | ||
406 | 48 | |||
407 | 49 | # You can interact with a running slave like this: | ||
408 | 50 | # (assuming the slave is on localhost:8221) | ||
409 | 51 | # | ||
410 | 52 | # python | ||
411 | 53 | # import xmlrpclib | ||
412 | 54 | # s = xmlrpclib.ServerProxy("http://localhost:8221/rpc") | ||
413 | 55 | # s.echo("Hello World") | ||
414 | 56 | 0 | ||
415 | === removed file 'lib/canonical/buildd/buildrecipe' | |||
416 | --- lib/canonical/buildd/buildrecipe 2011-11-17 22:06:34 +0000 | |||
417 | +++ lib/canonical/buildd/buildrecipe 1970-01-01 00:00:00 +0000 | |||
418 | @@ -1,220 +0,0 @@ | |||
419 | 1 | #! /usr/bin/env python -u | ||
420 | 2 | # Copyright 2010, 2011 Canonical Ltd. This software is licensed under the | ||
421 | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
422 | 4 | |||
423 | 5 | """A script that builds a package from a recipe and a chroot.""" | ||
424 | 6 | |||
425 | 7 | __metaclass__ = type | ||
426 | 8 | |||
427 | 9 | |||
428 | 10 | import os | ||
429 | 11 | import os.path | ||
430 | 12 | import pwd | ||
431 | 13 | from resource import RLIMIT_AS, setrlimit | ||
432 | 14 | import socket | ||
433 | 15 | from subprocess import ( | ||
434 | 16 | Popen, | ||
435 | 17 | call, | ||
436 | 18 | ) | ||
437 | 19 | import sys | ||
438 | 20 | |||
439 | 21 | |||
440 | 22 | RETCODE_SUCCESS = 0 | ||
441 | 23 | RETCODE_FAILURE_INSTALL = 200 | ||
442 | 24 | RETCODE_FAILURE_BUILD_TREE = 201 | ||
443 | 25 | RETCODE_FAILURE_INSTALL_BUILD_DEPS = 202 | ||
444 | 26 | RETCODE_FAILURE_BUILD_SOURCE_PACKAGE = 203 | ||
445 | 27 | |||
446 | 28 | |||
447 | 29 | class NotVirtualized(Exception): | ||
448 | 30 | """Exception raised when not running in a virtualized environment.""" | ||
449 | 31 | |||
450 | 32 | def __init__(self): | ||
451 | 33 | Exception.__init__(self, 'Not running under Xen.') | ||
452 | 34 | |||
453 | 35 | |||
454 | 36 | def call_report_rusage(args): | ||
455 | 37 | """Run a subprocess. | ||
456 | 38 | |||
457 | 39 | Report that it was run, and the resources used, and complain if it fails. | ||
458 | 40 | |||
459 | 41 | :return: The process wait status. | ||
460 | 42 | """ | ||
461 | 43 | print 'RUN %r' % args | ||
462 | 44 | proc = Popen(args) | ||
463 | 45 | pid, status, rusage = os.wait4(proc.pid, 0) | ||
464 | 46 | print(rusage) | ||
465 | 47 | return status | ||
466 | 48 | |||
467 | 49 | |||
468 | 50 | class RecipeBuilder: | ||
469 | 51 | """Builds a package from a recipe.""" | ||
470 | 52 | |||
471 | 53 | def __init__(self, build_id, author_name, author_email, | ||
472 | 54 | suite, distroseries_name, component, archive_purpose): | ||
473 | 55 | """Constructor. | ||
474 | 56 | |||
475 | 57 | :param build_id: The id of the build (a str). | ||
476 | 58 | :param author_name: The name of the author (a str). | ||
477 | 59 | :param author_email: The email address of the author (a str). | ||
478 | 60 | :param suite: The suite the package should be built for (a str). | ||
479 | 61 | """ | ||
480 | 62 | self.build_id = build_id | ||
481 | 63 | self.author_name = author_name.decode('utf-8') | ||
482 | 64 | self.author_email = author_email | ||
483 | 65 | self.archive_purpose = archive_purpose | ||
484 | 66 | self.component = component | ||
485 | 67 | self.distroseries_name = distroseries_name | ||
486 | 68 | self.suite = suite | ||
487 | 69 | self.base_branch = None | ||
488 | 70 | self.chroot_path = get_build_path(build_id, 'chroot-autobuild') | ||
489 | 71 | self.work_dir_relative = os.environ['HOME'] + '/work' | ||
490 | 72 | self.work_dir = os.path.join(self.chroot_path, | ||
491 | 73 | self.work_dir_relative[1:]) | ||
492 | 74 | self.tree_path = os.path.join(self.work_dir, 'tree') | ||
493 | 75 | self.username = pwd.getpwuid(os.getuid())[0] | ||
494 | 76 | |||
495 | 77 | def install(self): | ||
496 | 78 | """Install all the requirements for building recipes. | ||
497 | 79 | |||
498 | 80 | :return: A retcode from apt. | ||
499 | 81 | """ | ||
500 | 82 | # XXX: AaronBentley 2010-07-07 bug=602463: pbuilder uses aptitude but | ||
501 | 83 | # does not depend on it. | ||
502 | 84 | return self.chroot([ | ||
503 | 85 | 'apt-get', 'install', '-y', 'pbuilder', 'aptitude']) | ||
504 | 86 | |||
505 | 87 | def buildTree(self): | ||
506 | 88 | """Build the recipe into a source tree. | ||
507 | 89 | |||
508 | 90 | As a side-effect, sets self.source_dir_relative. | ||
509 | 91 | :return: a retcode from `bzr dailydeb`. | ||
510 | 92 | """ | ||
511 | 93 | try: | ||
512 | 94 | ensure_virtualized() | ||
513 | 95 | except NotVirtualized, e: | ||
514 | 96 | sys.stderr.write('Aborting on failed virtualization check:\n') | ||
515 | 97 | sys.stderr.write(str(e)) | ||
516 | 98 | return 1 | ||
517 | 99 | assert not os.path.exists(self.tree_path) | ||
518 | 100 | recipe_path = os.path.join(self.work_dir, 'recipe') | ||
519 | 101 | manifest_path = os.path.join(self.tree_path, 'manifest') | ||
520 | 102 | recipe_file = open(recipe_path, 'rb') | ||
521 | 103 | try: | ||
522 | 104 | recipe = recipe_file.read() | ||
523 | 105 | finally: | ||
524 | 106 | recipe_file.close() | ||
525 | 107 | # As of bzr 2.2, a defined identity is needed. In this case, we're | ||
526 | 108 | # using buildd@<hostname>. | ||
527 | 109 | hostname = socket.gethostname() | ||
528 | 110 | bzr_email = 'buildd@%s' % hostname | ||
529 | 111 | |||
530 | 112 | print 'Bazaar versions:' | ||
531 | 113 | check_call(['bzr', 'version']) | ||
532 | 114 | check_call(['bzr', 'plugins']) | ||
533 | 115 | |||
534 | 116 | print 'Building recipe:' | ||
535 | 117 | print recipe | ||
536 | 118 | sys.stdout.flush() | ||
537 | 119 | env = { | ||
538 | 120 | 'DEBEMAIL': self.author_email, | ||
539 | 121 | 'DEBFULLNAME': self.author_name.encode('utf-8'), | ||
540 | 122 | 'BZR_EMAIL': bzr_email} | ||
541 | 123 | retcode = call_report_rusage([ | ||
542 | 124 | 'bzr', 'dailydeb', '--safe', '--no-build', recipe_path, | ||
543 | 125 | self.tree_path, '--manifest', manifest_path, | ||
544 | 126 | '--allow-fallback-to-native', '--append-version', | ||
545 | 127 | '~%s1' % self.distroseries_name], env=env) | ||
546 | 128 | if retcode != 0: | ||
547 | 129 | return retcode | ||
548 | 130 | (source,) = [name for name in os.listdir(self.tree_path) | ||
549 | 131 | if name != 'manifest'] | ||
550 | 132 | self.source_dir_relative = os.path.join( | ||
551 | 133 | self.work_dir_relative, 'tree', source) | ||
552 | 134 | return retcode | ||
553 | 135 | |||
554 | 136 | def getPackageName(self): | ||
555 | 137 | source_dir = os.path.join( | ||
556 | 138 | self.chroot_path, self.source_dir_relative.lstrip('/')) | ||
557 | 139 | changelog = os.path.join(source_dir, 'debian/changelog') | ||
558 | 140 | return open(changelog, 'r').readline().split(' ')[0] | ||
559 | 141 | |||
560 | 142 | def installBuildDeps(self): | ||
561 | 143 | """Install the build-depends of the source tree.""" | ||
562 | 144 | package = self.getPackageName() | ||
563 | 145 | currently_building_path = os.path.join( | ||
564 | 146 | self.chroot_path, 'CurrentlyBuilding') | ||
565 | 147 | currently_building_contents = ( | ||
566 | 148 | 'Package: %s\n' | ||
567 | 149 | 'Suite: %s\n' | ||
568 | 150 | 'Component: %s\n' | ||
569 | 151 | 'Purpose: %s\n' | ||
570 | 152 | 'Build-Debug-Symbols: no\n' % | ||
571 | 153 | (package, self.suite, self.component, self.archive_purpose)) | ||
572 | 154 | currently_building = open(currently_building_path, 'w') | ||
573 | 155 | currently_building.write(currently_building_contents) | ||
574 | 156 | currently_building.close() | ||
575 | 157 | return self.chroot(['sh', '-c', 'cd %s &&' | ||
576 | 158 | '/usr/lib/pbuilder/pbuilder-satisfydepends' | ||
577 | 159 | % self.source_dir_relative]) | ||
578 | 160 | |||
579 | 161 | def chroot(self, args, echo=False): | ||
580 | 162 | """Run a command in the chroot. | ||
581 | 163 | |||
582 | 164 | :param args: the command and arguments to run. | ||
583 | 165 | :return: the status code. | ||
584 | 166 | """ | ||
585 | 167 | if echo: | ||
586 | 168 | print "Running in chroot: %s" % ' '.join( | ||
587 | 169 | "'%s'" % arg for arg in args) | ||
588 | 170 | sys.stdout.flush() | ||
589 | 171 | return call([ | ||
590 | 172 | '/usr/bin/sudo', '/usr/sbin/chroot', self.chroot_path] + args) | ||
591 | 173 | |||
592 | 174 | def buildSourcePackage(self): | ||
593 | 175 | """Build the source package. | ||
594 | 176 | |||
595 | 177 | :return: a retcode from dpkg-buildpackage. | ||
596 | 178 | """ | ||
597 | 179 | retcode = self.chroot([ | ||
598 | 180 | 'su', '-c', 'cd %s && /usr/bin/dpkg-buildpackage -i -I -us -uc -S' | ||
599 | 181 | % self.source_dir_relative, self.username]) | ||
600 | 182 | for filename in os.listdir(self.tree_path): | ||
601 | 183 | path = os.path.join(self.tree_path, filename) | ||
602 | 184 | if os.path.isfile(path): | ||
603 | 185 | os.rename(path, get_build_path(self.build_id, filename)) | ||
604 | 186 | return retcode | ||
605 | 187 | |||
606 | 188 | |||
607 | 189 | def get_build_path(build_id, *extra): | ||
608 | 190 | """Generate a path within the build directory. | ||
609 | 191 | |||
610 | 192 | :param build_id: the build id to use. | ||
611 | 193 | :param extra: the extra path segments within the build directory. | ||
612 | 194 | :return: the generated path. | ||
613 | 195 | """ | ||
614 | 196 | return os.path.join( | ||
615 | 197 | os.environ["HOME"], "build-" + build_id, *extra) | ||
616 | 198 | |||
617 | 199 | |||
618 | 200 | def ensure_virtualized(): | ||
619 | 201 | """Raise an exception if not running in a virtualized environment. | ||
620 | 202 | |||
621 | 203 | Raises if not running under Xen. | ||
622 | 204 | """ | ||
623 | 205 | if not os.path.isdir('/proc/xen') or os.path.exists('/proc/xen/xsd_kva'): | ||
624 | 206 | raise NotVirtualized() | ||
625 | 207 | |||
626 | 208 | |||
627 | 209 | if __name__ == '__main__': | ||
628 | 210 | setrlimit(RLIMIT_AS, (1000000000, -1)) | ||
629 | 211 | builder = RecipeBuilder(*sys.argv[1:]) | ||
630 | 212 | if builder.buildTree() != 0: | ||
631 | 213 | sys.exit(RETCODE_FAILURE_BUILD_TREE) | ||
632 | 214 | if builder.install() != 0: | ||
633 | 215 | sys.exit(RETCODE_FAILURE_INSTALL) | ||
634 | 216 | if builder.installBuildDeps() != 0: | ||
635 | 217 | sys.exit(RETCODE_FAILURE_INSTALL_BUILD_DEPS) | ||
636 | 218 | if builder.buildSourcePackage() != 0: | ||
637 | 219 | sys.exit(RETCODE_FAILURE_BUILD_SOURCE_PACKAGE) | ||
638 | 220 | sys.exit(RETCODE_SUCCESS) | ||
639 | 221 | 0 | ||
640 | === removed file 'lib/canonical/buildd/check-implicit-pointer-functions' | |||
641 | --- lib/canonical/buildd/check-implicit-pointer-functions 2011-11-17 22:06:34 +0000 | |||
642 | +++ lib/canonical/buildd/check-implicit-pointer-functions 1970-01-01 00:00:00 +0000 | |||
643 | @@ -1,118 +0,0 @@ | |||
644 | 1 | #!/usr/bin/env python | ||
645 | 2 | |||
646 | 3 | # | ||
647 | 4 | # Copyright (c) 2004 Hewlett-Packard Development Company, L.P. | ||
648 | 5 | # David Mosberger <davidm@hpl.hp.com> | ||
649 | 6 | # Copyright 2010 Canonical Ltd. | ||
650 | 7 | # | ||
651 | 8 | # Permission is hereby granted, free of charge, to any person | ||
652 | 9 | # obtaining a copy of this software and associated documentation | ||
653 | 10 | # files (the "Software"), to deal in the Software without | ||
654 | 11 | # restriction, including without limitation the rights to use, | ||
655 | 12 | # copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
656 | 13 | # copies of the Software, and to permit persons to whom the | ||
657 | 14 | # Software is furnished to do so, subject to the following | ||
658 | 15 | # conditions: | ||
659 | 16 | # | ||
660 | 17 | # The above copyright notice and this permission notice shall be | ||
661 | 18 | # included in all copies or substantial portions of the Software. | ||
662 | 19 | # | ||
663 | 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
664 | 21 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
665 | 22 | # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
666 | 23 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
667 | 24 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
668 | 25 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
669 | 26 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
670 | 27 | # OTHER DEALINGS IN THE SOFTWARE. | ||
671 | 28 | |||
672 | 29 | # Scan standard input for GCC warning messages that are likely to | ||
673 | 30 | # source of real 64-bit problems. In particular, see whether there | ||
674 | 31 | # are any implicitly declared functions whose return values are later | ||
675 | 32 | # interpreted as pointers. Those are almost guaranteed to cause | ||
676 | 33 | # crashes. | ||
677 | 34 | # | ||
678 | 35 | import re | ||
679 | 36 | import sys | ||
680 | 37 | |||
681 | 38 | implicit_pattern = re.compile( | ||
682 | 39 | "([^:]*):(\d+):(\d+:)? warning: implicit declaration " | ||
683 | 40 | "of function [`']([^']*)'") | ||
684 | 41 | pointer_pattern = re.compile( | ||
685 | 42 | "([^:]*):(\d+):(\d+:)? warning: " | ||
686 | 43 | + "(" | ||
687 | 44 | + "(assignment" | ||
688 | 45 | + "|initialization" | ||
689 | 46 | + "|return" | ||
690 | 47 | + "|passing arg \d+ of `[^']*'" | ||
691 | 48 | + "|passing arg \d+ of pointer to function" | ||
692 | 49 | + ") makes pointer from integer without a cast" | ||
693 | 50 | + "|" | ||
694 | 51 | + "cast to pointer from integer of different size)") | ||
695 | 52 | |||
696 | 53 | def main(): | ||
697 | 54 | last_implicit_filename = "" | ||
698 | 55 | last_implicit_linenum = -1 | ||
699 | 56 | last_implicit_func = "" | ||
700 | 57 | |||
701 | 58 | errlist = "" | ||
702 | 59 | |||
703 | 60 | in_line = False | ||
704 | 61 | warn_only = False | ||
705 | 62 | |||
706 | 63 | for arg in sys.argv[1:]: | ||
707 | 64 | if arg == '--inline': | ||
708 | 65 | in_line = True | ||
709 | 66 | elif arg == '--warnonly': | ||
710 | 67 | warn_only = True | ||
711 | 68 | |||
712 | 69 | rv = 0 | ||
713 | 70 | while True: | ||
714 | 71 | line = sys.stdin.readline() | ||
715 | 72 | if in_line: | ||
716 | 73 | sys.stdout.write(line) | ||
717 | 74 | sys.stdout.flush() | ||
718 | 75 | if line == '': | ||
719 | 76 | break | ||
720 | 77 | m = implicit_pattern.match(line) | ||
721 | 78 | if m: | ||
722 | 79 | last_implicit_filename = m.group(1) | ||
723 | 80 | last_implicit_linenum = int(m.group(2)) | ||
724 | 81 | last_implicit_func = m.group(4) | ||
725 | 82 | else: | ||
726 | 83 | m = pointer_pattern.match(line) | ||
727 | 84 | if m: | ||
728 | 85 | pointer_filename = m.group(1) | ||
729 | 86 | pointer_linenum = int(m.group(2)) | ||
730 | 87 | if (last_implicit_filename == pointer_filename | ||
731 | 88 | and last_implicit_linenum == pointer_linenum): | ||
732 | 89 | err = "Function `%s' implicitly converted to pointer at " \ | ||
733 | 90 | "%s:%d" % (last_implicit_func, last_implicit_filename, | ||
734 | 91 | last_implicit_linenum) | ||
735 | 92 | errlist += err+"\n" | ||
736 | 93 | print err | ||
737 | 94 | if not warn_only: | ||
738 | 95 | rv = 3 | ||
739 | 96 | |||
740 | 97 | if len(errlist): | ||
741 | 98 | if in_line: | ||
742 | 99 | print errlist | ||
743 | 100 | print """ | ||
744 | 101 | |||
745 | 102 | Our automated build log filter detected the problem(s) above that will | ||
746 | 103 | likely cause your package to segfault on architectures where the size of | ||
747 | 104 | a pointer is greater than the size of an integer, such as ia64 and amd64. | ||
748 | 105 | |||
749 | 106 | This is often due to a missing function prototype definition. | ||
750 | 107 | |||
751 | 108 | Since use of implicitly converted pointers is always fatal to the application | ||
752 | 109 | on ia64, they are errors. Please correct them for your next upload. | ||
753 | 110 | |||
754 | 111 | More information can be found at: | ||
755 | 112 | http://wiki.debian.org/ImplicitPointerConversions | ||
756 | 113 | |||
757 | 114 | """ | ||
758 | 115 | sys.exit(rv) | ||
759 | 116 | |||
760 | 117 | if __name__ == '__main__': | ||
761 | 118 | main() | ||
762 | 119 | 0 | ||
763 | === removed symlink 'lib/canonical/buildd/check_implicit_pointer_functions.py' | |||
764 | === target was u'check-implicit-pointer-functions' | |||
765 | === removed directory 'lib/canonical/buildd/debian' | |||
766 | === removed file 'lib/canonical/buildd/debian.py' | |||
767 | --- lib/canonical/buildd/debian.py 2011-11-17 22:06:34 +0000 | |||
768 | +++ lib/canonical/buildd/debian.py 1970-01-01 00:00:00 +0000 | |||
769 | @@ -1,239 +0,0 @@ | |||
770 | 1 | # Copyright 2009, 2010 Canonical Ltd. This software is licensed under the | ||
771 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
772 | 3 | |||
773 | 4 | # Authors: Daniel Silverstone <daniel.silverstone@canonical.com> | ||
774 | 5 | # and Adam Conrad <adam.conrad@canonical.com> | ||
775 | 6 | |||
776 | 7 | # Buildd Slave sbuild manager implementation | ||
777 | 8 | |||
778 | 9 | __metaclass__ = type | ||
779 | 10 | |||
780 | 11 | import os | ||
781 | 12 | |||
782 | 13 | from canonical.buildd.slave import ( | ||
783 | 14 | BuildManager, | ||
784 | 15 | ) | ||
785 | 16 | |||
786 | 17 | |||
787 | 18 | class DebianBuildState: | ||
788 | 19 | """States for the DebianBuildManager.""" | ||
789 | 20 | INIT = "INIT" | ||
790 | 21 | UNPACK = "UNPACK" | ||
791 | 22 | MOUNT = "MOUNT" | ||
792 | 23 | SOURCES = "SOURCES" | ||
793 | 24 | UPDATE = "UPDATE" | ||
794 | 25 | REAP = "REAP" | ||
795 | 26 | UMOUNT = "UMOUNT" | ||
796 | 27 | CLEANUP = "CLEANUP" | ||
797 | 28 | |||
798 | 29 | |||
799 | 30 | class DebianBuildManager(BuildManager): | ||
800 | 31 | """Base behaviour for Debian chrooted builds.""" | ||
801 | 32 | |||
802 | 33 | def __init__(self, slave, buildid): | ||
803 | 34 | BuildManager.__init__(self, slave, buildid) | ||
804 | 35 | self._updatepath = slave._config.get("debianmanager", "updatepath") | ||
805 | 36 | self._scanpath = slave._config.get("debianmanager", "processscanpath") | ||
806 | 37 | self._sourcespath = slave._config.get("debianmanager", "sourcespath") | ||
807 | 38 | self._cachepath = slave._config.get("slave","filecache") | ||
808 | 39 | self._state = DebianBuildState.INIT | ||
809 | 40 | slave.emptyLog() | ||
810 | 41 | self.alreadyfailed = False | ||
811 | 42 | |||
812 | 43 | @property | ||
813 | 44 | def initial_build_state(self): | ||
814 | 45 | raise NotImplementedError() | ||
815 | 46 | |||
816 | 47 | def initiate(self, files, chroot, extra_args): | ||
817 | 48 | """Initiate a build with a given set of files and chroot.""" | ||
818 | 49 | |||
819 | 50 | self.arch_tag = extra_args.get('arch_tag', self._slave.getArch()) | ||
820 | 51 | self.sources_list = extra_args.get('archives') | ||
821 | 52 | |||
822 | 53 | BuildManager.initiate(self, files, chroot, extra_args) | ||
823 | 54 | |||
824 | 55 | def doSourcesList(self): | ||
825 | 56 | """Override apt/sources.list. | ||
826 | 57 | |||
827 | 58 | Mainly used for PPA builds. | ||
828 | 59 | """ | ||
829 | 60 | args = ["override-sources-list", self._buildid] | ||
830 | 61 | args.extend(self.sources_list) | ||
831 | 62 | self.runSubProcess(self._sourcespath, args) | ||
832 | 63 | |||
833 | 64 | def doUpdateChroot(self): | ||
834 | 65 | """Perform the chroot upgrade.""" | ||
835 | 66 | self.runSubProcess( | ||
836 | 67 | self._updatepath, | ||
837 | 68 | ["update-debian-chroot", self._buildid, self.arch_tag]) | ||
838 | 69 | |||
839 | 70 | def doRunBuild(self): | ||
840 | 71 | """Run the main build process. | ||
841 | 72 | |||
842 | 73 | Subclasses must override this. | ||
843 | 74 | """ | ||
844 | 75 | raise NotImplementedError() | ||
845 | 76 | |||
846 | 77 | def doReapProcesses(self): | ||
847 | 78 | """Reap any processes left lying around in the chroot.""" | ||
848 | 79 | self.runSubProcess( self._scanpath, [self._scanpath, self._buildid] ) | ||
849 | 80 | |||
850 | 81 | @staticmethod | ||
851 | 82 | def _parseChangesFile(linesIter): | ||
852 | 83 | """A generator that iterates over files listed in a changes file. | ||
853 | 84 | |||
854 | 85 | :param linesIter: an iterable of lines in a changes file. | ||
855 | 86 | """ | ||
856 | 87 | seenfiles = False | ||
857 | 88 | for line in linesIter: | ||
858 | 89 | if line.endswith("\n"): | ||
859 | 90 | line = line[:-1] | ||
860 | 91 | if not seenfiles and line.startswith("Files:"): | ||
861 | 92 | seenfiles = True | ||
862 | 93 | elif seenfiles: | ||
863 | 94 | if not line.startswith(' '): | ||
864 | 95 | break | ||
865 | 96 | filename = line.split(' ')[-1] | ||
866 | 97 | yield filename | ||
867 | 98 | |||
868 | 99 | def getChangesFilename(self): | ||
869 | 100 | changes = self._dscfile[:-4] + "_" + self.arch_tag + ".changes" | ||
870 | 101 | return get_build_path(self._buildid, changes) | ||
871 | 102 | |||
872 | 103 | def gatherResults(self): | ||
873 | 104 | """Gather the results of the build and add them to the file cache. | ||
874 | 105 | |||
875 | 106 | The primary file we care about is the .changes file. We key from there. | ||
876 | 107 | """ | ||
877 | 108 | path = self.getChangesFilename() | ||
878 | 109 | name = os.path.basename(path) | ||
879 | 110 | chfile = open(path, "r") | ||
880 | 111 | self._slave.waitingfiles[name] = self._slave.storeFile(chfile.read()) | ||
881 | 112 | chfile.seek(0) | ||
882 | 113 | seenfiles = False | ||
883 | 114 | |||
884 | 115 | for fn in self._parseChangesFile(chfile): | ||
885 | 116 | self._slave.addWaitingFile(get_build_path(self._buildid, fn)) | ||
886 | 117 | |||
887 | 118 | chfile.close() | ||
888 | 119 | |||
889 | 120 | def iterate(self, success): | ||
890 | 121 | # When a Twisted ProcessControl class is killed by SIGTERM, | ||
891 | 122 | # which we call 'build process aborted', 'None' is returned as | ||
892 | 123 | # exit_code. | ||
893 | 124 | print ("Iterating with success flag %s against stage %s" | ||
894 | 125 | % (success, self._state)) | ||
895 | 126 | func = getattr(self, "iterate_" + self._state, None) | ||
896 | 127 | if func is None: | ||
897 | 128 | raise ValueError, "Unknown internal state " + self._state | ||
898 | 129 | func(success) | ||
899 | 130 | |||
900 | 131 | def iterate_INIT(self, success): | ||
901 | 132 | """Just finished initializing the build.""" | ||
902 | 133 | if success != 0: | ||
903 | 134 | if not self.alreadyfailed: | ||
904 | 135 | # The init failed, can't fathom why that would be... | ||
905 | 136 | self._slave.builderFail() | ||
906 | 137 | self.alreadyfailed = True | ||
907 | 138 | self._state = DebianBuildState.CLEANUP | ||
908 | 139 | self.doCleanup() | ||
909 | 140 | else: | ||
910 | 141 | self._state = DebianBuildState.UNPACK | ||
911 | 142 | self.doUnpack() | ||
912 | 143 | |||
913 | 144 | def iterate_UNPACK(self, success): | ||
914 | 145 | """Just finished unpacking the tarball.""" | ||
915 | 146 | if success != 0: | ||
916 | 147 | if not self.alreadyfailed: | ||
917 | 148 | # The unpack failed for some reason... | ||
918 | 149 | self._slave.chrootFail() | ||
919 | 150 | self.alreadyfailed = True | ||
920 | 151 | self._state = DebianBuildState.CLEANUP | ||
921 | 152 | self.doCleanup() | ||
922 | 153 | else: | ||
923 | 154 | self._state = DebianBuildState.MOUNT | ||
924 | 155 | self.doMounting() | ||
925 | 156 | |||
926 | 157 | def iterate_MOUNT(self, success): | ||
927 | 158 | """Just finished doing the mounts.""" | ||
928 | 159 | if success != 0: | ||
929 | 160 | if not self.alreadyfailed: | ||
930 | 161 | self._slave.chrootFail() | ||
931 | 162 | self.alreadyfailed = True | ||
932 | 163 | self._state = DebianBuildState.UMOUNT | ||
933 | 164 | self.doUnmounting() | ||
934 | 165 | else: | ||
935 | 166 | if self.sources_list is not None: | ||
936 | 167 | self._state = DebianBuildState.SOURCES | ||
937 | 168 | self.doSourcesList() | ||
938 | 169 | else: | ||
939 | 170 | self._state = DebianBuildState.UPDATE | ||
940 | 171 | self.doUpdateChroot() | ||
941 | 172 | |||
942 | 173 | def getTmpLogContents(self): | ||
943 | 174 | try: | ||
944 | 175 | tmpLogHandle = open(os.path.join(self._cachepath, "buildlog")) | ||
945 | 176 | return tmpLogHandle.read() | ||
946 | 177 | finally: | ||
947 | 178 | tmpLogHandle.close() | ||
948 | 179 | |||
949 | 180 | def iterate_SOURCES(self, success): | ||
950 | 181 | """Just finished overwriting sources.list.""" | ||
951 | 182 | if success != 0: | ||
952 | 183 | if not self.alreadyfailed: | ||
953 | 184 | self._slave.chrootFail() | ||
954 | 185 | self.alreadyfailed = True | ||
955 | 186 | self._state = DebianBuildState.REAP | ||
956 | 187 | self.doReapProcesses() | ||
957 | 188 | else: | ||
958 | 189 | self._state = DebianBuildState.UPDATE | ||
959 | 190 | self.doUpdateChroot() | ||
960 | 191 | |||
961 | 192 | def iterate_UPDATE(self, success): | ||
962 | 193 | """Just finished updating the chroot.""" | ||
963 | 194 | if success != 0: | ||
964 | 195 | if not self.alreadyfailed: | ||
965 | 196 | self._slave.chrootFail() | ||
966 | 197 | self.alreadyfailed = True | ||
967 | 198 | self._state = DebianBuildState.REAP | ||
968 | 199 | self.doReapProcesses() | ||
969 | 200 | else: | ||
970 | 201 | self._state = self.initial_build_state | ||
971 | 202 | self.doRunBuild() | ||
972 | 203 | |||
973 | 204 | def iterate_REAP(self, success): | ||
974 | 205 | """Finished reaping processes; ignore error returns.""" | ||
975 | 206 | self._state = DebianBuildState.UMOUNT | ||
976 | 207 | self.doUnmounting() | ||
977 | 208 | |||
978 | 209 | def iterate_UMOUNT(self, success): | ||
979 | 210 | """Just finished doing the unmounting.""" | ||
980 | 211 | if success != 0: | ||
981 | 212 | if not self.alreadyfailed: | ||
982 | 213 | self._slave.builderFail() | ||
983 | 214 | self.alreadyfailed = True | ||
984 | 215 | self._state = DebianBuildState.CLEANUP | ||
985 | 216 | self.doCleanup() | ||
986 | 217 | |||
987 | 218 | def iterate_CLEANUP(self, success): | ||
988 | 219 | """Just finished the cleanup.""" | ||
989 | 220 | if success != 0: | ||
990 | 221 | if not self.alreadyfailed: | ||
991 | 222 | self._slave.builderFail() | ||
992 | 223 | self.alreadyfailed = True | ||
993 | 224 | else: | ||
994 | 225 | # Successful clean | ||
995 | 226 | if not self.alreadyfailed: | ||
996 | 227 | self._slave.buildOK() | ||
997 | 228 | self._slave.buildComplete() | ||
998 | 229 | |||
999 | 230 | |||
1000 | 231 | def get_build_path(build_id, *extra): | ||
1001 | 232 | """Generate a path within the build directory. | ||
1002 | 233 | |||
1003 | 234 | :param build_id: the build id to use. | ||
1004 | 235 | :param extra: the extra path segments within the build directory. | ||
1005 | 236 | :return: the generated path. | ||
1006 | 237 | """ | ||
1007 | 238 | return os.path.join( | ||
1008 | 239 | os.environ["HOME"], "build-" + build_id, *extra) | ||
1009 | 240 | 0 | ||
1010 | === removed file 'lib/canonical/buildd/debian/changelog' | |||
1011 | --- lib/canonical/buildd/debian/changelog 2011-11-17 22:06:34 +0000 | |||
1012 | +++ lib/canonical/buildd/debian/changelog 1970-01-01 00:00:00 +0000 | |||
1013 | @@ -1,698 +0,0 @@ | |||
1014 | 1 | launchpad-buildd (82) hardy-cat; urgency=low | ||
1015 | 2 | |||
1016 | 3 | * Cut out readyservice from the buildds. LP: #800295 | ||
1017 | 4 | * buildrecipe shows the bzr and bzr-builder versions. LP: #884092 | ||
1018 | 5 | * buildrecipe shows bzr rusage. LP: 884997 | ||
1019 | 6 | |||
1020 | 7 | -- Martin Pool <mbp@canonical.com> Thu, 03 Nov 2011 17:11:25 +1100 | ||
1021 | 8 | |||
1022 | 9 | launchpad-buildd (81) hardy-cat; urgency=low | ||
1023 | 10 | |||
1024 | 11 | * generate-translation-templates: switch to Python 2.7. | ||
1025 | 12 | |||
1026 | 13 | -- Danilo Å egan <danilo@canonical.com> Mon, 17 Oct 2011 14:46:13 +0200 | ||
1027 | 14 | |||
1028 | 15 | launchpad-buildd (80) hardy-cat; urgency=low | ||
1029 | 16 | |||
1030 | 17 | * binfmt-support demonstrated umount ordering issues for us. LP: #851934 | ||
1031 | 18 | |||
1032 | 19 | -- LaMont Jones <lamont@canonical.com> Mon, 19 Sep 2011 04:56:58 -0600 | ||
1033 | 20 | |||
1034 | 21 | launchpad-buildd (79) hardy-cat; urgency=low | ||
1035 | 22 | |||
1036 | 23 | * Fix sudoers.d/buildd permissions | ||
1037 | 24 | |||
1038 | 25 | -- LaMont Jones <lamont@canonical.com> Fri, 19 Aug 2011 07:31:54 -0600 | ||
1039 | 26 | |||
1040 | 27 | launchpad-buildd (78) hardy-cat; urgency=low | ||
1041 | 28 | |||
1042 | 29 | * Correctly update sudoers files when needed. LP: #742881 | ||
1043 | 30 | |||
1044 | 31 | -- LaMont Jones <lamont@canonical.com> Wed, 06 Apr 2011 22:20:17 -0600 | ||
1045 | 32 | |||
1046 | 33 | launchpad-buildd (77) hardy-cat; urgency=low | ||
1047 | 34 | |||
1048 | 35 | * Add back in ultimate-backstop umask() correction. | ||
1049 | 36 | |||
1050 | 37 | -- LaMont Jones <lamont@canonical.com> Wed, 06 Apr 2011 13:34:05 -0600 | ||
1051 | 38 | |||
1052 | 39 | launchpad-buildd (76) hardy-cat; urgency=low | ||
1053 | 40 | |||
1054 | 41 | [ various ] | ||
1055 | 42 | * ProjectGroup.products sort order and remove Author: comments. | ||
1056 | 43 | * Fix some tests to not print stuff | ||
1057 | 44 | * Make buildd pointer check regexes work on natty | ||
1058 | 45 | * merge before rollout + text conflict patch by wgrant | ||
1059 | 46 | |||
1060 | 47 | -- LaMont Jones <lamont@canonical.com> Tue, 15 Mar 2011 16:59:36 -0600 | ||
1061 | 48 | |||
1062 | 49 | launchpad-buildd (74) hardy-cat; urgency=low | ||
1063 | 50 | |||
1064 | 51 | [ Aaron Bentley] | ||
1065 | 52 | * Memory-limit recipe builds. LP#676657 | ||
1066 | 53 | |||
1067 | 54 | [ LaMont Jones] | ||
1068 | 55 | * mount a tmpfs on /dev/shm in build chroots. LP#671441 | ||
1069 | 56 | |||
1070 | 57 | [Michael Bienia] | ||
1071 | 58 | * Update regexes used for DEPWAIT. LP#615286 | ||
1072 | 59 | |||
1073 | 60 | -- LaMont Jones <lamont@canonical.com> Tue, 23 Nov 2010 06:17:57 -0700 | ||
1074 | 61 | |||
1075 | 62 | launchpad-buildd (73) hardy-cat; urgency=low | ||
1076 | 63 | |||
1077 | 64 | * Revert to revision 70 | ||
1078 | 65 | |||
1079 | 66 | -- LaMont Jones <lamont@canonical.com> Thu, 28 Oct 2010 12:53:45 -0600 | ||
1080 | 67 | |||
1081 | 68 | launchpad-buildd (72) hardy-cat; urgency=low | ||
1082 | 69 | |||
1083 | 70 | * break out readyservice.py from tachandler.py. LP#663828 | ||
1084 | 71 | |||
1085 | 72 | -- LaMont Jones <lamont@canonical.com> Wed, 20 Oct 2010 13:03:23 -0600 | ||
1086 | 73 | |||
1087 | 74 | launchpad-buildd (71) hardy-cat; urgency=low | ||
1088 | 75 | |||
1089 | 76 | * Detect ppa hosts for build recipes. LP#662664 | ||
1090 | 77 | * Better recipe builds. LP#599100, 627119, 479705 | ||
1091 | 78 | |||
1092 | 79 | -- LaMont Jones <lamont@canonical.com> Tue, 19 Oct 2010 13:48:33 -0600 | ||
1093 | 80 | |||
1094 | 81 | launchpad-buildd (70) hardy-cat; urgency=low | ||
1095 | 82 | |||
1096 | 83 | [ LaMont Jones ] | ||
1097 | 84 | * Restore the rest of version 68. | ||
1098 | 85 | |||
1099 | 86 | [ James Westby ] | ||
1100 | 87 | * buildrecipe: Specify BZR_EMAIL via sudo so that the called command | ||
1101 | 88 | sees the environment variable. | ||
1102 | 89 | * buildrecipe: call sudo -i -u instead of sudo -iu so that it works with | ||
1103 | 90 | older versions of sudo. | ||
1104 | 91 | * buildrecipe: flush stdout before calling another command so that | ||
1105 | 92 | the build log has the output correctly interleaved. | ||
1106 | 93 | |||
1107 | 94 | [ William Grant ] | ||
1108 | 95 | * correct arch_tag arguments. | ||
1109 | 96 | |||
1110 | 97 | -- LaMont Jones <lamont@canonical.com> Fri, 20 Aug 2010 13:27:55 -0600 | ||
1111 | 98 | |||
1112 | 99 | launchpad-buildd (69) hardy-cat; urgency=low | ||
1113 | 100 | |||
1114 | 101 | * REVERT all of version 68 except for BZR_EMAIL LP#617072 | ||
1115 | 102 | (Not reflected in bzr.) | ||
1116 | 103 | |||
1117 | 104 | -- LaMont Jones <lamont@canonical.com> Tue, 17 Aug 2010 10:40:03 -0600 | ||
1118 | 105 | |||
1119 | 106 | launchpad-buildd (68) hardy-cat; urgency=low | ||
1120 | 107 | |||
1121 | 108 | [ William Grant ] | ||
1122 | 109 | * Take an 'arch_tag' argument, so the master can override the slave | ||
1123 | 110 | architecture. | ||
1124 | 111 | |||
1125 | 112 | [ Jelmer Vernooij ] | ||
1126 | 113 | |||
1127 | 114 | * Explicitly use source format 1.0. | ||
1128 | 115 | * Add LSB information to init script. | ||
1129 | 116 | * Use debhelper >= 5 (available in dapper, not yet deprecated in | ||
1130 | 117 | maverick). | ||
1131 | 118 | * Fix spelling in description. | ||
1132 | 119 | * Install example buildd configuration. | ||
1133 | 120 | |||
1134 | 121 | [ Paul Hummer ] | ||
1135 | 122 | * Provide BZR_EMAIL for bzr 2.2 in the buildds LP#617072 | ||
1136 | 123 | |||
1137 | 124 | -- LaMont Jones <lamont@canonical.com> Mon, 16 Aug 2010 13:25:09 -0600 | ||
1138 | 125 | |||
1139 | 126 | launchpad-buildd (67) hardy-cat; urgency=low | ||
1140 | 127 | |||
1141 | 128 | * Force aptitude installation for recipe builds on maverick | ||
1142 | 129 | |||
1143 | 130 | -- LaMont Jones <lamont@canonical.com> Fri, 23 Jul 2010 14:22:23 -0600 | ||
1144 | 131 | |||
1145 | 132 | launchpad-buildd (66) hardy-cat; urgency=low | ||
1146 | 133 | |||
1147 | 134 | * handle [linux-any] build-dependencies. LP#604981 | ||
1148 | 135 | |||
1149 | 136 | -- LaMont Jones <lamont@canonical.com> Mon, 19 Jul 2010 12:13:31 -0600 | ||
1150 | 137 | |||
1151 | 138 | launchpad-buildd (65) hardy-cat; urgency=low | ||
1152 | 139 | |||
1153 | 140 | * Drop preinst check, since human time does not scale across a large | ||
1154 | 141 | rollout. soyuz just needs to deal with upgrades mid-build better. | ||
1155 | 142 | |||
1156 | 143 | -- LaMont Jones <lamont@canonical.com> Thu, 08 Jul 2010 05:04:02 -0600 | ||
1157 | 144 | |||
1158 | 145 | launchpad-buildd (64) hardy-cat; urgency=low | ||
1159 | 146 | |||
1160 | 147 | * Pottery now strips quotes from variables. | ||
1161 | 148 | |||
1162 | 149 | -- Jeroen Vermeulen <jtv@canonical.com> Wed, 30 Jun 2010 12:50:59 +0200 | ||
1163 | 150 | |||
1164 | 151 | launchpad-buildd (63) hardy-cat; urgency=low | ||
1165 | 152 | |||
1166 | 153 | * Drop apply-ogre-model, since override-sources-list replaced it three years | ||
1167 | 154 | ago. Also clean up extra_args parsing a bit. | ||
1168 | 155 | |||
1169 | 156 | -- William Grant <wgrant@ubuntu.com> Sat, 12 Jun 2010 11:33:11 +1000 | ||
1170 | 157 | |||
1171 | 158 | launchpad-buildd (62) hardy-cat; urgency=low | ||
1172 | 159 | |||
1173 | 160 | * Make the buildds cope with not having a sourcepackagename LP#587109 | ||
1174 | 161 | |||
1175 | 162 | -- LaMont Jones <lamont@canonical.com> Tue, 08 Jun 2010 13:02:31 -0600 | ||
1176 | 163 | |||
1177 | 164 | launchpad-buildd (61) hardy-cat; urgency=high | ||
1178 | 165 | |||
1179 | 166 | [ William Grant ] | ||
1180 | 167 | * Fixed translation templates slave to return files properly. LP#549422 | ||
1181 | 168 | |||
1182 | 169 | [ Danilo Segan ] | ||
1183 | 170 | * Added more output to generate-translation-templates. LP#580345 | ||
1184 | 171 | |||
1185 | 172 | [ Henning Eggers ] | ||
1186 | 173 | * Improved output of build xmplrpc call, not returning None now. LP#581746 | ||
1187 | 174 | * Added apache2 dependency. LP#557634 | ||
1188 | 175 | * Added preinst script to prevent installation when a build is running. | ||
1189 | 176 | LP#557347 | ||
1190 | 177 | |||
1191 | 178 | [ LaMont Jones ] | ||
1192 | 179 | * preinst needs to detect a stale buildlog as well. | ||
1193 | 180 | |||
1194 | 181 | -- LaMont Jones <lamont@canonical.com> Fri, 21 May 2010 05:52:53 -0600 | ||
1195 | 182 | |||
1196 | 183 | launchpad-buildd (60) lucid-cat; urgency=low | ||
1197 | 184 | |||
1198 | 185 | * Depends: lsb-release, which is ubuntu-minimal, but not essential. | ||
1199 | 186 | |||
1200 | 187 | -- LaMont Jones <lamont@ubuntu.com> Thu, 01 Apr 2010 08:54:48 -0600 | ||
1201 | 188 | |||
1202 | 189 | launchpad-buildd (59) lucid-cat; urgency=low | ||
1203 | 190 | |||
1204 | 191 | [ Henning Eggers ] | ||
1205 | 192 | * Added translation template generation code (pottery). | ||
1206 | 193 | |||
1207 | 194 | [ LaMont Jones ] | ||
1208 | 195 | * set umask for twisted where supported | ||
1209 | 196 | |||
1210 | 197 | -- LaMont Jones <lamont@canonical.com> Wed, 31 Mar 2010 10:38:15 -0600 | ||
1211 | 198 | |||
1212 | 199 | launchpad-buildd (58~1) karmic; urgency=low | ||
1213 | 200 | |||
1214 | 201 | * Misc fixes to match APIs. | ||
1215 | 202 | |||
1216 | 203 | -- Aaron Bentley <aaron@aaronbentley.com> Fri, 15 Jan 2010 10:03:07 +1300 | ||
1217 | 204 | |||
1218 | 205 | launchpad-buildd (58~0) karmic; urgency=low | ||
1219 | 206 | |||
1220 | 207 | * Include buildrecipe.py. | ||
1221 | 208 | |||
1222 | 209 | -- Aaron Bentley <aaron@aaronbentley.com> Wed, 13 Jan 2010 17:06:59 +1300 | ||
1223 | 210 | |||
1224 | 211 | launchpad-buildd (57) hardy-cat; urgency=low | ||
1225 | 212 | |||
1226 | 213 | * Split the sbuild wrapper from DebianBuildManager into a new | ||
1227 | 214 | BinaryPackageBuildManager, and point the 'debian' builder at that | ||
1228 | 215 | instead. | ||
1229 | 216 | |||
1230 | 217 | -- William Grant <wgrant@ubuntu.com> Tue, 12 Jan 2010 09:22:50 +1300 | ||
1231 | 218 | |||
1232 | 219 | launchpad-buildd (56) hardy-cat; urgency=low | ||
1233 | 220 | |||
1234 | 221 | * only error out on implicit-function-pointers check on lucid or later, | ||
1235 | 222 | non-32-bit architectures. Warnings elsewhere. LP#504078 | ||
1236 | 223 | * drop use of ccache and /var/cache/apt/archives, since we don't use one, | ||
1237 | 224 | and the other is just plain silly. | ||
1238 | 225 | |||
1239 | 226 | -- LaMont Jones <lamont@canonical.com> Mon, 11 Jan 2010 13:12:49 -0700 | ||
1240 | 227 | |||
1241 | 228 | launchpad-buildd (54) hardy-cat; urgency=low | ||
1242 | 229 | |||
1243 | 230 | [ William Grant ] | ||
1244 | 231 | * debian.py: Tell sbuild to build debug symbols if the | ||
1245 | 232 | build_debug_symbols argument is True. | ||
1246 | 233 | * sbuild: Set "Build-Debug-Symbols: yes" in CurrentlyBuilding if | ||
1247 | 234 | we have been told to build debug symbols. | ||
1248 | 235 | |||
1249 | 236 | [ LaMont Jones ] | ||
1250 | 237 | * do not ignore SIGHUP in builds - it breaks test suites. LP#453460 | ||
1251 | 238 | * create filecache-default/ccache directories in init.d as well as postinst | ||
1252 | 239 | * sbuild: run dpkg-source inside the chroot. LP#476036 | ||
1253 | 240 | * sbuild: change the regexp for dpkg-source extraction to handle both karmic and pre-karmic dpkg. LP#476036 | ||
1254 | 241 | * use --print-architecture instead of --print-installation-architecture | ||
1255 | 242 | * mount-chroot: copy hosts et al into chroot. LP#447919 | ||
1256 | 243 | * provide and call check-implicit-function-pointers. | ||
1257 | 244 | |||
1258 | 245 | -- LaMont Jones <lamont@canonical.com> Mon, 14 Dec 2009 12:00:10 -0700 | ||
1259 | 246 | |||
1260 | 247 | launchpad-buildd (52) dapper-cat; urgency=low | ||
1261 | 248 | |||
1262 | 249 | * Depends: apt-transport-https | ||
1263 | 250 | |||
1264 | 251 | -- LaMont Jones <lamont@canonical.com> Fri, 09 Oct 2009 11:00:50 -0600 | ||
1265 | 252 | |||
1266 | 253 | launchpad-buildd (50) dapper-cat; urgency=low | ||
1267 | 254 | |||
1268 | 255 | * sbuild: Change all invocations of apt and dpkg to occur inside | ||
1269 | 256 | the build chroot, rather than happening outside the chroot with | ||
1270 | 257 | a bunch of flags to operate on data files in the chroot. This | ||
1271 | 258 | should clear up issues we see with mismatched host toolchains. | ||
1272 | 259 | * sbuild: Revert the above in the case of "apt-get source" which | ||
1273 | 260 | doesn't require any fancy features in the chroot and, frankly, | ||
1274 | 261 | is much easier to manage if it's executed externally. | ||
1275 | 262 | * scan-for-processes: Bring in a change from production to make | ||
1276 | 263 | sure that we follow symlinks in our search for process roots. | ||
1277 | 264 | * sbuild-package: Output NR_PROCESSORS in the build logs, for | ||
1278 | 265 | sightly easier debugging of possible parallel build bugs. | ||
1279 | 266 | * update-debian-chroot: Stop using chapt-get, and instead chroot | ||
1280 | 267 | into the build chroot and call the native apt-get there. | ||
1281 | 268 | * update-debian-chroot: Cargo-cult the linux32 magic from the | ||
1282 | 269 | sbuild wrapper to set our personality on chroot upgrades. | ||
1283 | 270 | * mount-chroot: Mount sys in the chroot too. While it shouldn't | ||
1284 | 271 | be, strictly-speaking, required for anything, it's nice to have. | ||
1285 | 272 | * chapt-get, slave_chroot_tool.py: Delete both as obsolete cruft. | ||
1286 | 273 | |||
1287 | 274 | -- Adam Conrad <adconrad@ubuntu.com> Fri, 24 Jul 2009 07:21:30 -0600 | ||
1288 | 275 | |||
1289 | 276 | launchpad-buildd (49) dapper-cat; urgency=low | ||
1290 | 277 | |||
1291 | 278 | * sbuild.conf: bump default automake from automake1.8 to automake1.9 | ||
1292 | 279 | |||
1293 | 280 | -- Adam Conrad <adconrad@ubuntu.com> Fri, 12 Sep 2008 08:54:24 -0600 | ||
1294 | 281 | |||
1295 | 282 | launchpad-buildd (48) dapper-cat; urgency=low | ||
1296 | 283 | |||
1297 | 284 | * sbuild-package: If we're an amd64 host system, but being used | ||
1298 | 285 | to build i386 or lpia, use linux32 to pretend to be i686. | ||
1299 | 286 | |||
1300 | 287 | -- Adam Conrad <adconrad@ubuntu.com> Fri, 12 Sep 2008 08:12:34 -0600 | ||
1301 | 288 | |||
1302 | 289 | launchpad-buildd (47) dapper-cat; urgency=low | ||
1303 | 290 | |||
1304 | 291 | * slave.py: If the logfile doesn't currently exist on disk when | ||
1305 | 292 | getLogTail() goes looking for it (which is a possible race with | ||
1306 | 293 | the new sanitisation code), just return an empty string. | ||
1307 | 294 | |||
1308 | 295 | -- Adam Conrad <adconrad@ubuntu.com> Mon, 02 Jun 2008 13:09:55 -0600 | ||
1309 | 296 | |||
1310 | 297 | launchpad-buildd (46) dapper-cat; urgency=low | ||
1311 | 298 | |||
1312 | 299 | * slave.py: Accept a separate username and password to the | ||
1313 | 300 | ensurePresent() call which, if present, are used to install | ||
1314 | 301 | an auth handler to cope with basic http auth with the http | ||
1315 | 302 | server when fetching files. | ||
1316 | 303 | * slave.py: Ensure that build logs are sanitized so that any | ||
1317 | 304 | user:password@ parts in URLs are removed. | ||
1318 | 305 | |||
1319 | 306 | -- Julian Edwards <julian.edwards@canonical.com> Tue, 29 Apr 2008 14:25:00 +0100 | ||
1320 | 307 | |||
1321 | 308 | launchpad-buildd (45) dapper-cat; urgency=low | ||
1322 | 309 | |||
1323 | 310 | * slave.py: Stop setting BuilderStatus.WAITING in each failure | ||
1324 | 311 | method, as this gives us a race where the builddmaster might | ||
1325 | 312 | dispatch another build to us before we're done cleaning up. | ||
1326 | 313 | * slave.py: Don't set BuildStatus.OK in buildComplete(), this is | ||
1327 | 314 | now a generic "the build has ended, succesfully or not" method. | ||
1328 | 315 | * slave.py: Define a new buildOK() method that sets BuildStatus.OK. | ||
1329 | 316 | * debian.py: When done cleaning, if the build isn't already marked | ||
1330 | 317 | as failed, call buildOK, then call buildComplete unconditionally. | ||
1331 | 318 | * The above changes should resolve https://launchpad.net/bugs/179466 | ||
1332 | 319 | |||
1333 | 320 | -- Adam Conrad <adconrad@ubuntu.com> Tue, 08 Apr 2008 14:12:07 -0600 | ||
1334 | 321 | |||
1335 | 322 | launchpad-buildd (44) dapper-cat; urgency=low | ||
1336 | 323 | |||
1337 | 324 | * slave.py: Redefine "private" _unpackChroot() as "public" doUnpack(), | ||
1338 | 325 | so we can use it from the build iteration control process. | ||
1339 | 326 | * slave.py: Make the initiate method set a _chroottarfile private | ||
1340 | 327 | variable for use by doUnpack(), rather than calling _unpackChroot(). | ||
1341 | 328 | * slave.py: Trigger the forked buildd process with an echo statement. | ||
1342 | 329 | * debian.py: Add the INIT state to the DebianBuildState class. | ||
1343 | 330 | * debian.py: Start the build process at INIT state instead of UNPACK. | ||
1344 | 331 | * debian.py: Add iterate_INIT(), which just checks success of the | ||
1345 | 332 | initial variable sanitisation checks, then hands off to doUnpack(). | ||
1346 | 333 | * debian.py: Adjust the failure return calls of the UNPACK and MOUNT | ||
1347 | 334 | methods to chrootFail() instead of builderFail(), for correctness. | ||
1348 | 335 | * The above changes should resolve https://launchpad.net/bugs/211974 | ||
1349 | 336 | |||
1350 | 337 | -- Adam Conrad <adconrad@ubuntu.com> Mon, 07 Apr 2008 13:53:20 -0600 | ||
1351 | 338 | |||
1352 | 339 | launchpad-buildd (43) dapper-cat; urgency=low | ||
1353 | 340 | |||
1354 | 341 | * unpack-chroot: Move the ntpdate calls below the bunzip/exec bit, | ||
1355 | 342 | so we don't run ntpdate twice when unzipping tarballs, which | ||
1356 | 343 | happens on every single build on Xen hosts (like the PPA hosts). | ||
1357 | 344 | * debian/control: We use adduser in postinst, depending on it helps. | ||
1358 | 345 | * debian/control: Set myself as the Maintainer, since I'm in here. | ||
1359 | 346 | * debian/control: Change our section from "misc" to "admin". | ||
1360 | 347 | * sbuild{,-package}: Pass DEB_BUILD_OPTIONS="parallel=N" to dpkg. | ||
1361 | 348 | |||
1362 | 349 | -- Adam Conrad <adconrad@ubuntu.com> Thu, 24 Jan 2008 15:39:20 -0700 | ||
1363 | 350 | |||
1364 | 351 | launchpad-buildd (42) dapper-cat; urgency=low | ||
1365 | 352 | |||
1366 | 353 | * sbuild: using "eq" to evaluate strings instead of "==" is ever | ||
1367 | 354 | so slightly less retarded (fixed the launchpad bug #184565) | ||
1368 | 355 | |||
1369 | 356 | -- Adam Conrad <adconrad@ubuntu.com> Tue, 22 Jan 2008 16:21:54 -0700 | ||
1370 | 357 | |||
1371 | 358 | launchpad-buildd (41) dapper-cat; urgency=low | ||
1372 | 359 | |||
1373 | 360 | * sbuild: If we've already marked a package as "installed" with a | ||
1374 | 361 | valid version, don't overwrite that version with PROVIDED. | ||
1375 | 362 | |||
1376 | 363 | -- Adam Conrad <adconrad@ubuntu.com> Thu, 17 Jan 2008 10:39:26 -0700 | ||
1377 | 364 | |||
1378 | 365 | launchpad-buildd (40) dapper-cat; urgency=low | ||
1379 | 366 | |||
1380 | 367 | * sbuild: Don't allow versioned build-deps to be satisfied by provided | ||
1381 | 368 | packages, but force them to go through the "upgrade/downgrade" tests. | ||
1382 | 369 | * sbuild: Do --info and --contents on _all.deb packages as well, if | ||
1383 | 370 | we're building arch:all packages. | ||
1384 | 371 | * sbuild: Don't process ENV_OVERRIDE anymore, we only had an override | ||
1385 | 372 | for one thing anyway (LC_ALL), and this code caused bug #87077. | ||
1386 | 373 | * sbuild-package: Call sbuild with LC_ALL=C explicitely, to compensate. | ||
1387 | 374 | * Makefile: clean up the makefile a bit to DTRT (as I expect it). | ||
1388 | 375 | |||
1389 | 376 | -- Adam Conrad <adconrad@ubuntu.com> Tue, 15 Jan 2008 16:51:08 -0700 | ||
1390 | 377 | |||
1391 | 378 | launchpad-buildd (39) unstable; urgency=low | ||
1392 | 379 | |||
1393 | 380 | * If we're fed an archive_purpose argument from the builddmaster, | ||
1394 | 381 | we pass --purpose=$archive_purpose to sbuild, and if we get suite | ||
1395 | 382 | from the builddmaster, we pass --dist=$suite to sbuild. | ||
1396 | 383 | * Mangle sbuild to write out Suite: and Purpose: stanzas to our | ||
1397 | 384 | CurrentlyBuilding file, according to command-line input. | ||
1398 | 385 | * Now that we're no longer always feeding -dautobuild to sbuild, | ||
1399 | 386 | fix up sbuild to always look for the chroot at chroot-autobuild | ||
1400 | 387 | instead of the Debian Way of using chroot-$suite. | ||
1401 | 388 | * If the config file contains an ntphost stanza, use that with | ||
1402 | 389 | ntpdate to sync the system's clock before we unpack the chroot. | ||
1403 | 390 | * Mangle update-config to add an ntphost stanza to the default | ||
1404 | 391 | config, and to 's/-dautobuild //' from the sbuild arguments. | ||
1405 | 392 | |||
1406 | 393 | -- Adam Conrad <adconrad@ubuntu.com> Thu, 20 Dec 2007 01:51:49 -0700 | ||
1407 | 394 | |||
1408 | 395 | launchpad-buildd (38) unstable; urgency=high | ||
1409 | 396 | |||
1410 | 397 | * unpack-chroot: set $PATH rather than hardcoding paths to binaries | ||
1411 | 398 | since bzip2 moved from /usr/bin to /bin in edgy and didn't bother with | ||
1412 | 399 | compatability symlinks. | ||
1413 | 400 | |||
1414 | 401 | -- James Troup <james.troup@canonical.com> Wed, 21 Nov 2007 17:08:36 +0000 | ||
1415 | 402 | |||
1416 | 403 | launchpad-buildd (37) dapper; urgency=high | ||
1417 | 404 | |||
1418 | 405 | * update-debian-chroot: Adam's LPIA support (i.e. overriding | ||
1419 | 406 | architecture for chapt-get). | ||
1420 | 407 | * debian/launchpad-buildd.cron.daily: fix run-on-line. | ||
1421 | 408 | * debian/postinst: only create ~buildd/.sbuildrc if it doesn't exist. | ||
1422 | 409 | This avoids the problem of upgrades of the launchpad-buildd package | ||
1423 | 410 | resetting the architecture to i386 on lpia builders. | ||
1424 | 411 | |||
1425 | 412 | -- James Troup <james.troup@canonical.com> Wed, 14 Nov 2007 18:34:46 +0000 | ||
1426 | 413 | |||
1427 | 414 | launchpad-buildd (36) dapper; urgency=low | ||
1428 | 415 | |||
1429 | 416 | * changing override-sources to replace current sources.list with | ||
1430 | 417 | the content sent by buildmaster instead of prepend. It will allow | ||
1431 | 418 | us to cope more easily with SoyuzArchive implementation (PARTNER, | ||
1432 | 419 | EMBARGOED, PPA) | ||
1433 | 420 | |||
1434 | 421 | -- Celso Providelo <cprov@canonical.com> Thu, 7 Aug 2007 14:10:26 -0300 | ||
1435 | 422 | |||
1436 | 423 | launchpad-buildd (35) unstable; urgency=low | ||
1437 | 424 | |||
1438 | 425 | * including previous code changes (32 & 33). | ||
1439 | 426 | |||
1440 | 427 | -- Celso Providelo <cprov@canonical.com> Thu, 23 May 2007 17:40:26 -0300 | ||
1441 | 428 | |||
1442 | 429 | launchpad-buildd (34) unstable; urgency=low | ||
1443 | 430 | |||
1444 | 431 | * add suport for overriding the chroot /etc/apt/sources.list with the | ||
1445 | 432 | content of builddmaster build arguments 'archives'. | ||
1446 | 433 | |||
1447 | 434 | -- Celso Providelo <cprov@canonical.com> Thu, 17 May 2007 15:12:26 -0300 | ||
1448 | 435 | |||
1449 | 436 | launchpad-buildd (33) unstable; urgency=low | ||
1450 | 437 | |||
1451 | 438 | * Mangle sbuild further to allow us to publish Martin's debug debs (ddeb) | ||
1452 | 439 | to public_html/ddebs/ until such a time as soyuz can do this natively. | ||
1453 | 440 | * Fix the auto-dep-wait regexes to allow for versions with ~ in them. | ||
1454 | 441 | * Make cron.daily clean out translations and ddebs more than 1 week old. | ||
1455 | 442 | |||
1456 | 443 | -- Adam Conrad <adconrad@ubuntu.com> Sat, 30 Sep 2006 17:25:25 +1000 | ||
1457 | 444 | |||
1458 | 445 | launchpad-buildd (32) unstable; urgency=low | ||
1459 | 446 | |||
1460 | 447 | * We need to create /var/run/launchpad-buildd in our init script in the | ||
1461 | 448 | case (such as in current dapper) where /var/run is on a tmpfs. | ||
1462 | 449 | * Our init script shouldn't exit non-zero on "stop" if already stopped. | ||
1463 | 450 | * Remove exc_info argument from our call to self.log in slave.py, which | ||
1464 | 451 | clearly doesn't support that argument, so stop producing tracebacks. | ||
1465 | 452 | * Reset self.builddependencies in our clean routine, so the variable | ||
1466 | 453 | doesn't get leaked to the next build, causing me SERIOUS confusion. | ||
1467 | 454 | * Tidy up translation handling a bit more to deal with old chroots (where | ||
1468 | 455 | pkgstriptranslations won't dpkg-distaddfile for us), and to chmod the | ||
1469 | 456 | translation dirs after the build, so apache can actually get at them. | ||
1470 | 457 | * Add --no_save to our command line to avoid useless -shutdown.tap files. | ||
1471 | 458 | * Make sure umount-chroot doesn't fail, even if there's nothing to umount. | ||
1472 | 459 | * Append to the cron.daily cleaning to also occasionally clean up the apt | ||
1473 | 460 | cache and /home/buildd/filecache-default, so we don't run out of disk. | ||
1474 | 461 | |||
1475 | 462 | -- Adam Conrad <adconrad@ubuntu.com> Fri, 17 Mar 2006 19:39:05 +1100 | ||
1476 | 463 | |||
1477 | 464 | launchpad-buildd (31) unstable; urgency=low | ||
1478 | 465 | |||
1479 | 466 | * Cherry-pick patch from Ryan's sbuild that outputs dpkg --purge output | ||
1480 | 467 | line-by-line, instead of as one big blob, to make output on the web | ||
1481 | 468 | UI a little bit more friendly for people following along at home. | ||
1482 | 469 | * Install a cron.daily script (eww) to purge old build logs for now until | ||
1483 | 470 | I have the time to learn how twisted's native log rotation works. | ||
1484 | 471 | |||
1485 | 472 | -- Adam Conrad <adconrad@ubuntu.com> Wed, 15 Mar 2006 17:23:26 +1100 | ||
1486 | 473 | |||
1487 | 474 | launchpad-buildd (30) unstable; urgency=low | ||
1488 | 475 | |||
1489 | 476 | * Move our translation publishing mojo so it happens BEFORE we move | ||
1490 | 477 | all the files from debian/files out of the chroot, instead of after. | ||
1491 | 478 | |||
1492 | 479 | -- Adam Conrad <adconrad@ubuntu.com> Wed, 8 Mar 2006 18:50:49 +1100 | ||
1493 | 480 | |||
1494 | 481 | launchpad-buildd (29) unstable; urgency=low | ||
1495 | 482 | |||
1496 | 483 | * Use dpkg --print-installation-architecture in our postinst instead | ||
1497 | 484 | of --print-architecture to avoid spewing suprious error messages. | ||
1498 | 485 | * Remove the check for log_dir, since we call sbuild with --nolog, | ||
1499 | 486 | and stop creating $HOME/logs in the user setup part of postinst. | ||
1500 | 487 | |||
1501 | 488 | -- Adam Conrad <adconrad@ubuntu.com> Tue, 7 Mar 2006 19:13:56 +1100 | ||
1502 | 489 | |||
1503 | 490 | launchpad-buildd (28) unstable; urgency=low | ||
1504 | 491 | |||
1505 | 492 | * Modify the protocol method ensurepresent to return additional | ||
1506 | 493 | information about the target files lookup procedure. It helps to | ||
1507 | 494 | debug intermittent Librarian errors. | ||
1508 | 495 | |||
1509 | 496 | -- Celso Providelo <celso.providelo@canonical.com> Mon, 06 Mar 2006 16:42:00 -0300 | ||
1510 | 497 | |||
1511 | 498 | launchpad-buildd (27) unstable; urgency=low | ||
1512 | 499 | |||
1513 | 500 | * Update the slave chroot tool to use getent so it works on the production | ||
1514 | 501 | buildds | ||
1515 | 502 | |||
1516 | 503 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Mon, 20 Feb 2006 12:57:45 +0000 | ||
1517 | 504 | |||
1518 | 505 | launchpad-buildd (26) unstable; urgency=low | ||
1519 | 506 | |||
1520 | 507 | * Update buildd-slave code to allow for GIVENBACK status returns, | ||
1521 | 508 | matching the states under which sbuild used to do --auto-give-back. | ||
1522 | 509 | * Port over sanae's build log regex parsing to allow us to do: | ||
1523 | 510 | - Automatic dep-wait handling, based on sbuild's logs of apt-get. | ||
1524 | 511 | - Automatic give-backs for a few corner cases (like kernel bugs). | ||
1525 | 512 | * Make sbuild stop dying if we have no sendmail installed, since we | ||
1526 | 513 | don't really want it sending mail in the launchpad world anyway. | ||
1527 | 514 | * Call sbuild and apt with "LANG=C", so we don't have to worry about | ||
1528 | 515 | locales matching between the base system and the autobuild chroots. | ||
1529 | 516 | * Clear up confusion in build states with 's/BUILDFAIL/PACKAGEFAIL/' | ||
1530 | 517 | |||
1531 | 518 | -- Adam Conrad <adconrad@ubuntu.com> Mon, 27 Feb 2006 14:00:08 +1100 | ||
1532 | 519 | |||
1533 | 520 | launchpad-buildd (25) unstable; urgency=low | ||
1534 | 521 | |||
1535 | 522 | * Update sbuild.conf to current yumminess. | ||
1536 | 523 | |||
1537 | 524 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 3 Feb 2006 19:22:01 +0000 | ||
1538 | 525 | |||
1539 | 526 | launchpad-buildd (24) unstable; urgency=low | ||
1540 | 527 | |||
1541 | 528 | * Add /var/cache/apt/archives to the buildd chroots when mounting | ||
1542 | 529 | |||
1543 | 530 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 3 Feb 2006 00:30:07 +0000 | ||
1544 | 531 | |||
1545 | 532 | launchpad-buildd (23) unstable; urgency=low | ||
1546 | 533 | |||
1547 | 534 | * And make apply-ogre-model use $SUDO, yay | ||
1548 | 535 | |||
1549 | 536 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 27 Jan 2006 13:59:10 +0000 | ||
1550 | 537 | |||
1551 | 538 | launchpad-buildd (22) unstable; urgency=low | ||
1552 | 539 | |||
1553 | 540 | * Fix typo in apply-ogre-model (missing space) | ||
1554 | 541 | |||
1555 | 542 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 27 Jan 2006 13:55:12 +0000 | ||
1556 | 543 | |||
1557 | 544 | launchpad-buildd (21) unstable; urgency=low | ||
1558 | 545 | |||
1559 | 546 | * Fix the .extend call for the --comp argument to pass it as one argument | ||
1560 | 547 | instead of as - - c o m p = m a i n (which kinda doesn't work) | ||
1561 | 548 | |||
1562 | 549 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 27 Jan 2006 13:45:34 +0000 | ||
1563 | 550 | |||
1564 | 551 | launchpad-buildd (20) unstable; urgency=low | ||
1565 | 552 | |||
1566 | 553 | * Update sbuild to the latest sbuild from adam. | ||
1567 | 554 | * Make sure we pass --archive=ubuntu | ||
1568 | 555 | * Make sure we pass --comp=<the component we're building for> | ||
1569 | 556 | |||
1570 | 557 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Thu, 26 Jan 2006 17:20:49 +0000 | ||
1571 | 558 | |||
1572 | 559 | launchpad-buildd (19) unstable; urgency=low | ||
1573 | 560 | |||
1574 | 561 | * Add ogre support to the slave chroot tool | ||
1575 | 562 | * Make sure the chroot tool ensures localhost in /etc/hosts in the chroot | ||
1576 | 563 | |||
1577 | 564 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 25 Jan 2006 12:29:04 +0000 | ||
1578 | 565 | |||
1579 | 566 | launchpad-buildd (18) unstable; urgency=low | ||
1580 | 567 | |||
1581 | 568 | * Remove sbuildrc.tmp dangleberry in postinst | ||
1582 | 569 | * Add linux32 to set of depends so that hppa, sparc and powerpc can build | ||
1583 | 570 | * Make hppa, sparc, powerpc use linux32 to invoke the sbuild binary | ||
1584 | 571 | * Add --resolve-deps to debootstrap invocation | ||
1585 | 572 | * Make chroot tool use /bin/su - rather than /bin/sh for chrooting. shiny | ||
1586 | 573 | (apparently) | ||
1587 | 574 | * Add a bunch of deps infinity spotted. | ||
1588 | 575 | * Make sure we chown the chroot tarball to the calling user after packing | ||
1589 | 576 | it up. | ||
1590 | 577 | |||
1591 | 578 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 9 Nov 2005 17:37:37 -0500 | ||
1592 | 579 | |||
1593 | 580 | launchpad-buildd (17) unstable; urgency=low | ||
1594 | 581 | |||
1595 | 582 | * Changed default UID/GID to match the ldap buildd UID/GID | ||
1596 | 583 | |||
1597 | 584 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 9 Nov 2005 17:13:22 -0500 | ||
1598 | 585 | |||
1599 | 586 | launchpad-buildd (16) unstable; urgency=low | ||
1600 | 587 | |||
1601 | 588 | * Change the XMLRPC method 'ensure' to be 'ensurepresent' | ||
1602 | 589 | |||
1603 | 590 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 5 Oct 2005 15:50:58 +0100 | ||
1604 | 591 | |||
1605 | 592 | launchpad-buildd (15) unstable; urgency=low | ||
1606 | 593 | |||
1607 | 594 | * Fix it so getting a logtail when less than 2k is available will work. | ||
1608 | 595 | * Actually install apply-ogre-model | ||
1609 | 596 | * Also spot arch_indep properly | ||
1610 | 597 | |||
1611 | 598 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Mon, 3 Oct 2005 14:34:55 +0100 | ||
1612 | 599 | |||
1613 | 600 | launchpad-buildd (14) unstable; urgency=low | ||
1614 | 601 | |||
1615 | 602 | * Slight bug in slave.py meant missing .emptyLog() attribute. Fixed. | ||
1616 | 603 | |||
1617 | 604 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Mon, 3 Oct 2005 14:21:16 +0100 | ||
1618 | 605 | |||
1619 | 606 | launchpad-buildd (13) unstable; urgency=low | ||
1620 | 607 | |||
1621 | 608 | * Fix a syntax error in the postinst | ||
1622 | 609 | * Oh, and actually include the buildd config upgrader | ||
1623 | 610 | |||
1624 | 611 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Mon, 3 Oct 2005 12:17:50 +0100 | ||
1625 | 612 | |||
1626 | 613 | launchpad-buildd (12) unstable; urgency=low | ||
1627 | 614 | |||
1628 | 615 | * Implement V1.0new protocol. | ||
1629 | 616 | * Add in OGRE support | ||
1630 | 617 | * Add in archindep support | ||
1631 | 618 | * If upgrading from < v12, will remove -A from sbuildargs and add in | ||
1632 | 619 | a default ogrepath to any buildd configs found in /etc/launchpad-buildd | ||
1633 | 620 | * Prevent launchpad-buildd init from starting ~ files | ||
1634 | 621 | |||
1635 | 622 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Sun, 2 Oct 2005 23:20:08 +0100 | ||
1636 | 623 | |||
1637 | 624 | launchpad-buildd (11) unstable; urgency=low | ||
1638 | 625 | |||
1639 | 626 | * Quieten down the slave scripts and make them prettier for the logs. | ||
1640 | 627 | * make unpack-chroot uncompress the chroot and keep it uncompressed if | ||
1641 | 628 | possible. This fixes bug#2699 | ||
1642 | 629 | * Make the slave run the process reaper run even if the build failed. | ||
1643 | 630 | |||
1644 | 631 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 30 Sep 2005 00:24:45 +0100 | ||
1645 | 632 | |||
1646 | 633 | launchpad-buildd (10) unstable; urgency=low | ||
1647 | 634 | |||
1648 | 635 | * Make sure /etc/source-dependencies is present in the postinst. | ||
1649 | 636 | (just need to be touched) | ||
1650 | 637 | |||
1651 | 638 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 28 Sep 2005 22:02:26 +0100 | ||
1652 | 639 | |||
1653 | 640 | launchpad-buildd (9) unstable; urgency=low | ||
1654 | 641 | |||
1655 | 642 | * Implement /filecache/XXX urls in the slave to permit larger file transfer | ||
1656 | 643 | |||
1657 | 644 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Tue, 27 Sep 2005 13:16:52 +0100 | ||
1658 | 645 | |||
1659 | 646 | launchpad-buildd (8) unstable; urgency=low | ||
1660 | 647 | |||
1661 | 648 | * spiv's crappy spawnFDs implementation needs an int not a file handle | ||
1662 | 649 | and can't cope with converting one to the other :-( | ||
1663 | 650 | |||
1664 | 651 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Tue, 27 Sep 2005 02:18:05 +0100 | ||
1665 | 652 | |||
1666 | 653 | launchpad-buildd (7) unstable; urgency=low | ||
1667 | 654 | |||
1668 | 655 | * Made sure the slave puts /dev/null on the subprocess stdin. | ||
1669 | 656 | |||
1670 | 657 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Tue, 27 Sep 2005 01:52:50 +0100 | ||
1671 | 658 | |||
1672 | 659 | launchpad-buildd (6) unstable; urgency=low | ||
1673 | 660 | |||
1674 | 661 | * Removed slavechroot.py from installed set. | ||
1675 | 662 | |||
1676 | 663 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Thu, 15 Sep 2005 11:39:25 +0100 | ||
1677 | 664 | |||
1678 | 665 | launchpad-buildd (5) unstable; urgency=low | ||
1679 | 666 | |||
1680 | 667 | * Add slave tool and example chroot configuration | ||
1681 | 668 | * Added debootstrap and dpkg-dev to the dependencies | ||
1682 | 669 | |||
1683 | 670 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 9 Sep 2005 16:38:22 +0100 | ||
1684 | 671 | |||
1685 | 672 | launchpad-buildd (4) unstable; urgency=low | ||
1686 | 673 | |||
1687 | 674 | * Add sbuild.conf which was previously missing | ||
1688 | 675 | * Fix up abort protocol and various other bits in the slave | ||
1689 | 676 | |||
1690 | 677 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Fri, 9 Sep 2005 14:24:31 +0100 | ||
1691 | 678 | |||
1692 | 679 | launchpad-buildd (3) unstable; urgency=low | ||
1693 | 680 | |||
1694 | 681 | * Modified postinst to make sure ccache and log dirs are created | ||
1695 | 682 | even if the user already exists. | ||
1696 | 683 | |||
1697 | 684 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Wed, 7 Sep 2005 15:50:36 +0100 | ||
1698 | 685 | |||
1699 | 686 | launchpad-buildd (2) unstable; urgency=low | ||
1700 | 687 | |||
1701 | 688 | * Fixes to postinst to make sure ccache and log dirs are created if missing. | ||
1702 | 689 | * Added README to explain how to build the package. | ||
1703 | 690 | |||
1704 | 691 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Thu, 1 Sep 2005 10:46:08 +0100 | ||
1705 | 692 | |||
1706 | 693 | launchpad-buildd (1) unstable; urgency=low | ||
1707 | 694 | |||
1708 | 695 | * Initial version | ||
1709 | 696 | |||
1710 | 697 | -- Daniel Silverstone <daniel.silverstone@canonical.com> Mon, 13 Jun 2005 11:08:38 +0100 | ||
1711 | 698 | |||
1712 | 699 | 0 | ||
1713 | === removed file 'lib/canonical/buildd/debian/compat' | |||
1714 | --- lib/canonical/buildd/debian/compat 2011-11-17 22:06:34 +0000 | |||
1715 | +++ lib/canonical/buildd/debian/compat 1970-01-01 00:00:00 +0000 | |||
1716 | @@ -1,1 +0,0 @@ | |||
1717 | 1 | 5 | ||
1718 | 2 | 0 | ||
1719 | === removed file 'lib/canonical/buildd/debian/control' | |||
1720 | --- lib/canonical/buildd/debian/control 2011-11-17 22:06:34 +0000 | |||
1721 | +++ lib/canonical/buildd/debian/control 1970-01-01 00:00:00 +0000 | |||
1722 | @@ -1,17 +0,0 @@ | |||
1723 | 1 | Source: launchpad-buildd | ||
1724 | 2 | Section: admin | ||
1725 | 3 | Priority: extra | ||
1726 | 4 | Maintainer: Adam Conrad <adconrad@ubuntu.com> | ||
1727 | 5 | Standards-Version: 3.5.9 | ||
1728 | 6 | Build-Depends-Indep: debhelper (>= 5) | ||
1729 | 7 | |||
1730 | 8 | Package: launchpad-buildd | ||
1731 | 9 | Section: misc | ||
1732 | 10 | Architecture: all | ||
1733 | 11 | Depends: python-twisted-core, python-twisted-web, debootstrap, dpkg-dev, linux32, file, bzip2, sudo, ntpdate, adduser, apt-transport-https, lsb-release, apache2, bzr-builder (>=0.5), ${misc:Depends} | ||
1734 | 12 | Description: Launchpad buildd slave | ||
1735 | 13 | This is the launchpad buildd slave package. It contains everything needed to | ||
1736 | 14 | get a launchpad buildd going apart from the database manipulation required to | ||
1737 | 15 | tell launchpad about the slave instance. If you are creating more than one | ||
1738 | 16 | slave instance on the same computer, be sure to give them independent configs | ||
1739 | 17 | and independent filecaches etc. | ||
1740 | 18 | 0 | ||
1741 | === removed file 'lib/canonical/buildd/debian/launchpad-buildd.cron.daily' | |||
1742 | --- lib/canonical/buildd/debian/launchpad-buildd.cron.daily 2011-11-17 22:06:34 +0000 | |||
1743 | +++ lib/canonical/buildd/debian/launchpad-buildd.cron.daily 1970-01-01 00:00:00 +0000 | |||
1744 | @@ -1,10 +0,0 @@ | |||
1745 | 1 | #!/bin/sh | ||
1746 | 2 | # | ||
1747 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
1748 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
1749 | 5 | |||
1750 | 6 | find /var/log/launchpad-buildd/ -mindepth 1 -mtime +2 -print0 | xargs -r -0 rm | ||
1751 | 7 | find /home/buildd/public_html/ddebs/ -maxdepth 1 -mindepth 1 -mtime +7 -print0 | xargs -r -0 rm -r | ||
1752 | 8 | find /home/buildd/public_html/translations/ -maxdepth 1 -mindepth 1 -mtime +7 -print0 | xargs -r -0 rm -r | ||
1753 | 9 | find /home/buildd/filecache-default/ -mindepth 1 -mtime +2 -print0 | xargs -r -0 rm | ||
1754 | 10 | [ `date +%w` = "1" ] && apt-get clean || true | ||
1755 | 11 | 0 | ||
1756 | === removed file 'lib/canonical/buildd/debian/launchpad-buildd.examples' | |||
1757 | --- lib/canonical/buildd/debian/launchpad-buildd.examples 2011-11-17 22:06:34 +0000 | |||
1758 | +++ lib/canonical/buildd/debian/launchpad-buildd.examples 1970-01-01 00:00:00 +0000 | |||
1759 | @@ -1,1 +0,0 @@ | |||
1760 | 1 | buildd-slave-example.conf | ||
1761 | 2 | 0 | ||
1762 | === removed file 'lib/canonical/buildd/debian/launchpad-buildd.init' | |||
1763 | --- lib/canonical/buildd/debian/launchpad-buildd.init 2011-11-17 22:06:34 +0000 | |||
1764 | +++ lib/canonical/buildd/debian/launchpad-buildd.init 1970-01-01 00:00:00 +0000 | |||
1765 | @@ -1,98 +0,0 @@ | |||
1766 | 1 | #!/bin/sh | ||
1767 | 2 | # | ||
1768 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
1769 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
1770 | 5 | # | ||
1771 | 6 | # launchpad-buildd | ||
1772 | 7 | # This file is used to start and stop launchpad buildds | ||
1773 | 8 | |||
1774 | 9 | ### BEGIN INIT INFO | ||
1775 | 10 | # Provides: launchpad_buildd | ||
1776 | 11 | # Required-Start: $local_fs $network $syslog $time | ||
1777 | 12 | # Required-Stop: $local_fs $network $syslog $time | ||
1778 | 13 | # Default-Start: 2 3 4 5 | ||
1779 | 14 | # Default-Stop: 0 1 6 | ||
1780 | 15 | # X-Interactive: false | ||
1781 | 16 | # Short-Description: Start/stop launchpad buildds | ||
1782 | 17 | ### END INIT INFO | ||
1783 | 18 | |||
1784 | 19 | set -e | ||
1785 | 20 | |||
1786 | 21 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
1787 | 22 | DESC="launchpad build slaves" | ||
1788 | 23 | |||
1789 | 24 | TACFILE="/usr/share/launchpad-buildd/buildd-slave.tac" | ||
1790 | 25 | |||
1791 | 26 | PIDROOT="/var/run/launchpad-buildd" | ||
1792 | 27 | LOGROOT="/var/log/launchpad-buildd" | ||
1793 | 28 | CONFROOT="/etc/launchpad-buildd" | ||
1794 | 29 | |||
1795 | 30 | # Gracefully exit if the package has been removed. | ||
1796 | 31 | test -e $TACFILE || exit 0 | ||
1797 | 32 | |||
1798 | 33 | # | ||
1799 | 34 | # Function that starts a buildd slave | ||
1800 | 35 | # | ||
1801 | 36 | d_start() { | ||
1802 | 37 | CONF=$1 | ||
1803 | 38 | PIDFILE="$PIDROOT"/"$CONF".pid | ||
1804 | 39 | LOGFILE="$LOGROOT"/"$CONF".log | ||
1805 | 40 | # prior to karmic, twisted didn't support --umask, and defaulted it well. | ||
1806 | 41 | # we need it to be 022, not 077. | ||
1807 | 42 | case $(lsb_release -sc) in | ||
1808 | 43 | [a-j]*) UMASK="";; | ||
1809 | 44 | [k-z]*) UMASK="--umask 022";; | ||
1810 | 45 | esac | ||
1811 | 46 | su - buildd -c "BUILDD_SLAVE_CONFIG=$CONFROOT/$CONF PYTHONPATH=/usr/share/launchpad-buildd twistd --no_save --pidfile $PIDFILE --python $TACFILE --logfile $LOGFILE $UMASK" | ||
1812 | 47 | } | ||
1813 | 48 | |||
1814 | 49 | # | ||
1815 | 50 | # Function that stops a buildd slave | ||
1816 | 51 | # | ||
1817 | 52 | d_stop() { | ||
1818 | 53 | CONF=$1 | ||
1819 | 54 | PIDFILE="$PIDROOT"/"$CONF".pid | ||
1820 | 55 | test -r $PIDFILE && kill -TERM $(cat $PIDFILE) || true | ||
1821 | 56 | } | ||
1822 | 57 | |||
1823 | 58 | CONFS=$(cd $CONFROOT; ls|grep -v "^-"|grep -v "~$") | ||
1824 | 59 | |||
1825 | 60 | case "$1" in | ||
1826 | 61 | start) | ||
1827 | 62 | echo -n "Starting $DESC:" | ||
1828 | 63 | install -m 755 -o buildd -g buildd -d $PIDROOT | ||
1829 | 64 | |||
1830 | 65 | # Create any missing directories and chown them appropriately | ||
1831 | 66 | install -d -o buildd -g buildd /home/buildd/filecache-default | ||
1832 | 67 | |||
1833 | 68 | for conf in $CONFS; do | ||
1834 | 69 | echo -n " $conf" | ||
1835 | 70 | d_start $conf | ||
1836 | 71 | done | ||
1837 | 72 | echo "." | ||
1838 | 73 | ;; | ||
1839 | 74 | stop) | ||
1840 | 75 | echo -n "Stopping $DESC:" | ||
1841 | 76 | for conf in $CONFS; do | ||
1842 | 77 | echo -n " $conf" | ||
1843 | 78 | d_stop $conf | ||
1844 | 79 | done | ||
1845 | 80 | echo "." | ||
1846 | 81 | ;; | ||
1847 | 82 | restart|force-reload) | ||
1848 | 83 | # | ||
1849 | 84 | # If the "reload" option is implemented, move the "force-reload" | ||
1850 | 85 | # option to the "reload" entry above. If not, "force-reload" is | ||
1851 | 86 | # just the same as "restart". | ||
1852 | 87 | # | ||
1853 | 88 | $0 stop | ||
1854 | 89 | sleep 1 | ||
1855 | 90 | $0 start | ||
1856 | 91 | ;; | ||
1857 | 92 | *) | ||
1858 | 93 | echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 | ||
1859 | 94 | exit 1 | ||
1860 | 95 | ;; | ||
1861 | 96 | esac | ||
1862 | 97 | |||
1863 | 98 | exit 0 | ||
1864 | 99 | 0 | ||
1865 | === removed file 'lib/canonical/buildd/debian/postinst' | |||
1866 | --- lib/canonical/buildd/debian/postinst 2011-11-17 22:06:34 +0000 | |||
1867 | +++ lib/canonical/buildd/debian/postinst 1970-01-01 00:00:00 +0000 | |||
1868 | @@ -1,101 +0,0 @@ | |||
1869 | 1 | #!/bin/sh | ||
1870 | 2 | # | ||
1871 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
1872 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
1873 | 5 | |||
1874 | 6 | # Post install script | ||
1875 | 7 | |||
1876 | 8 | set -e | ||
1877 | 9 | set -u | ||
1878 | 10 | |||
1879 | 11 | USER=${BUILDD_USER:-buildd} | ||
1880 | 12 | BUILDDGID=${BUILDD_GID:-2501} | ||
1881 | 13 | BUILDDUID=${BUILDD_UID:-2001} | ||
1882 | 14 | |||
1883 | 15 | make_buildd() | ||
1884 | 16 | { | ||
1885 | 17 | buildd-genconfig --name=default --host=0.0.0.0 --port=8221 > \ | ||
1886 | 18 | /etc/launchpad-buildd/default | ||
1887 | 19 | echo Default buildd created. | ||
1888 | 20 | } | ||
1889 | 21 | |||
1890 | 22 | case "$1" in | ||
1891 | 23 | configure) | ||
1892 | 24 | getent group buildd >/dev/null 2>&1 || | ||
1893 | 25 | addgroup --gid $BUILDDGID buildd | ||
1894 | 26 | |||
1895 | 27 | getent passwd buildd >/dev/null 2>&1 || | ||
1896 | 28 | adduser --ingroup buildd --disabled-login --gecos 'Buildd user' \ | ||
1897 | 29 | --uid $BUILDDUID ${USER} | ||
1898 | 30 | |||
1899 | 31 | SUDO_VERSION=$(sudo -V | sed -n '/^Sudo version/s/.* //p') | ||
1900 | 32 | if dpkg --compare-versions $SUDO_VERSION lt 1.7 || | ||
1901 | 33 | ! grep -q '^#includedir /etc/sudoers.d' /etc/sudoers; then | ||
1902 | 34 | grep -q ^${USER} /etc/sudoers || | ||
1903 | 35 | echo "${USER} ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers | ||
1904 | 36 | else | ||
1905 | 37 | if ! sudo -l -U ${USER} | grep -q '(ALL) NOPASSWD: ALL' || | ||
1906 | 38 | ! sudo -l -U ${USER} | grep -q umask_override; then | ||
1907 | 39 | cat << EOF >> /etc/sudoers.d/buildd | ||
1908 | 40 | Defaults:buildd umask_override | ||
1909 | 41 | Defaults>buildd umask_override | ||
1910 | 42 | |||
1911 | 43 | ${USER} ALL=(ALL) NOPASSWD: ALL | ||
1912 | 44 | %buildd ALL=(buildd) NOPASSWD: ALL, (root) NOPASSWD: /bin/su - buildd | ||
1913 | 45 | %lpbuildd ALL=(ALL) NOPASSWD: ALL | ||
1914 | 46 | EOF | ||
1915 | 47 | fi | ||
1916 | 48 | chmod 440 /etc/sudoers.d/buildd | ||
1917 | 49 | chown root:root /etc/sudoers.d/buildd | ||
1918 | 50 | fi | ||
1919 | 51 | |||
1920 | 52 | install -d -o${USER} -m0755 /home/${USER} | ||
1921 | 53 | |||
1922 | 54 | # Create ~buildd/.sbuildrc if needed | ||
1923 | 55 | if [ ! -f /home/${USER}/.sbuildrc ]; then | ||
1924 | 56 | cp /usr/share/launchpad-buildd/sbuildrc \ | ||
1925 | 57 | /home/${USER}/sbuildrc.tmp | ||
1926 | 58 | cd /home/${USER} | ||
1927 | 59 | sed -e's/@ARCHTAG@/'$(dpkg --print-architecture)'/g' \ | ||
1928 | 60 | -e's/@FQDN@/'$(hostname --fqdn)'/g' \ | ||
1929 | 61 | <sbuildrc.tmp > .sbuildrc | ||
1930 | 62 | chown $USER:buildd .sbuildrc | ||
1931 | 63 | chmod 0644 .sbuildrc | ||
1932 | 64 | rm sbuildrc.tmp | ||
1933 | 65 | fi | ||
1934 | 66 | |||
1935 | 67 | # Prepare a default buildd... | ||
1936 | 68 | test -e /etc/launchpad-buildd/default || make_buildd | ||
1937 | 69 | |||
1938 | 70 | # Create any missing directories and chown them appropriately | ||
1939 | 71 | test -d /home/${USER}/filecache-default || mkdir /home/${USER}/filecache-default | ||
1940 | 72 | chown $USER:buildd /home/${USER}/filecache-default | ||
1941 | 73 | |||
1942 | 74 | chown $USER:buildd /var/log/launchpad-buildd /var/run/launchpad-buildd | ||
1943 | 75 | |||
1944 | 76 | # Check for the presence of the /etc/source-dependencies file | ||
1945 | 77 | # which sbuild will rant about the absence of... | ||
1946 | 78 | test -e /etc/source-dependencies || touch /etc/source-dependencies | ||
1947 | 79 | |||
1948 | 80 | # Now check if we're upgrading a previous version... | ||
1949 | 81 | if [ "x$2" != "x" ]; then | ||
1950 | 82 | for CONFIG in $(ls /etc/launchpad-buildd/* \ | ||
1951 | 83 | | grep -v "^-" | grep -v "~$"); do | ||
1952 | 84 | /usr/share/launchpad-buildd/upgrade-config $2 $CONFIG | ||
1953 | 85 | done | ||
1954 | 86 | fi | ||
1955 | 87 | |||
1956 | 88 | ;; | ||
1957 | 89 | abort-upgrade|abort-remove|abort-deconfigure) | ||
1958 | 90 | |||
1959 | 91 | ;; | ||
1960 | 92 | |||
1961 | 93 | *) | ||
1962 | 94 | echo "postinst called with unknown argument \`$1'" >&2 | ||
1963 | 95 | exit 1 | ||
1964 | 96 | ;; | ||
1965 | 97 | esac | ||
1966 | 98 | |||
1967 | 99 | #DEBHELPER# | ||
1968 | 100 | |||
1969 | 101 | exit 0 | ||
1970 | 102 | 0 | ||
1971 | === removed file 'lib/canonical/buildd/debian/rules' | |||
1972 | --- lib/canonical/buildd/debian/rules 2011-11-17 22:06:34 +0000 | |||
1973 | +++ lib/canonical/buildd/debian/rules 1970-01-01 00:00:00 +0000 | |||
1974 | @@ -1,96 +0,0 @@ | |||
1975 | 1 | #!/usr/bin/make -f | ||
1976 | 2 | # | ||
1977 | 3 | # Copyright 2009, 2010 Canonical Ltd. This software is licensed under the | ||
1978 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
1979 | 5 | |||
1980 | 6 | export DH_OPTIONS | ||
1981 | 7 | |||
1982 | 8 | # This is an incomplete debian rules file for making the launchpad-buildd deb | ||
1983 | 9 | # Only ever invoke this as debian/rules package, which will build the source | ||
1984 | 10 | # package in the parent directory, after copying in the files that live above | ||
1985 | 11 | # this directory, so that the source package is valid. | ||
1986 | 12 | # after that, build the source package found in the parent directory. | ||
1987 | 13 | |||
1988 | 14 | target = debian/launchpad-buildd | ||
1989 | 15 | topdir = ../../.. | ||
1990 | 16 | |||
1991 | 17 | buildd = $(topdir)/lib/canonical/buildd | ||
1992 | 18 | |||
1993 | 19 | targetshare = $(target)/usr/share/launchpad-buildd | ||
1994 | 20 | pytarget = $(targetshare)/canonical/buildd | ||
1995 | 21 | |||
1996 | 22 | pyfiles = debian.py slave.py binarypackage.py utils.py __init__.py \ | ||
1997 | 23 | sourcepackagerecipe.py translationtemplates.py | ||
1998 | 24 | slavebins = unpack-chroot mount-chroot update-debian-chroot sbuild-package \ | ||
1999 | 25 | scan-for-processes umount-chroot remove-build override-sources-list \ | ||
2000 | 26 | buildrecipe generate-translation-templates | ||
2001 | 27 | |||
2002 | 28 | BUILDDUID=65500 | ||
2003 | 29 | BUILDDGID=65500 | ||
2004 | 30 | |||
2005 | 31 | install: DH_OPTIONS=-plaunchpad-buildd | ||
2006 | 32 | install: | ||
2007 | 33 | dh_testdir | ||
2008 | 34 | dh_clean | ||
2009 | 35 | dh_testroot | ||
2010 | 36 | dh_installdirs usr/bin etc usr/share/launchpad-buildd/slavebin \ | ||
2011 | 37 | usr/share/launchpad-buildd/canonical/buildd \ | ||
2012 | 38 | var/run/launchpad-buildd var/log/launchpad-buildd \ | ||
2013 | 39 | etc/launchpad-buildd \ | ||
2014 | 40 | usr/share/launchpad-buildd/canonical/launchpad/daemons \ | ||
2015 | 41 | usr/share/doc/launchpad-buildd | ||
2016 | 42 | dh_installexamples | ||
2017 | 43 | |||
2018 | 44 | # Do installs here | ||
2019 | 45 | touch $(pytarget)/../launchpad/__init__.py | ||
2020 | 46 | touch $(pytarget)/../launchpad/daemons/__init__.py | ||
2021 | 47 | install -m644 buildd-slave.tac $(targetshare)/buildd-slave.tac | ||
2022 | 48 | cp -r pottery $(pytarget) | ||
2023 | 49 | for pyfile in $(pyfiles); do \ | ||
2024 | 50 | install -m644 ./$$pyfile $(pytarget)/$$pyfile; \ | ||
2025 | 51 | done | ||
2026 | 52 | for slavebin in $(slavebins); do \ | ||
2027 | 53 | install -m755 ./$$slavebin $(targetshare)/slavebin/$$slavebin; \ | ||
2028 | 54 | done | ||
2029 | 55 | install -m755 ./sbuild $(target)/usr/bin/sbuild | ||
2030 | 56 | touch $(targetshare)/canonical/__init__.py | ||
2031 | 57 | install -m644 template-buildd-slave.conf $(targetshare)/template-buildd-slave.conf | ||
2032 | 58 | install -m755 buildd-config.py $(target)/usr/bin/buildd-genconfig | ||
2033 | 59 | install -m644 sbuildrc $(targetshare)/sbuildrc | ||
2034 | 60 | install -m644 sbuild.conf $(target)/etc/sbuild.conf | ||
2035 | 61 | install -m755 debian/upgrade-config $(targetshare)/upgrade-config | ||
2036 | 62 | install -m755 check-implicit-pointer-functions $(target)/usr/bin/check-implicit-pointer-functions | ||
2037 | 63 | # Okay, that's installed all the slave-related files | ||
2038 | 64 | |||
2039 | 65 | |||
2040 | 66 | binary-arch: | ||
2041 | 67 | @echo No arch-specific binaries to make | ||
2042 | 68 | |||
2043 | 69 | binary-indep: DH_OPTIONS=-plaunchpad-buildd | ||
2044 | 70 | binary-indep: install | ||
2045 | 71 | dh_installdocs | ||
2046 | 72 | dh_installchangelogs | ||
2047 | 73 | dh_installinit | ||
2048 | 74 | dh_installcron | ||
2049 | 75 | dh_strip | ||
2050 | 76 | dh_compress | ||
2051 | 77 | dh_fixperms | ||
2052 | 78 | dh_installdeb | ||
2053 | 79 | dh_gencontrol | ||
2054 | 80 | dh_md5sums | ||
2055 | 81 | dh_builddeb | ||
2056 | 82 | |||
2057 | 83 | binary: binary-indep | ||
2058 | 84 | |||
2059 | 85 | .PHONY: binary binary-indep binary-arch install clean build | ||
2060 | 86 | |||
2061 | 87 | clean: | ||
2062 | 88 | dh_clean | ||
2063 | 89 | |||
2064 | 90 | prepare: | ||
2065 | 91 | |||
2066 | 92 | package: prepare | ||
2067 | 93 | debuild -uc -us -S | ||
2068 | 94 | |||
2069 | 95 | build: | ||
2070 | 96 | @echo Mmm builders | ||
2071 | 97 | 0 | ||
2072 | === removed directory 'lib/canonical/buildd/debian/source' | |||
2073 | === removed file 'lib/canonical/buildd/debian/source/format' | |||
2074 | --- lib/canonical/buildd/debian/source/format 2011-11-17 22:06:34 +0000 | |||
2075 | +++ lib/canonical/buildd/debian/source/format 1970-01-01 00:00:00 +0000 | |||
2076 | @@ -1,1 +0,0 @@ | |||
2077 | 1 | 1.0 | ||
2078 | 2 | 0 | ||
2079 | === removed file 'lib/canonical/buildd/debian/upgrade-config' | |||
2080 | --- lib/canonical/buildd/debian/upgrade-config 2011-11-17 22:06:34 +0000 | |||
2081 | +++ lib/canonical/buildd/debian/upgrade-config 1970-01-01 00:00:00 +0000 | |||
2082 | @@ -1,122 +0,0 @@ | |||
2083 | 1 | #!/usr/bin/python | ||
2084 | 2 | # | ||
2085 | 3 | # Copyright 2009, 2010 Canonical Ltd. This software is licensed under the | ||
2086 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2087 | 5 | |||
2088 | 6 | """Upgrade a launchpad-buildd configuration file.""" | ||
2089 | 7 | |||
2090 | 8 | import sys | ||
2091 | 9 | import os | ||
2092 | 10 | import subprocess | ||
2093 | 11 | |||
2094 | 12 | (old_version, conf_file) = sys.argv[1:] | ||
2095 | 13 | |||
2096 | 14 | def upgrade_to_12(): | ||
2097 | 15 | print "Upgrading %s to version 12" % conf_file | ||
2098 | 16 | subprocess.call(["mv", conf_file, conf_file+"-prev12~"]) | ||
2099 | 17 | in_file = open(conf_file+"-prev12~", "r") | ||
2100 | 18 | out_file = open(conf_file, "w") | ||
2101 | 19 | for line in in_file: | ||
2102 | 20 | if line.startswith("[debianmanager]"): | ||
2103 | 21 | line += "ogrepath = /usr/share/launchpad-buildd/slavebin/apply-ogre-model\n" | ||
2104 | 22 | if line.startswith("sbuildargs"): | ||
2105 | 23 | line = line.replace("-A", "") | ||
2106 | 24 | out_file.write(line) | ||
2107 | 25 | in_file.close() | ||
2108 | 26 | out_file.close() | ||
2109 | 27 | |||
2110 | 28 | def upgrade_to_34(): | ||
2111 | 29 | print "Upgrading %s to version 34" % conf_file | ||
2112 | 30 | subprocess.call(["mv", conf_file, conf_file+"-prev34~"]) | ||
2113 | 31 | in_file = open(conf_file+"-prev34~", "r") | ||
2114 | 32 | out_file = open(conf_file, "w") | ||
2115 | 33 | for line in in_file: | ||
2116 | 34 | if line.startswith("[debianmanager]"): | ||
2117 | 35 | line += "sourcespath = /usr/share/launchpad-buildd/slavebin/override-sources-list\n" | ||
2118 | 36 | out_file.write(line) | ||
2119 | 37 | in_file.close() | ||
2120 | 38 | out_file.close() | ||
2121 | 39 | |||
2122 | 40 | def upgrade_to_39(): | ||
2123 | 41 | print "Upgrading %s to version 39" % conf_file | ||
2124 | 42 | subprocess.call(["mv", conf_file, conf_file+"-prev39~"]) | ||
2125 | 43 | in_file = open(conf_file+"-prev39~", "r") | ||
2126 | 44 | out_file = open(conf_file, "w") | ||
2127 | 45 | for line in in_file: | ||
2128 | 46 | if line.startswith("sbuildargs"): | ||
2129 | 47 | line = line.replace("-dautobuild ","") | ||
2130 | 48 | if line.startswith("[slave]"): | ||
2131 | 49 | line += "ntphost = ntp.buildd\n" | ||
2132 | 50 | out_file.write(line) | ||
2133 | 51 | in_file.close() | ||
2134 | 52 | out_file.close() | ||
2135 | 53 | |||
2136 | 54 | def upgrade_to_57(): | ||
2137 | 55 | print "Upgrading %s to version 57" % conf_file | ||
2138 | 56 | subprocess.call(["mv", conf_file, conf_file+"-prev57~"]) | ||
2139 | 57 | in_file = open(conf_file+"-prev57~", "r") | ||
2140 | 58 | out_file = open(conf_file, "w") | ||
2141 | 59 | # We want to move all the sbuild lines to a new | ||
2142 | 60 | # 'binarypackagemanager' section at the end. | ||
2143 | 61 | binarypackage_lines = [] | ||
2144 | 62 | for line in in_file: | ||
2145 | 63 | if line.startswith("sbuild"): | ||
2146 | 64 | binarypackage_lines.append(line) | ||
2147 | 65 | else: | ||
2148 | 66 | out_file.write(line) | ||
2149 | 67 | out_file.write('[binarypackagemanager]\n') | ||
2150 | 68 | for line in binarypackage_lines: | ||
2151 | 69 | out_file.write(line) | ||
2152 | 70 | in_file.close() | ||
2153 | 71 | out_file.close() | ||
2154 | 72 | |||
2155 | 73 | def upgrade_to_58(): | ||
2156 | 74 | print "Upgrading %s to version 58" % conf_file | ||
2157 | 75 | subprocess.call(["mv", conf_file, conf_file+"-prev58~"]) | ||
2158 | 76 | in_file = open(conf_file+"-prev58~", "r") | ||
2159 | 77 | out_file = open(conf_file, "w") | ||
2160 | 78 | out_file.write(in_file.read()) | ||
2161 | 79 | out_file.write( | ||
2162 | 80 | '\n[sourcepackagerecipemanager]\n' | ||
2163 | 81 | 'buildrecipepath = /usr/share/launchpad-buildd' | ||
2164 | 82 | '/slavebin/buildrecipe\n') | ||
2165 | 83 | |||
2166 | 84 | def upgrade_to_59(): | ||
2167 | 85 | print "Upgrading %s to version 59" % conf_file | ||
2168 | 86 | subprocess.call(["mv", conf_file, conf_file+"-prev59~"]) | ||
2169 | 87 | in_file = open(conf_file+"-prev59~", "r") | ||
2170 | 88 | out_file = open(conf_file, "w") | ||
2171 | 89 | out_file.write(in_file.read()) | ||
2172 | 90 | out_file.write( | ||
2173 | 91 | '\n[translationtemplatesmanager]\n' | ||
2174 | 92 | 'generatepath = /usr/share/launchpad-buildd/slavebin/generate-translation-templates\n' | ||
2175 | 93 | 'resultarchive = translation-templates.tar.gz\n') | ||
2176 | 94 | |||
2177 | 95 | def upgrade_to_63(): | ||
2178 | 96 | print "Upgrading %s to version 63" % conf_file | ||
2179 | 97 | subprocess.call(["mv", conf_file, conf_file+"-prev63~"]) | ||
2180 | 98 | in_file = open(conf_file+"-prev63~", "r") | ||
2181 | 99 | out_file = open(conf_file, "w") | ||
2182 | 100 | for line in in_file: | ||
2183 | 101 | if not line.startswith('ogrepath'): | ||
2184 | 102 | out_file.write(line) | ||
2185 | 103 | |||
2186 | 104 | |||
2187 | 105 | if __name__ == "__main__": | ||
2188 | 106 | if old_version.find("~") > 0: | ||
2189 | 107 | old_version = old_version[:old_version.find("~")] | ||
2190 | 108 | if int(old_version) < 12: | ||
2191 | 109 | upgrade_to_12() | ||
2192 | 110 | if int(old_version) < 34: | ||
2193 | 111 | upgrade_to_34() | ||
2194 | 112 | if int(old_version) < 39: | ||
2195 | 113 | upgrade_to_39() | ||
2196 | 114 | if int(old_version) < 57: | ||
2197 | 115 | upgrade_to_57() | ||
2198 | 116 | if int(old_version) < 58: | ||
2199 | 117 | upgrade_to_58() | ||
2200 | 118 | if int(old_version) < 59: | ||
2201 | 119 | upgrade_to_59() | ||
2202 | 120 | if int(old_version) < 63: | ||
2203 | 121 | upgrade_to_63() | ||
2204 | 122 | |||
2205 | 123 | 0 | ||
2206 | === removed file 'lib/canonical/buildd/generate-translation-templates' | |||
2207 | --- lib/canonical/buildd/generate-translation-templates 2011-11-17 22:06:34 +0000 | |||
2208 | +++ lib/canonical/buildd/generate-translation-templates 1970-01-01 00:00:00 +0000 | |||
2209 | @@ -1,66 +0,0 @@ | |||
2210 | 1 | #!/bin/sh | ||
2211 | 2 | # | ||
2212 | 3 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
2213 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2214 | 5 | |||
2215 | 6 | # Buildd Slave tool to generate translation templates. Boiler plate code | ||
2216 | 7 | # copied from sbuild-package. | ||
2217 | 8 | |||
2218 | 9 | # Expects build id as arg 1. | ||
2219 | 10 | # Expects branch url as arg 2. | ||
2220 | 11 | # Expects output tarball name as arg 3. | ||
2221 | 12 | |||
2222 | 13 | # Must run as user with password-less sudo ability. | ||
2223 | 14 | |||
2224 | 15 | exec 2>&1 | ||
2225 | 16 | |||
2226 | 17 | export LANG=C LC_ALL=C | ||
2227 | 18 | |||
2228 | 19 | CHMOD=/bin/chmod | ||
2229 | 20 | CHROOT=/usr/sbin/chroot | ||
2230 | 21 | CP=/bin/cp | ||
2231 | 22 | INSTALL=/usr/bin/install | ||
2232 | 23 | MKDIR=/bin/mkdir | ||
2233 | 24 | SU=/bin/su | ||
2234 | 25 | SUDO=/usr/bin/sudo | ||
2235 | 26 | TOUCH=/usr/bin/touch | ||
2236 | 27 | |||
2237 | 28 | BUILDID=$1 | ||
2238 | 29 | BRANCH_URL=$2 | ||
2239 | 30 | RESULT_NAME=$3 | ||
2240 | 31 | |||
2241 | 32 | BUILDD_HOME=/usr/share/launchpad-buildd | ||
2242 | 33 | SLAVEBIN=$BUILDD_HOME/slavebin | ||
2243 | 34 | BUILD_CHROOT="$HOME/build-$BUILDID/chroot-autobuild" | ||
2244 | 35 | USER=$(whoami) | ||
2245 | 36 | |||
2246 | 37 | # Debug output. | ||
2247 | 38 | echo "Running as $USER for build $BUILDID on $BRANCH_URL." | ||
2248 | 39 | echo "Results expected in $RESULT_NAME." | ||
2249 | 40 | |||
2250 | 41 | BUILDD_PACKAGE=canonical/buildd | ||
2251 | 42 | POTTERY=$BUILDD_PACKAGE/pottery | ||
2252 | 43 | # The script should be smarter about detecting the python version. | ||
2253 | 44 | PYMODULES=/usr/lib/pymodules/python2.7 | ||
2254 | 45 | echo -n "Default Python in the chroot is: " | ||
2255 | 46 | $BUILD_CHROOT/usr/bin/python --version | ||
2256 | 47 | |||
2257 | 48 | GENERATE_SCRIPT=$PYMODULES/$POTTERY/generate_translation_templates.py | ||
2258 | 49 | |||
2259 | 50 | debug_exec() { | ||
2260 | 51 | echo "Executing '$1'..." | ||
2261 | 52 | $1 || echo "Got error $? from '$1'." | ||
2262 | 53 | } | ||
2263 | 54 | |||
2264 | 55 | # Copy pottery files to chroot. | ||
2265 | 56 | debug_exec "$SUDO $MKDIR -vp $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE" | ||
2266 | 57 | debug_exec "$SUDO $TOUCH $BUILD_CHROOT$PYMODULES/canonical/__init__.py" | ||
2267 | 58 | debug_exec "$SUDO $TOUCH $BUILD_CHROOT$PYMODULES/canonical/buildd/__init__.py" | ||
2268 | 59 | debug_exec "$SUDO $CP -vr $BUILDD_HOME/$POTTERY $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE" | ||
2269 | 60 | debug_exec "$SUDO $CHMOD -v -R go+rX $BUILD_CHROOT$PYMODULES/canonical" | ||
2270 | 61 | debug_exec "$SUDO $CHMOD -v 755 $BUILD_CHROOT$GENERATE_SCRIPT" | ||
2271 | 62 | |||
2272 | 63 | # Enter chroot, switch back to unprivileged user, execute the generate script. | ||
2273 | 64 | $SUDO $CHROOT $BUILD_CHROOT \ | ||
2274 | 65 | $SU - $USER \ | ||
2275 | 66 | -c "PYTHONPATH=$PYMODULES $GENERATE_SCRIPT $BRANCH_URL $RESULT_NAME" | ||
2276 | 67 | 0 | ||
2277 | === removed directory 'lib/canonical/buildd/launchpad-files' | |||
2278 | === removed file 'lib/canonical/buildd/mount-chroot' | |||
2279 | --- lib/canonical/buildd/mount-chroot 2011-11-17 22:06:34 +0000 | |||
2280 | +++ lib/canonical/buildd/mount-chroot 1970-01-01 00:00:00 +0000 | |||
2281 | @@ -1,25 +0,0 @@ | |||
2282 | 1 | #!/bin/sh | ||
2283 | 2 | # | ||
2284 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
2285 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2286 | 5 | |||
2287 | 6 | # Buildd Slave tool to mount a chroot | ||
2288 | 7 | |||
2289 | 8 | # Expects build id as arg 1, makes build-id to contain the build | ||
2290 | 9 | |||
2291 | 10 | # Needs SUDO to be set to a sudo instance for passwordless access | ||
2292 | 11 | |||
2293 | 12 | SUDO=/usr/bin/sudo | ||
2294 | 13 | BUILDID="$1" | ||
2295 | 14 | |||
2296 | 15 | set -e | ||
2297 | 16 | |||
2298 | 17 | exec 2>&1 | ||
2299 | 18 | |||
2300 | 19 | echo "Mounting chroot for build $BUILDID" | ||
2301 | 20 | |||
2302 | 21 | $SUDO mount -t proc none "$HOME/build-$BUILDID/chroot-autobuild/proc" | ||
2303 | 22 | $SUDO mount -t devpts none "$HOME/build-$BUILDID/chroot-autobuild/dev/pts" | ||
2304 | 23 | $SUDO mount -t sysfs none "$HOME/build-$BUILDID/chroot-autobuild/sys" | ||
2305 | 24 | $SUDO mount -t tmpfs none "$HOME/build-$BUILDID/chroot-autobuild/dev/shm" | ||
2306 | 25 | $SUDO cp /etc/hosts /etc/hostname /etc/resolv.conf $HOME/build-$BUILDID/chroot-autobuild/etc/ | ||
2307 | 26 | 0 | ||
2308 | === removed file 'lib/canonical/buildd/override-sources-list' | |||
2309 | --- lib/canonical/buildd/override-sources-list 2011-11-17 22:06:34 +0000 | |||
2310 | +++ lib/canonical/buildd/override-sources-list 1970-01-01 00:00:00 +0000 | |||
2311 | @@ -1,31 +0,0 @@ | |||
2312 | 1 | #!/bin/sh | ||
2313 | 2 | # | ||
2314 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
2315 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2316 | 5 | |||
2317 | 6 | # Buildd Slave tool to override sources.list in the chroot with a list of | ||
2318 | 7 | # archives | ||
2319 | 8 | |||
2320 | 9 | # Expects build id as arg 1 | ||
2321 | 10 | # Expects sources.list lines as subsequent args | ||
2322 | 11 | |||
2323 | 12 | # Needs SUDO to be set to a sudo instance for passwordless access | ||
2324 | 13 | |||
2325 | 14 | set -e | ||
2326 | 15 | exec 2>&1 | ||
2327 | 16 | |||
2328 | 17 | SUDO=/usr/bin/sudo | ||
2329 | 18 | |||
2330 | 19 | BUILDID="$1" | ||
2331 | 20 | shift | ||
2332 | 21 | |||
2333 | 22 | cd $HOME | ||
2334 | 23 | cd "build-$BUILDID/chroot-autobuild/etc/apt" | ||
2335 | 24 | |||
2336 | 25 | echo "Overriding sources.list in build-$BUILDID" | ||
2337 | 26 | |||
2338 | 27 | $SUDO rm -f sources.list.new | ||
2339 | 28 | (for archive; do | ||
2340 | 29 | echo "$archive" | ||
2341 | 30 | done) | $SUDO tee sources.list.new >/dev/null | ||
2342 | 31 | $SUDO mv sources.list.new sources.list | ||
2343 | 32 | 0 | ||
2344 | === removed directory 'lib/canonical/buildd/pottery' | |||
2345 | === removed file 'lib/canonical/buildd/pottery/__init__.py' | |||
2346 | === removed file 'lib/canonical/buildd/pottery/generate_translation_templates.py' | |||
2347 | --- lib/canonical/buildd/pottery/generate_translation_templates.py 2011-11-17 22:06:34 +0000 | |||
2348 | +++ lib/canonical/buildd/pottery/generate_translation_templates.py 1970-01-01 00:00:00 +0000 | |||
2349 | @@ -1,114 +0,0 @@ | |||
2350 | 1 | #! /usr/bin/python | ||
2351 | 2 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
2352 | 3 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2353 | 4 | |||
2354 | 5 | __metaclass__ = type | ||
2355 | 6 | |||
2356 | 7 | import os.path | ||
2357 | 8 | import sys | ||
2358 | 9 | import tarfile | ||
2359 | 10 | |||
2360 | 11 | import logging | ||
2361 | 12 | |||
2362 | 13 | from bzrlib.branch import Branch | ||
2363 | 14 | from bzrlib.export import export | ||
2364 | 15 | |||
2365 | 16 | from canonical.buildd.pottery import intltool | ||
2366 | 17 | |||
2367 | 18 | |||
2368 | 19 | class GenerateTranslationTemplates: | ||
2369 | 20 | """Script to generate translation templates from a branch.""" | ||
2370 | 21 | |||
2371 | 22 | def __init__(self, branch_spec, result_name, work_dir, log_file=None): | ||
2372 | 23 | """Prepare to generate templates for a branch. | ||
2373 | 24 | |||
2374 | 25 | :param branch_spec: Either a branch URL or the path of a local | ||
2375 | 26 | branch. URLs are recognized by the occurrence of ':'. In | ||
2376 | 27 | the case of a URL, this will make up a path for the branch | ||
2377 | 28 | and check out the branch to there. | ||
2378 | 29 | :param result_name: The name of the result tarball. Should end in | ||
2379 | 30 | .tar.gz. | ||
2380 | 31 | :param work_dir: The directory to work in. Must exist. | ||
2381 | 32 | :param log_file: File-like object to log to. If None, defaults to | ||
2382 | 33 | stderr. | ||
2383 | 34 | """ | ||
2384 | 35 | self.work_dir = work_dir | ||
2385 | 36 | self.branch_spec = branch_spec | ||
2386 | 37 | self.result_name = result_name | ||
2387 | 38 | self.logger = self._setupLogger(log_file) | ||
2388 | 39 | |||
2389 | 40 | def _setupLogger(self, log_file): | ||
2390 | 41 | """Sets up and returns a logger.""" | ||
2391 | 42 | if log_file is None: | ||
2392 | 43 | log_file = sys.stderr | ||
2393 | 44 | logger = logging.getLogger("generate-templates") | ||
2394 | 45 | logger.setLevel(logging.DEBUG) | ||
2395 | 46 | ch = logging.StreamHandler(log_file) | ||
2396 | 47 | ch.setLevel(logging.DEBUG) | ||
2397 | 48 | logger.addHandler(ch) | ||
2398 | 49 | return logger | ||
2399 | 50 | |||
2400 | 51 | def _getBranch(self): | ||
2401 | 52 | """Set `self.branch_dir`, and check out branch if needed.""" | ||
2402 | 53 | if ':' in self.branch_spec: | ||
2403 | 54 | # This is a branch URL. Check out the branch. | ||
2404 | 55 | self.branch_dir = os.path.join(self.work_dir, 'source-tree') | ||
2405 | 56 | self.logger.info("Getting remote branch %s..." % self.branch_spec) | ||
2406 | 57 | self._checkout(self.branch_spec) | ||
2407 | 58 | else: | ||
2408 | 59 | # This is a local filesystem path. Use the branch in-place. | ||
2409 | 60 | self.logger.info("Using local branch %s..." % self.branch_spec) | ||
2410 | 61 | self.branch_dir = self.branch_spec | ||
2411 | 62 | |||
2412 | 63 | def _checkout(self, branch_url): | ||
2413 | 64 | """Check out a source branch to generate from. | ||
2414 | 65 | |||
2415 | 66 | The branch is checked out to the location specified by | ||
2416 | 67 | `self.branch_dir`. | ||
2417 | 68 | """ | ||
2418 | 69 | self.logger.info("Opening branch %s..." % branch_url) | ||
2419 | 70 | branch = Branch.open(branch_url) | ||
2420 | 71 | self.logger.info("Getting branch revision tree...") | ||
2421 | 72 | rev_tree = branch.basis_tree() | ||
2422 | 73 | self.logger.info("Exporting branch to %s..." % self.branch_dir) | ||
2423 | 74 | export(rev_tree, self.branch_dir) | ||
2424 | 75 | self.logger.info("Exporting branch done.") | ||
2425 | 76 | |||
2426 | 77 | def _makeTarball(self, files): | ||
2427 | 78 | """Put the given files into a tarball in the working directory.""" | ||
2428 | 79 | tarname = os.path.join(self.work_dir, self.result_name) | ||
2429 | 80 | self.logger.info("Making tarball with templates in %s..." % tarname) | ||
2430 | 81 | tarball = tarfile.open(tarname, 'w|gz') | ||
2431 | 82 | files = [name for name in files if not name.endswith('/')] | ||
2432 | 83 | for path in files: | ||
2433 | 84 | full_path = os.path.join(self.branch_dir, path) | ||
2434 | 85 | self.logger.info("Adding template %s..." % full_path) | ||
2435 | 86 | tarball.add(full_path, path) | ||
2436 | 87 | tarball.close() | ||
2437 | 88 | self.logger.info("Tarball generated.") | ||
2438 | 89 | |||
2439 | 90 | def generate(self): | ||
2440 | 91 | """Do It. Generate templates.""" | ||
2441 | 92 | self.logger.info("Generating templates for %s." % self.branch_spec) | ||
2442 | 93 | self._getBranch() | ||
2443 | 94 | pots = intltool.generate_pots(self.branch_dir) | ||
2444 | 95 | self.logger.info("Generated %d templates." % len(pots)) | ||
2445 | 96 | if len(pots) > 0: | ||
2446 | 97 | self._makeTarball(pots) | ||
2447 | 98 | return 0 | ||
2448 | 99 | |||
2449 | 100 | |||
2450 | 101 | if __name__ == '__main__': | ||
2451 | 102 | if len(sys.argv) < 3: | ||
2452 | 103 | print "Usage: %s branch resultname [workdir]" % sys.argv[0] | ||
2453 | 104 | print " 'branch' is a branch URL or directory." | ||
2454 | 105 | print " 'resultname' is the name of the result tarball." | ||
2455 | 106 | print " 'workdir' is a directory, defaults to HOME." | ||
2456 | 107 | sys.exit(1) | ||
2457 | 108 | if len(sys.argv) == 4: | ||
2458 | 109 | workdir = sys.argv[3] | ||
2459 | 110 | else: | ||
2460 | 111 | workdir = os.environ['HOME'] | ||
2461 | 112 | script = GenerateTranslationTemplates( | ||
2462 | 113 | sys.argv[1], sys.argv[2], workdir) | ||
2463 | 114 | sys.exit(script.generate()) | ||
2464 | 115 | 0 | ||
2465 | === removed file 'lib/canonical/buildd/pottery/intltool.py' | |||
2466 | --- lib/canonical/buildd/pottery/intltool.py 2011-11-17 22:06:34 +0000 | |||
2467 | +++ lib/canonical/buildd/pottery/intltool.py 1970-01-01 00:00:00 +0000 | |||
2468 | @@ -1,342 +0,0 @@ | |||
2469 | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the | ||
2470 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2471 | 3 | |||
2472 | 4 | """Functions to build PO templates on the build slave.""" | ||
2473 | 5 | |||
2474 | 6 | __metaclass__ = type | ||
2475 | 7 | __all__ = [ | ||
2476 | 8 | 'check_potfiles_in', | ||
2477 | 9 | 'generate_pot', | ||
2478 | 10 | 'generate_pots', | ||
2479 | 11 | 'get_translation_domain', | ||
2480 | 12 | 'find_intltool_dirs', | ||
2481 | 13 | 'find_potfiles_in', | ||
2482 | 14 | ] | ||
2483 | 15 | |||
2484 | 16 | from contextlib import contextmanager | ||
2485 | 17 | import errno | ||
2486 | 18 | import os.path | ||
2487 | 19 | import re | ||
2488 | 20 | from subprocess import call | ||
2489 | 21 | |||
2490 | 22 | |||
2491 | 23 | def find_potfiles_in(): | ||
2492 | 24 | """Search the current directory and its subdirectories for POTFILES.in. | ||
2493 | 25 | |||
2494 | 26 | :returns: A list of names of directories that contain a file POTFILES.in. | ||
2495 | 27 | """ | ||
2496 | 28 | result_dirs = [] | ||
2497 | 29 | for dirpath, dirnames, dirfiles in os.walk("."): | ||
2498 | 30 | if "POTFILES.in" in dirfiles: | ||
2499 | 31 | result_dirs.append(dirpath) | ||
2500 | 32 | return result_dirs | ||
2501 | 33 | |||
2502 | 34 | |||
2503 | 35 | def check_potfiles_in(path): | ||
2504 | 36 | """Check if the files listed in the POTFILES.in file exist. | ||
2505 | 37 | |||
2506 | 38 | Running 'intltool-update -m' will perform this check and also take a | ||
2507 | 39 | possible POTFILES.skip into account. It stores details about 'missing' | ||
2508 | 40 | (files that should be in POTFILES.in) and 'notexist'ing files (files | ||
2509 | 41 | that are listed in POTFILES.in but don't exist) in files which are | ||
2510 | 42 | named accordingly. These files are removed before the run. | ||
2511 | 43 | |||
2512 | 44 | We don't care about files missing from POTFILES.in but want to know if | ||
2513 | 45 | all listed files exist. The presence of the 'notexist' file tells us | ||
2514 | 46 | that. | ||
2515 | 47 | |||
2516 | 48 | :param path: The directory where POTFILES.in resides. | ||
2517 | 49 | :returns: False if the directory does not exist, if an error occurred | ||
2518 | 50 | when executing intltool-update or if files are missing from | ||
2519 | 51 | POTFILES.in. True if all went fine and all files in POTFILES.in | ||
2520 | 52 | actually exist. | ||
2521 | 53 | """ | ||
2522 | 54 | current_path = os.getcwd() | ||
2523 | 55 | |||
2524 | 56 | try: | ||
2525 | 57 | os.chdir(path) | ||
2526 | 58 | except OSError, e: | ||
2527 | 59 | # Abort nicely if the directory does not exist. | ||
2528 | 60 | if e.errno == errno.ENOENT: | ||
2529 | 61 | return False | ||
2530 | 62 | raise | ||
2531 | 63 | try: | ||
2532 | 64 | # Remove stale files from a previous run of intltool-update -m. | ||
2533 | 65 | for unlink_name in ['missing', 'notexist']: | ||
2534 | 66 | try: | ||
2535 | 67 | os.unlink(unlink_name) | ||
2536 | 68 | except OSError, e: | ||
2537 | 69 | # It's ok if the files are missing. | ||
2538 | 70 | if e.errno != errno.ENOENT: | ||
2539 | 71 | raise | ||
2540 | 72 | devnull = open("/dev/null", "w") | ||
2541 | 73 | returncode = call( | ||
2542 | 74 | ["/usr/bin/intltool-update", "-m"], | ||
2543 | 75 | stdout=devnull, stderr=devnull) | ||
2544 | 76 | devnull.close() | ||
2545 | 77 | finally: | ||
2546 | 78 | os.chdir(current_path) | ||
2547 | 79 | |||
2548 | 80 | if returncode != 0: | ||
2549 | 81 | # An error occurred when executing intltool-update. | ||
2550 | 82 | return False | ||
2551 | 83 | |||
2552 | 84 | notexist = os.path.join(path, "notexist") | ||
2553 | 85 | return not os.access(notexist, os.R_OK) | ||
2554 | 86 | |||
2555 | 87 | |||
2556 | 88 | def find_intltool_dirs(): | ||
2557 | 89 | """Search for directories with intltool structure. | ||
2558 | 90 | |||
2559 | 91 | The current directory and its subdiretories are searched. An 'intltool | ||
2560 | 92 | structure' is a directory that contains a POFILES.in file and where all | ||
2561 | 93 | files listed in that POTFILES.in do actually exist. The latter | ||
2562 | 94 | condition makes sure that the file is not stale. | ||
2563 | 95 | |||
2564 | 96 | :returns: A list of directory names. | ||
2565 | 97 | """ | ||
2566 | 98 | return sorted(filter(check_potfiles_in, find_potfiles_in())) | ||
2567 | 99 | |||
2568 | 100 | |||
2569 | 101 | def _get_AC_PACKAGE_NAME(config_file): | ||
2570 | 102 | """Get the value of AC_PACKAGE_NAME from function parameters. | ||
2571 | 103 | |||
2572 | 104 | The value of AC_PACKAGE_NAME is either the first or the fourth | ||
2573 | 105 | parameter of the AC_INIT call if it is called with at least two | ||
2574 | 106 | parameters. | ||
2575 | 107 | """ | ||
2576 | 108 | params = config_file.getFunctionParams("AC_INIT") | ||
2577 | 109 | if params is None or len(params) < 2: | ||
2578 | 110 | return None | ||
2579 | 111 | if len(params) < 4: | ||
2580 | 112 | return params[0] | ||
2581 | 113 | else: | ||
2582 | 114 | return params[3] | ||
2583 | 115 | |||
2584 | 116 | |||
2585 | 117 | def _try_substitution(config_files, varname, substitution): | ||
2586 | 118 | """Try to find a substitution in the config files. | ||
2587 | 119 | |||
2588 | 120 | :returns: The completed substitution or None if none was found. | ||
2589 | 121 | """ | ||
2590 | 122 | subst_value = None | ||
2591 | 123 | if varname == substitution.name: | ||
2592 | 124 | # Do not look for the same name in the current file. | ||
2593 | 125 | config_files = config_files[:-1] | ||
2594 | 126 | for config_file in reversed(config_files): | ||
2595 | 127 | subst_value = config_file.getVariable(substitution.name) | ||
2596 | 128 | if subst_value is not None: | ||
2597 | 129 | # Substitution found. | ||
2598 | 130 | break | ||
2599 | 131 | else: | ||
2600 | 132 | # No substitution found. | ||
2601 | 133 | return None | ||
2602 | 134 | return substitution.replace(subst_value) | ||
2603 | 135 | |||
2604 | 136 | |||
2605 | 137 | def get_translation_domain(dirname): | ||
2606 | 138 | """Get the translation domain for this PO directory. | ||
2607 | 139 | |||
2608 | 140 | Imitates some of the behavior of intltool-update to find out which | ||
2609 | 141 | translation domain the build environment provides. The domain is usually | ||
2610 | 142 | defined in the GETTEXT_PACKAGE variable in one of the build files. Another | ||
2611 | 143 | variant is DOMAIN in the Makevars file. This function goes through the | ||
2612 | 144 | ordered list of these possible locations, top to bottom, and tries to | ||
2613 | 145 | find a valid value. Since the same variable name may be defined in | ||
2614 | 146 | multiple files (usually configure.ac and Makefile.in.in), it needs to | ||
2615 | 147 | keep trying with the next file, until it finds the most specific | ||
2616 | 148 | definition. | ||
2617 | 149 | |||
2618 | 150 | If the found value contains a substitution, either autoconf style (@...@) | ||
2619 | 151 | or make style ($(...)), the search is continued in the same file and back | ||
2620 | 152 | up the list of files, now searching for the substitution. Multiple | ||
2621 | 153 | substitutions or multi-level substitutions are not supported. | ||
2622 | 154 | """ | ||
2623 | 155 | locations = [ | ||
2624 | 156 | ('../configure.ac', 'GETTEXT_PACKAGE', True), | ||
2625 | 157 | ('../configure.in', 'GETTEXT_PACKAGE', True), | ||
2626 | 158 | ('Makefile.in.in', 'GETTEXT_PACKAGE', False), | ||
2627 | 159 | ('Makevars', 'DOMAIN', False), | ||
2628 | 160 | ] | ||
2629 | 161 | value = None | ||
2630 | 162 | substitution = None | ||
2631 | 163 | config_files = [] | ||
2632 | 164 | for filename, varname, keep_trying in locations: | ||
2633 | 165 | path = os.path.join(dirname, filename) | ||
2634 | 166 | if not os.access(path, os.R_OK): | ||
2635 | 167 | # Skip non-existent files. | ||
2636 | 168 | continue | ||
2637 | 169 | config_files.append(ConfigFile(path)) | ||
2638 | 170 | new_value = config_files[-1].getVariable(varname) | ||
2639 | 171 | if new_value is not None: | ||
2640 | 172 | value = new_value | ||
2641 | 173 | if value == "AC_PACKAGE_NAME": | ||
2642 | 174 | value = _get_AC_PACKAGE_NAME(config_files[-1]) | ||
2643 | 175 | else: | ||
2644 | 176 | # Check if the value needs a substitution. | ||
2645 | 177 | substitution = Substitution.get(value) | ||
2646 | 178 | if substitution is not None: | ||
2647 | 179 | # Try to substitute with value. | ||
2648 | 180 | value = _try_substitution( | ||
2649 | 181 | config_files, varname, substitution) | ||
2650 | 182 | if value is None: | ||
2651 | 183 | # No substitution found; the setup is broken. | ||
2652 | 184 | break | ||
2653 | 185 | if value is not None and not keep_trying: | ||
2654 | 186 | # A value has been found. | ||
2655 | 187 | break | ||
2656 | 188 | return value | ||
2657 | 189 | |||
2658 | 190 | |||
2659 | 191 | @contextmanager | ||
2660 | 192 | def chdir(directory): | ||
2661 | 193 | cwd = os.getcwd() | ||
2662 | 194 | os.chdir(directory) | ||
2663 | 195 | yield | ||
2664 | 196 | os.chdir(cwd) | ||
2665 | 197 | |||
2666 | 198 | |||
2667 | 199 | def generate_pot(podir, domain): | ||
2668 | 200 | """Generate one PO template using intltool. | ||
2669 | 201 | |||
2670 | 202 | Although 'intltool-update -p' can try to find out the translation domain | ||
2671 | 203 | we trust our own code more on this one and simply specify the domain. | ||
2672 | 204 | Also, the man page for 'intltool-update' states that the '-g' option | ||
2673 | 205 | "has an additional effect: the name of current working directory is no | ||
2674 | 206 | more limited to 'po' or 'po-*'." We don't want that limit either. | ||
2675 | 207 | |||
2676 | 208 | :param podir: The PO directory in which to build template. | ||
2677 | 209 | :param domain: The translation domain to use as the name of the template. | ||
2678 | 210 | If it is None or empty, 'messages.pot' will be used. | ||
2679 | 211 | :return: True if generation succeeded. | ||
2680 | 212 | """ | ||
2681 | 213 | if domain is None or domain.strip() == "": | ||
2682 | 214 | domain = "messages" | ||
2683 | 215 | with chdir(podir): | ||
2684 | 216 | with open("/dev/null", "w") as devnull: | ||
2685 | 217 | returncode = call( | ||
2686 | 218 | ["/usr/bin/intltool-update", "-p", "-g", domain], | ||
2687 | 219 | stdout=devnull, stderr=devnull) | ||
2688 | 220 | return returncode == 0 | ||
2689 | 221 | |||
2690 | 222 | |||
2691 | 223 | def generate_pots(package_dir='.'): | ||
2692 | 224 | """Top-level function to generate all PO templates in a package.""" | ||
2693 | 225 | potpaths = [] | ||
2694 | 226 | with chdir(package_dir): | ||
2695 | 227 | for podir in find_intltool_dirs(): | ||
2696 | 228 | domain = get_translation_domain(podir) | ||
2697 | 229 | if generate_pot(podir, domain): | ||
2698 | 230 | potpaths.append(os.path.join(podir, domain + ".pot")) | ||
2699 | 231 | return potpaths | ||
2700 | 232 | |||
2701 | 233 | |||
2702 | 234 | class ConfigFile(object): | ||
2703 | 235 | """Represent a config file and return variables defined in it.""" | ||
2704 | 236 | |||
2705 | 237 | def __init__(self, file_or_name): | ||
2706 | 238 | if isinstance(file_or_name, basestring): | ||
2707 | 239 | conf_file = file(file_or_name) | ||
2708 | 240 | else: | ||
2709 | 241 | conf_file = file_or_name | ||
2710 | 242 | self.content = conf_file.read() | ||
2711 | 243 | |||
2712 | 244 | def _stripQuotes(self, identifier): | ||
2713 | 245 | """Strip surrounding quotes from `identifier`, if present. | ||
2714 | 246 | |||
2715 | 247 | :param identifier: a string, possibly surrounded by matching | ||
2716 | 248 | 'single,' "double," or [bracket] quotes. | ||
2717 | 249 | :return: `identifier` but with the outer pair of matching quotes | ||
2718 | 250 | removed, if they were there. | ||
2719 | 251 | """ | ||
2720 | 252 | if len(identifier) < 2: | ||
2721 | 253 | return identifier | ||
2722 | 254 | |||
2723 | 255 | quote_pairs = [ | ||
2724 | 256 | ('"', '"'), | ||
2725 | 257 | ("'", "'"), | ||
2726 | 258 | ("[", "]"), | ||
2727 | 259 | ] | ||
2728 | 260 | for (left, right) in quote_pairs: | ||
2729 | 261 | if identifier.startswith(left) and identifier.endswith(right): | ||
2730 | 262 | return identifier[1:-1] | ||
2731 | 263 | |||
2732 | 264 | return identifier | ||
2733 | 265 | |||
2734 | 266 | def getVariable(self, name): | ||
2735 | 267 | """Search the file for a variable definition with this name.""" | ||
2736 | 268 | pattern = re.compile( | ||
2737 | 269 | "^%s[ \t]*=[ \t]*([^\s]*)" % re.escape(name), re.M) | ||
2738 | 270 | result = pattern.search(self.content) | ||
2739 | 271 | if result is None: | ||
2740 | 272 | return None | ||
2741 | 273 | return self._stripQuotes(result.group(1)) | ||
2742 | 274 | |||
2743 | 275 | def getFunctionParams(self, name): | ||
2744 | 276 | """Search file for a function call with this name, return parameters. | ||
2745 | 277 | """ | ||
2746 | 278 | pattern = re.compile("^%s\(([^)]*)\)" % re.escape(name), re.M) | ||
2747 | 279 | result = pattern.search(self.content) | ||
2748 | 280 | if result is None: | ||
2749 | 281 | return None | ||
2750 | 282 | else: | ||
2751 | 283 | return [ | ||
2752 | 284 | self._stripQuotes(param.strip()) | ||
2753 | 285 | for param in result.group(1).split(',') | ||
2754 | 286 | ] | ||
2755 | 287 | |||
2756 | 288 | |||
2757 | 289 | class Substitution(object): | ||
2758 | 290 | """Find and replace substitutions. | ||
2759 | 291 | |||
2760 | 292 | Variable texts may contain other variables which should be substituted | ||
2761 | 293 | for their value. These are either marked by surrounding @ signs (autoconf | ||
2762 | 294 | style) or preceded by a $ sign with optional () (make style). | ||
2763 | 295 | |||
2764 | 296 | This class identifies a single such substitution in a variable text and | ||
2765 | 297 | extract the name of the variable who's value is to be inserted. It also | ||
2766 | 298 | facilitates the actual replacement so that caller does not have to worry | ||
2767 | 299 | about the substitution style that is being used. | ||
2768 | 300 | """ | ||
2769 | 301 | |||
2770 | 302 | autoconf_pattern = re.compile("@([^@]+)@") | ||
2771 | 303 | makefile_pattern = re.compile("\$\(?([^\s\)]+)\)?") | ||
2772 | 304 | |||
2773 | 305 | @staticmethod | ||
2774 | 306 | def get(variabletext): | ||
2775 | 307 | """Factory method. | ||
2776 | 308 | |||
2777 | 309 | Creates a Substitution instance and checks if it found a substitution. | ||
2778 | 310 | |||
2779 | 311 | :param variabletext: A variable value with possible substitution. | ||
2780 | 312 | :returns: A Substitution object or None if no substitution was found. | ||
2781 | 313 | """ | ||
2782 | 314 | subst = Substitution(variabletext) | ||
2783 | 315 | if subst.name is not None: | ||
2784 | 316 | return subst | ||
2785 | 317 | return None | ||
2786 | 318 | |||
2787 | 319 | def _searchForPatterns(self): | ||
2788 | 320 | """Search for all the available patterns in variable text.""" | ||
2789 | 321 | result = self.autoconf_pattern.search(self.text) | ||
2790 | 322 | if result is None: | ||
2791 | 323 | result = self.makefile_pattern.search(self.text) | ||
2792 | 324 | return result | ||
2793 | 325 | |||
2794 | 326 | def __init__(self, variabletext): | ||
2795 | 327 | """Extract substitution name from variable text.""" | ||
2796 | 328 | self.text = variabletext | ||
2797 | 329 | self.replaced = False | ||
2798 | 330 | result = self._searchForPatterns() | ||
2799 | 331 | if result is None: | ||
2800 | 332 | self._replacement = None | ||
2801 | 333 | self.name = None | ||
2802 | 334 | else: | ||
2803 | 335 | self._replacement = result.group(0) | ||
2804 | 336 | self.name = result.group(1) | ||
2805 | 337 | |||
2806 | 338 | def replace(self, value): | ||
2807 | 339 | """Return a copy of the variable text with the substitution resolved. | ||
2808 | 340 | """ | ||
2809 | 341 | self.replaced = True | ||
2810 | 342 | return self.text.replace(self._replacement, value) | ||
2811 | 343 | 0 | ||
2812 | === removed file 'lib/canonical/buildd/remove-build' | |||
2813 | --- lib/canonical/buildd/remove-build 2011-11-17 22:06:34 +0000 | |||
2814 | +++ lib/canonical/buildd/remove-build 1970-01-01 00:00:00 +0000 | |||
2815 | @@ -1,25 +0,0 @@ | |||
2816 | 1 | #!/bin/sh | ||
2817 | 2 | # | ||
2818 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
2819 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
2820 | 5 | |||
2821 | 6 | # Buildd Slave tool to remove an unmounted chroot | ||
2822 | 7 | |||
2823 | 8 | # Expects build id as arg 1, makes build-id to contain the build | ||
2824 | 9 | |||
2825 | 10 | # Needs RM to be set to a gnu rm instance | ||
2826 | 11 | # Needs SUDO to be set to a sudo instance for passwordless access | ||
2827 | 12 | |||
2828 | 13 | RM=/bin/rm | ||
2829 | 14 | SUDO=/usr/bin/sudo | ||
2830 | 15 | BUILDID="$1" | ||
2831 | 16 | |||
2832 | 17 | set -e | ||
2833 | 18 | |||
2834 | 19 | exec 2>&1 | ||
2835 | 20 | |||
2836 | 21 | echo "Removing build $BUILDID" | ||
2837 | 22 | |||
2838 | 23 | cd $HOME | ||
2839 | 24 | |||
2840 | 25 | $SUDO $RM -rf "build-$BUILDID" | ||
2841 | 26 | 0 | ||
2842 | === removed file 'lib/canonical/buildd/sbuild' | |||
2843 | --- lib/canonical/buildd/sbuild 2011-11-17 22:06:34 +0000 | |||
2844 | +++ lib/canonical/buildd/sbuild 1970-01-01 00:00:00 +0000 | |||
2845 | @@ -1,3658 +0,0 @@ | |||
2846 | 1 | #! /usr/bin/perl | ||
2847 | 2 | # | ||
2848 | 3 | # sbuild: build packages, obeying source dependencies | ||
2849 | 4 | # Copyright (C) 1998-2000 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> | ||
2850 | 5 | # | ||
2851 | 6 | # This program is free software; you can redistribute it and/or | ||
2852 | 7 | # modify it under the terms of the GNU General Public License as | ||
2853 | 8 | # published by the Free Software Foundation; either version 2 of the | ||
2854 | 9 | # License, or (at your option) any later version. | ||
2855 | 10 | # | ||
2856 | 11 | # This program is distributed in the hope that it will be useful, but | ||
2857 | 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2858 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
2859 | 14 | # General Public License for more details. | ||
2860 | 15 | # | ||
2861 | 16 | # You should have received a copy of the GNU General Public License | ||
2862 | 17 | # along with this program; if not, write to the Free Software | ||
2863 | 18 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
2864 | 19 | # | ||
2865 | 20 | # $Id: sbuild,v 1.170 2002/10/10 18:50:44 rnhodek Exp $ | ||
2866 | 21 | # | ||
2867 | 22 | # $Log: sbuild,v $ | ||
2868 | 23 | # Revision 1.170 2002/10/10 18:50:44 rnhodek | ||
2869 | 24 | # Security/accepted autobuilding patch by Ryan. | ||
2870 | 25 | # | ||
2871 | 26 | # Revision 1.169 2002/03/11 09:49:55 rnhodek | ||
2872 | 27 | # chroot_apt_options: don't just set Dir::Etc::sourcelist, but whole | ||
2873 | 28 | # Dir::Etc, to avoid new preferences. | ||
2874 | 29 | # | ||
2875 | 30 | # Revision 1.168 2002/02/07 09:12:25 rnhodek | ||
2876 | 31 | # Fixed sudo call for running scripts. | ||
2877 | 32 | # | ||
2878 | 33 | # Revision 1.167 2002/01/22 08:53:10 rnhodek | ||
2879 | 34 | # Use capitalized "Noninteractive" das DEBIAN_FRONTENT. | ||
2880 | 35 | # | ||
2881 | 36 | # Revision 1.166 2001/11/08 09:32:10 rnhodek | ||
2882 | 37 | # fetch_source_file: in case of apt, need to pass up a $dscfile with | ||
2883 | 38 | # epoch stripped. | ||
2884 | 39 | # | ||
2885 | 40 | # Revision 1.165 2001/11/07 18:04:31 rnhodek | ||
2886 | 41 | # Argl.. I should learn perl first :) | ||
2887 | 42 | # | ||
2888 | 43 | # Revision 1.164 2001/11/07 09:25:59 rnhodek | ||
2889 | 44 | # fetch_source_files: after apt-get, fix $dscfile not to contain epoch. | ||
2890 | 45 | # | ||
2891 | 46 | # Revision 1.163 2001/11/06 15:11:24 rnhodek | ||
2892 | 47 | # fetch_source_files: don't touch symlinks generated by apt-get. | ||
2893 | 48 | # | ||
2894 | 49 | # Revision 1.162 2001/11/06 12:29:22 rnhodek | ||
2895 | 50 | # New config var $use_FetchFile (default 0). | ||
2896 | 51 | # Integrated patches for using apt-get to download sources; modified so | ||
2897 | 52 | # that old code (using FetchFile.pm) still present. | ||
2898 | 53 | # run_apt: Fix parsing error of apt-output (\s matched ^M printed by | ||
2899 | 54 | # pre-configuring). | ||
2900 | 55 | # | ||
2901 | 56 | # Revision 1.161 2001/10/29 12:20:41 rnhodek | ||
2902 | 57 | # Added $fakeroot var. | ||
2903 | 58 | # | ||
2904 | 59 | # Revision 1.160 2001/10/29 08:27:53 rnhodek | ||
2905 | 60 | # Fix typo in message. | ||
2906 | 61 | # | ||
2907 | 62 | # Revision 1.159 2001/06/18 09:57:55 rnhodek | ||
2908 | 63 | # Use --database option when wanna_build_dbbase set in config. | ||
2909 | 64 | # | ||
2910 | 65 | # Revision 1.158 2001/06/01 09:54:36 rnhodek | ||
2911 | 66 | # Fix two typos. | ||
2912 | 67 | # | ||
2913 | 68 | # Revision 1.157 2001/05/31 08:08:08 rnhodek | ||
2914 | 69 | # Fixed thinko in conflicts checking (tnx James) | ||
2915 | 70 | # | ||
2916 | 71 | # Revision 1.156 2001/05/30 08:20:05 rnhodek | ||
2917 | 72 | # Use /var/lib/apt as Dir::State if exists (newer apt versions use that) | ||
2918 | 73 | # (tnx to Ryan Murray). | ||
2919 | 74 | # | ||
2920 | 75 | # Revision 1.155 2001/05/30 08:17:01 rnhodek | ||
2921 | 76 | # Print also architecture at start of log. | ||
2922 | 77 | # | ||
2923 | 78 | # Revision 1.154 2001/05/29 07:33:54 rnhodek | ||
2924 | 79 | # Also handle versioned Build-Conflicts. | ||
2925 | 80 | # (Tnx to David Schleef <ds@schleef.org>) | ||
2926 | 81 | # | ||
2927 | 82 | # Revision 1.153 2001/03/13 08:45:17 rnhodek | ||
2928 | 83 | # Run chmod -R on source tree only after unpacking. | ||
2929 | 84 | # | ||
2930 | 85 | # Revision 1.152 2001/02/19 09:23:24 rnhodek | ||
2931 | 86 | # Fix typo. | ||
2932 | 87 | # | ||
2933 | 88 | # Revision 1.151 2001/02/19 08:43:22 rnhodek | ||
2934 | 89 | # Fix wrong arch logic. | ||
2935 | 90 | # | ||
2936 | 91 | # Revision 1.150 2001/01/22 12:56:16 rnhodek | ||
2937 | 92 | # Fix handling of arch-restricted build-deps (tnx to Ryan Murray). | ||
2938 | 93 | # | ||
2939 | 94 | # Revision 1.149 2001/01/15 11:17:36 rnhodek | ||
2940 | 95 | # Fixed typo. | ||
2941 | 96 | # | ||
2942 | 97 | # Revision 1.148 2001/01/15 10:59:18 rnhodek | ||
2943 | 98 | # Shortcut when looking for non-dsc files: first try to fetch from same | ||
2944 | 99 | # dir as .dsc and FF_search only if that fails. | ||
2945 | 100 | # | ||
2946 | 101 | # Revision 1.147 2001/01/10 16:16:48 rnhodek | ||
2947 | 102 | # Move all built files from chroot dir, not only *.deb. | ||
2948 | 103 | # | ||
2949 | 104 | # Revision 1.146 2000/10/23 10:39:24 rnhodek | ||
2950 | 105 | # Before doing chmod on /etc/ld.so.conf, test if it exists at all. | ||
2951 | 106 | # | ||
2952 | 107 | # Revision 1.145 2000/10/19 09:08:35 rnhodek | ||
2953 | 108 | # A couple of little fixes from Ben. | ||
2954 | 109 | # Checks and assures that /etc/ld.so.conf is readable. | ||
2955 | 110 | # Support for local overrides with $conf::srcdep_over. | ||
2956 | 111 | # | ||
2957 | 112 | # Revision 1.144 2000/06/27 12:34:00 rnhodek | ||
2958 | 113 | # Implemented new 'prepre' and 'unpack' sections for special targets; | ||
2959 | 114 | # the first is a script run before package installation, and the latter | ||
2960 | 115 | # can list source packages that should be unpacked in the build dir. | ||
2961 | 116 | # | ||
2962 | 117 | # Revision 1.143 2000/06/20 14:39:59 rnhodek | ||
2963 | 118 | # Call apt-get with some options for relocating various files instead of | ||
2964 | 119 | # chrooting it; this avoids that the archive must be available in chroot | ||
2965 | 120 | # environment; same is true for dpkg and apt-cache calls. | ||
2966 | 121 | # If chrooted, call dpkg with the chroot dir as cwd to avoid "cannot get | ||
2967 | 122 | # current directory" errors; same for apt option DPkg::Run-Directory. | ||
2968 | 123 | # | ||
2969 | 124 | # Revision 1.142 2000/06/19 14:09:00 rnhodek | ||
2970 | 125 | # Fix syntax error. | ||
2971 | 126 | # | ||
2972 | 127 | # Revision 1.141 2000/06/19 14:05:38 rnhodek | ||
2973 | 128 | # Call buildd-addpkg with --chroot=DIR options for each dist that is >= | ||
2974 | 129 | # the one building for (to run apt-get update in the chroot | ||
2975 | 130 | # environments). | ||
2976 | 131 | # | ||
2977 | 132 | # Revision 1.140 2000/06/19 09:10:24 rnhodek | ||
2978 | 133 | # Obey new config var @ignore_watches_no_build_deps, i.e. don't flag | ||
2979 | 134 | # watches that are listed there if the package doesn't have build deps. | ||
2980 | 135 | # In check_watches(), strip $chroot_dir instead of $chroot_build_dir | ||
2981 | 136 | # from pathname. | ||
2982 | 137 | # | ||
2983 | 138 | # Revision 1.139 2000/06/13 10:54:43 rnhodek | ||
2984 | 139 | # Also execute special dependency scripts in chroot environment. | ||
2985 | 140 | # | ||
2986 | 141 | # Revision 1.138 2000/06/09 12:47:52 rnhodek | ||
2987 | 142 | # File .dsc filename for rbuilder (with URL). | ||
2988 | 143 | # | ||
2989 | 144 | # Revision 1.137 2000/06/09 09:15:21 rnhodek | ||
2990 | 145 | # Always install built package (if already) when building chroot; i.e. | ||
2991 | 146 | # the $system_level test is not necessary when chrooted. | ||
2992 | 147 | # | ||
2993 | 148 | # Revision 1.136 2000/06/09 08:20:52 rnhodek | ||
2994 | 149 | # Fixed su usage in sub build. | ||
2995 | 150 | # | ||
2996 | 151 | # Revision 1.135 2000/06/08 14:02:11 rnhodek | ||
2997 | 152 | # After changing to chroot dir, change back to be the normal user again | ||
2998 | 153 | # and start dpkg-buildpackage with -rsudo again; some packages require | ||
2999 | 154 | # that the build target is executed as non-root. | ||
3000 | 155 | # | ||
3001 | 156 | # Revision 1.134 2000/06/08 13:01:54 rnhodek | ||
3002 | 157 | # apt-cache calls need sudo, too, when using chroot. | ||
3003 | 158 | # | ||
3004 | 159 | # Revision 1.133 2000/06/08 09:13:31 rnhodek | ||
3005 | 160 | # Implemented chroot builds; there are a few new global variables | ||
3006 | 161 | # $main::chroot_*; major changes are in build, where the source tree is | ||
3007 | 162 | # unpacked somewhere else, dpkg-buildpackage called under chroot and | ||
3008 | 163 | # built packages are moved back again; also all apt-get and dpkg calls | ||
3009 | 164 | # are chroot-ed and /var/lib/dpkg/status is accessed from the chroot | ||
3010 | 165 | # environment; also watches are checked under the new root dir. | ||
3011 | 166 | # | ||
3012 | 167 | # Revision 1.132 2000/06/06 14:37:05 rnhodek | ||
3013 | 168 | # New option --source (-s): Also build source package, i.e. don't pass | ||
3014 | 169 | # -b or -B to dpkg-buildpackage. | ||
3015 | 170 | # | ||
3016 | 171 | # Revision 1.131 2000/05/30 15:41:34 rnhodek | ||
3017 | 172 | # Call buildd-addpkg with --dist option. | ||
3018 | 173 | # Install freshly built packages only if $conf::system_level >= $dist. | ||
3019 | 174 | # | ||
3020 | 175 | # Revision 1.130 2000/05/16 12:34:20 rnhodek | ||
3021 | 176 | # Insert a chmod -R go+rX on the build tree to make files readable; it | ||
3022 | 177 | # happens sometimes that files in a .orig.tar.gz have restrictive | ||
3023 | 178 | # permissions and this can be inconvenient. | ||
3024 | 179 | # | ||
3025 | 180 | # Revision 1.129 2000/03/01 14:43:34 rnhodek | ||
3026 | 181 | # Also match error message "dpkg: status database area is locked" from | ||
3027 | 182 | # apt and retry call later. | ||
3028 | 183 | # | ||
3029 | 184 | # Revision 1.128 2000/02/16 15:21:33 rnhodek | ||
3030 | 185 | # Fix a print message in merge_pkg_build_deps. | ||
3031 | 186 | # | ||
3032 | 187 | # Revision 1.127 2000/02/16 15:20:38 rnhodek | ||
3033 | 188 | # Print version number of sbuild in package log. | ||
3034 | 189 | # | ||
3035 | 190 | # Revision 1.126 2000/02/16 15:15:15 rnhodek | ||
3036 | 191 | # Fix regexp for finding !needs-no-XXX packages. | ||
3037 | 192 | # Move !needs-no-XXX from central deps to $main::additional_deps so that | ||
3038 | 193 | # they can be found by prepare_watches later. | ||
3039 | 194 | # | ||
3040 | 195 | # Revision 1.125 2000/02/15 14:40:35 rnhodek | ||
3041 | 196 | # Remove forgotten debugging code. | ||
3042 | 197 | # | ||
3043 | 198 | # Revision 1.124 2000/02/15 11:12:43 rnhodek | ||
3044 | 199 | # Expand virtual packages in package build dependencies for comparing | ||
3045 | 200 | # with central deps. | ||
3046 | 201 | # | ||
3047 | 202 | # Revision 1.123 2000/02/11 11:17:07 rnhodek | ||
3048 | 203 | # Do not activate watches for packages XXX if a negative dependency | ||
3049 | 204 | # needs-no-XXX exists (used to be just a comment, now really processed | ||
3050 | 205 | # by sbuild.) | ||
3051 | 206 | # Also do not activate watches for dependencies of pkg build deps. | ||
3052 | 207 | # | ||
3053 | 208 | # Revision 1.122 2000/02/09 15:57:25 rnhodek | ||
3054 | 209 | # In merge_pkg_build_deps, do not show warnings about missing | ||
3055 | 210 | # !this-package-does-not-exist or !needs-no-xxx dependencies. | ||
3056 | 211 | # | ||
3057 | 212 | # Revision 1.121 2000/02/04 14:04:18 rnhodek | ||
3058 | 213 | # Use --no-down-propagation. | ||
3059 | 214 | # | ||
3060 | 215 | # Revision 1.120 2000/02/01 12:05:56 rnhodek | ||
3061 | 216 | # In binNMU mode, a '_' was missing in the job name. | ||
3062 | 217 | # | ||
3063 | 218 | # Revision 1.119 2000/01/28 14:54:43 rnhodek | ||
3064 | 219 | # Accept abbrevs for distribution options (-ds, -df, -du) here, too. | ||
3065 | 220 | # New option --make-binNMU=entry. | ||
3066 | 221 | # New binNMU hack to modify debian/changelog; it will add a new entry | ||
3067 | 222 | # for the NMU version. | ||
3068 | 223 | # New helper function binNMU_version to generate a new version number. | ||
3069 | 224 | # | ||
3070 | 225 | # Revision 1.118 2000/01/13 14:32:30 rnhodek | ||
3071 | 226 | # For compiling on slink systems, pass the --force-confold option to | ||
3072 | 227 | # dpkg only for versions < 1.4.1.18 (that don't understand it yet). | ||
3073 | 228 | # | ||
3074 | 229 | # Revision 1.117 1999/12/17 13:49:50 rnhodek | ||
3075 | 230 | # Improved output about missing central deps: build-essential (act. | ||
3076 | 231 | # policy) and dependencies of pkg build deps are filtered out and | ||
3077 | 232 | # printed separately. | ||
3078 | 233 | # New functions cmp_dep_lists, read_build_essential, | ||
3079 | 234 | # expand_dependencies, and get_dependencies for the above. | ||
3080 | 235 | # | ||
3081 | 236 | # Revision 1.116 1999/12/17 11:04:43 rnhodek | ||
3082 | 237 | # When pkg build-deps were read from debian/sbuild-build-deps, a wrong | ||
3083 | 238 | # package name was used. | ||
3084 | 239 | # | ||
3085 | 240 | # Revision 1.115 1999/12/09 09:54:42 rnhodek | ||
3086 | 241 | # Again fixed a fatal typo... | ||
3087 | 242 | # | ||
3088 | 243 | # Revision 1.114 1999/12/08 12:33:16 rnhodek | ||
3089 | 244 | # merge_pkg_build_deps: Fix printing of overrides. | ||
3090 | 245 | # | ||
3091 | 246 | # Revision 1.113 1999/12/08 12:25:34 rnhodek | ||
3092 | 247 | # Special dependencies are implicitly overrides, i.e. are added to the | ||
3093 | 248 | # package-provided build deps. | ||
3094 | 249 | # | ||
3095 | 250 | # Revision 1.112 1999/12/08 11:31:38 rnhodek | ||
3096 | 251 | # get_dpkg_status: don't reset $res{$pkg}->{Installed} to 0 if $pkg is | ||
3097 | 252 | # provided. | ||
3098 | 253 | # | ||
3099 | 254 | # Revision 1.111 1999/12/08 10:37:33 rnhodek | ||
3100 | 255 | # Change parsing of .dsc file so that multi-line build dependencies are | ||
3101 | 256 | # allowed. | ||
3102 | 257 | # Make warning about missing central deps a bit bigger. | ||
3103 | 258 | # | ||
3104 | 259 | # Revision 1.110 1999/12/06 15:00:33 rnhodek | ||
3105 | 260 | # Fix comparison with old deps (must copy them, not only the reference). | ||
3106 | 261 | # | ||
3107 | 262 | # Revision 1.109 1999/12/06 08:35:53 rnhodek | ||
3108 | 263 | # Fixed typo. | ||
3109 | 264 | # | ||
3110 | 265 | # Revision 1.108 1999/12/03 09:58:16 rnhodek | ||
3111 | 266 | # If a pkg has its own build deps, compare them with the central ones | ||
3112 | 267 | # and report missing ones. | ||
3113 | 268 | # | ||
3114 | 269 | # Revision 1.107 1999/11/30 13:54:38 rnhodek | ||
3115 | 270 | # Print a message if build deps from the .dsc are used (to avoid confusion). | ||
3116 | 271 | # If a pkg has build deps, store them in debian/.sbuild-build-deps to | ||
3117 | 272 | # have them available when rebuilding later (no .dsc anymore); also | ||
3118 | 273 | # check for this file and read deps from it if building without a .dsc | ||
3119 | 274 | # in unpacked source. | ||
3120 | 275 | # | ||
3121 | 276 | # Revision 1.106 1999/11/15 12:30:15 rnhodek | ||
3122 | 277 | # merge_pkg_build_deps: added missing if $main::debug. | ||
3123 | 278 | # | ||
3124 | 279 | # Revision 1.105 1999/11/03 14:56:32 rnhodek | ||
3125 | 280 | # When running apt, set env var DEBIAN_FRONTEND to noninteractive to | ||
3126 | 281 | # stop debconf from asking questions or complaining that /dev/tty can't | ||
3127 | 282 | # be opened. | ||
3128 | 283 | # | ||
3129 | 284 | # Revision 1.104 1999/11/02 16:43:51 rnhodek | ||
3130 | 285 | # check_inst_packages: also upgrade dependencies of src-deps (if they're | ||
3131 | 286 | # already installed); some -dev packages fail to correctly require an | ||
3132 | 287 | # identical versioned shlib pkg, so in some cases only the -dev pkg was | ||
3133 | 288 | # installed. | ||
3134 | 289 | # | ||
3135 | 290 | # Revision 1.103 1999/11/02 15:45:43 rnhodek | ||
3136 | 291 | # build: Use epoch-stripped version number for the .changes file. | ||
3137 | 292 | # check_inst_packages: forgot a if $main::debug. | ||
3138 | 293 | # | ||
3139 | 294 | # Revision 1.102 1999/10/29 13:07:49 rnhodek | ||
3140 | 295 | # New option --stats-dir=DIR; if used, a "1" is appended to | ||
3141 | 296 | # DIR/give-back each time a package is given back. | ||
3142 | 297 | # | ||
3143 | 298 | # Revision 1.101 1999/10/29 12:32:24 rnhodek | ||
3144 | 299 | # If using an already unpacked source tree, check (with | ||
3145 | 300 | # dpkg-parsechangelog) if it's really the requested version. | ||
3146 | 301 | # Make apt-get run dpkg with --force-confold, as the </dev/null trick | ||
3147 | 302 | # doesn't work anymore with dpkg >= 1.4.1.18. | ||
3148 | 303 | # | ||
3149 | 304 | # Revision 1.100 1999/10/25 12:12:21 rnhodek | ||
3150 | 305 | # check_inst_packages: Add packages to @deps_inst only if they're not | ||
3151 | 306 | # already to be installed. | ||
3152 | 307 | # | ||
3153 | 308 | # Revision 1.99 1999/10/22 09:01:36 rnhodek | ||
3154 | 309 | # Minor changes to output of check_inst_packages. | ||
3155 | 310 | # | ||
3156 | 311 | # Revision 1.98 1999/10/21 14:21:57 rnhodek | ||
3157 | 312 | # Oops... call check_inst_packages only if build was successful. | ||
3158 | 313 | # | ||
3159 | 314 | # Revision 1.97 1999/10/21 11:46:50 rnhodek | ||
3160 | 315 | # Deleted RCS logs for < 1.50. | ||
3161 | 316 | # New option --store-built-packages. | ||
3162 | 317 | # Fix package name parsing: \w also matches '_' which is unwanted; | ||
3163 | 318 | # replace by a-zA-Z. | ||
3164 | 319 | # Read reverse sourcedeps of $main::store_built_packages. | ||
3165 | 320 | # New sub check_inst_packages. | ||
3166 | 321 | # | ||
3167 | 322 | # Revision 1.96 1999/09/27 11:18:10 rnhodek | ||
3168 | 323 | # Added a missing PLOG. | ||
3169 | 324 | # | ||
3170 | 325 | # Revision 1.95 1999/09/15 09:10:25 rnhodek | ||
3171 | 326 | # Additionally print a warning if a special dep has a version relation. | ||
3172 | 327 | # | ||
3173 | 328 | # Revision 1.94 1999/09/15 09:08:12 rnhodek | ||
3174 | 329 | # Changed parsing of dependencies a bit so that special deps can have | ||
3175 | 330 | # arch restrictions, too. | ||
3176 | 331 | # | ||
3177 | 332 | # Revision 1.93 1999/08/30 09:44:35 rnhodek | ||
3178 | 333 | # get_dpkg_status: don't exit too early if a pkg isn't in the arg list, | ||
3179 | 334 | # as it might be provided only. | ||
3180 | 335 | # | ||
3181 | 336 | # Revision 1.92 1999/08/27 13:32:04 rnhodek | ||
3182 | 337 | # --auto-give-back has a new optional argument, the user and hostname | ||
3183 | 338 | # where to call wanna-build (like $conf::sshcmd); this is needed that | ||
3184 | 339 | # sbuild can do give-backs when there's no local wanna-build. | ||
3185 | 340 | # | ||
3186 | 341 | # Revision 1.91 1999/08/23 12:53:02 rnhodek | ||
3187 | 342 | # Support for alternatives. | ||
3188 | 343 | # Support for [ARCH1 !ARCH2] arch restriction on dependencies. | ||
3189 | 344 | # Parses only src-deps which are needed for packages to be built. | ||
3190 | 345 | # Reads Build-{Depends,Conflicts}{,-Indep}: fields from .dsc if present; | ||
3191 | 346 | # those override the central src-deps, except those marked as override | ||
3192 | 347 | # (& prefix). | ||
3193 | 348 | # Implemented abbrevs as kind of macros in src-deps. | ||
3194 | 349 | # New option --add-depends (-a). | ||
3195 | 350 | # New option --arch-all (-A). | ||
3196 | 351 | # | ||
3197 | 352 | # Revision 1.90 1999/08/11 15:28:11 rnhodek | ||
3198 | 353 | # Insert missing wait call in run_script to get correct return value. | ||
3199 | 354 | # | ||
3200 | 355 | # Revision 1.89 1999/08/10 14:01:49 rnhodek | ||
3201 | 356 | # Virtual packages as dependencies didn't work really yet -- the | ||
3202 | 357 | # consistency check didn't see them (dpkg --status doesn't know them) | ||
3203 | 358 | # and thus aborted the build; solution: get_dpkg_status now directly | ||
3204 | 359 | # reads the status file (which should be a bit faster, too) and extracts | ||
3205 | 360 | # Provides: fields of all installed packages and considers those virtual | ||
3206 | 361 | # packages installed, too. | ||
3207 | 362 | # Print "Source-dependencies not satisfied" message to package log, not | ||
3208 | 363 | # to sbuild log. | ||
3209 | 364 | # Same in run_apt for virtual package handling. | ||
3210 | 365 | # Fix stdout/stderr redirecting when running scripts. | ||
3211 | 366 | # | ||
3212 | 367 | # Revision 1.88 1999/07/13 07:23:55 rnhodek | ||
3213 | 368 | # Use GDBM for time/space databases, as perl-5.004 seems not to contain | ||
3214 | 369 | # DB_File anymore. | ||
3215 | 370 | # | ||
3216 | 371 | # Revision 1.87 1999/06/21 12:52:00 rnhodek | ||
3217 | 372 | # Seems apt has a new error message if a cached Packages file isn't | ||
3218 | 373 | # up-to-date anymore -- recognize this msg, too, and reun apt-get update. | ||
3219 | 374 | # | ||
3220 | 375 | # Revision 1.86 1999/06/09 15:05:38 rnhodek | ||
3221 | 376 | # Fix loop in apply_patches. | ||
3222 | 377 | # Don't fail due to failed patch if a global patch. | ||
3223 | 378 | # Global patches are no syntax error when parsing src-deps... | ||
3224 | 379 | # | ||
3225 | 380 | # Revision 1.85 1999/06/04 09:47:02 rnhodek | ||
3226 | 381 | # Add support for global patches, which will be tried on any package; | ||
3227 | 382 | # their names in source-dependencies start with "**". | ||
3228 | 383 | # | ||
3229 | 384 | # Revision 1.84 1999/06/04 08:17:17 rnhodek | ||
3230 | 385 | # When calling wanna-build --give-back, don't forget the --dist argument! | ||
3231 | 386 | # Added support for virtual packages as source dependencies: apt-get tells us | ||
3232 | 387 | # which alternatives are possible, and one of these is selected either by | ||
3233 | 388 | # %conf::alternatives or by random. | ||
3234 | 389 | # | ||
3235 | 390 | # Revision 1.83 1999/06/02 09:07:47 rnhodek | ||
3236 | 391 | # With --batch, write each finished job to SBUILD-FINISHED; buildd can pick up | ||
3237 | 392 | # this file if sbuild crashes and needs not rebuild already done stuff. The file | ||
3238 | 393 | # is removed on normal exit and if sbuild dumps to REDO during a shutdown. | ||
3239 | 394 | # | ||
3240 | 395 | # Revision 1.82 1999/06/02 08:47:39 rnhodek | ||
3241 | 396 | # Remove as many die's as possible -- the bad exit status can cause | ||
3242 | 397 | # buildd to retry all packages of an sbuild run; better let this one | ||
3243 | 398 | # package fail. | ||
3244 | 399 | # Make sure that after build() we're in the correct directory: some | ||
3245 | 400 | # chdir()s were missing; also don't chdir("..") because this can be | ||
3246 | 401 | # wrong if we followed a symlink, use $main::cwd instead. | ||
3247 | 402 | # If the package directory already exists as a symlink, abort the build. | ||
3248 | 403 | # | ||
3249 | 404 | # Revision 1.81 1999/05/31 12:59:41 rnhodek | ||
3250 | 405 | # Run du after build under sudo, to avoid error messages about | ||
3251 | 406 | # unreadable dirs. | ||
3252 | 407 | # | ||
3253 | 408 | # Revision 1.80 1999/05/27 13:28:04 rnhodek | ||
3254 | 409 | # Oops, missed an epoch fix (when constructing the .changes file name). | ||
3255 | 410 | # | ||
3256 | 411 | # Revision 1.79 1999/05/26 11:34:11 rnhodek | ||
3257 | 412 | # Ignore epochs for fetching files. | ||
3258 | 413 | # | ||
3259 | 414 | # Revision 1.78 1999/05/26 09:48:23 rnhodek | ||
3260 | 415 | # If dpkg-source fails, remove .tmp-nest dir. | ||
3261 | 416 | # | ||
3262 | 417 | # Revision 1.77 1999/05/05 07:56:51 rnhodek | ||
3263 | 418 | # Need to empty %main::this_watches before filling it for a new package; | ||
3264 | 419 | # otherwise we have some spurious reports :-) | ||
3265 | 420 | # | ||
3266 | 421 | # Revision 1.76 1999/05/04 14:51:40 rnhodek | ||
3267 | 422 | # Some more minor stuff for avg-build-space: Reset global | ||
3268 | 423 | # $main::this_space to 0 before each build to avoid using the figure of | ||
3269 | 424 | # the previous package in case of errors; don't write a 0 value into the | ||
3270 | 425 | # database. | ||
3271 | 426 | # | ||
3272 | 427 | # Revision 1.75 1999/05/04 14:43:01 rnhodek | ||
3273 | 428 | # Fix parsing of a single dependency: package name never should contain | ||
3274 | 429 | # a '('. | ||
3275 | 430 | # | ||
3276 | 431 | # Revision 1.74 1999/05/04 14:29:51 rnhodek | ||
3277 | 432 | # Determine how much space is required for a build (final build dir + | ||
3278 | 433 | # generated .debs) after dpkg-buildpackage is finished; display figure | ||
3279 | 434 | # in package log and also store it in $conf::avg_space_db (analogous to | ||
3280 | 435 | # avg_time_db). | ||
3281 | 436 | # | ||
3282 | 437 | # Revision 1.73 1999/05/03 12:53:25 rnhodek | ||
3283 | 438 | # After unpacking src dir, run "chmod -R g-s ." on it; some | ||
3284 | 439 | # .orig.tar.gz's are packed with the setgid bit, which causes the debian | ||
3285 | 440 | # dir and all subdirs to be created setgid, too, and later dpkg-deb | ||
3286 | 441 | # --build complains about this. | ||
3287 | 442 | # | ||
3288 | 443 | # Revision 1.72 1999/04/22 14:16:25 rnhodek | ||
3289 | 444 | # Don't kill tee process if verbose but --nolog set -- $pkg_tee_pid | ||
3290 | 445 | # undefined then! | ||
3291 | 446 | # | ||
3292 | 447 | # Revision 1.71 1999/04/21 14:54:10 rnhodek | ||
3293 | 448 | # Implemented watches if certain binaries have been used during a build | ||
3294 | 449 | # without a source dependency. | ||
3295 | 450 | # | ||
3296 | 451 | # Revision 1.70 1999/03/12 10:29:32 rnhodek | ||
3297 | 452 | # New option --force-depends (-f) to override src-deps of a package. | ||
3298 | 453 | # | ||
3299 | 454 | |||
3300 | 455 | BEGIN { | ||
3301 | 456 | ($main::HOME = $ENV{'HOME'}) | ||
3302 | 457 | or die "HOME not defined in environment!\n"; | ||
3303 | 458 | push( @INC, "$main::HOME/lib" ); | ||
3304 | 459 | } | ||
3305 | 460 | |||
3306 | 461 | chomp( $main::HOSTNAME = `hostname` ); | ||
3307 | 462 | |||
3308 | 463 | package conf; | ||
3309 | 464 | $HOME = $main::HOME; | ||
3310 | 465 | # defaults: | ||
3311 | 466 | @dist_parts = qw(main contrib non-free); | ||
3312 | 467 | $source_dependencies = "/etc/source-dependencies"; | ||
3313 | 468 | $mailprog = "/usr/sbin/sendmail"; | ||
3314 | 469 | $dpkg = "/usr/bin/dpkg"; | ||
3315 | 470 | $sudo = "/usr/bin/sudo"; | ||
3316 | 471 | $su = "/bin/su"; | ||
3317 | 472 | $fakeroot = "/usr/bin/fakeroot"; | ||
3318 | 473 | $apt_get = "/usr/bin/apt-get"; | ||
3319 | 474 | $apt_cache = "/usr/bin/apt-cache"; | ||
3320 | 475 | $dpkg_source = "/usr/bin/dpkg-source"; | ||
3321 | 476 | $build_env_cmnd = ""; | ||
3322 | 477 | $pgp_options = "-us -uc"; | ||
3323 | 478 | $log_dir = "$main::HOME/logs"; | ||
3324 | 479 | $mailto = ""; | ||
3325 | 480 | $purge_build_directory = "successful"; | ||
3326 | 481 | @toolchain_regex = ( 'binutils$', 'gcc-[\d.]+$', 'g\+\+-[\d.]+$', 'libstdc\+\+', 'libc[\d.]+-dev$', 'linux-kernel-headers$', 'dpkg-dev$', 'make$' ); | ||
3327 | 482 | $stalled_pkg_timeout = 90; # minutes | ||
3328 | 483 | $srcdep_lock_wait = 1; # minutes | ||
3329 | 484 | %individual_stalled_pkg_timeout = (); | ||
3330 | 485 | $path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/games"; | ||
3331 | 486 | # read conf files | ||
3332 | 487 | require "/etc/sbuild.conf" if -r "/etc/sbuild.conf"; | ||
3333 | 488 | require "$HOME/.sbuildrc" if -r "$HOME/.sbuildrc"; | ||
3334 | 489 | # some checks | ||
3335 | 490 | #die "mailprog binary $conf::mailprog does not exist or isn't executable\n" | ||
3336 | 491 | # if !-x $conf::mailprog; | ||
3337 | 492 | die "sudo binary $conf::sudo does not exist or isn't executable\n" | ||
3338 | 493 | if !-x $conf::sudo; | ||
3339 | 494 | die "apt-get binary $conf::apt_get does not exist or isn't executable\n" | ||
3340 | 495 | if !-x $conf::apt_get; | ||
3341 | 496 | die "apt-cache binary $conf::apt_cache does not exist or isn't executable\n" | ||
3342 | 497 | if !-x $conf::apt_cache; | ||
3343 | 498 | die "dpkg-source binary $conf::dpkg_source does not exist or isn't executable\n" | ||
3344 | 499 | if !-x $conf::dpkg_source; | ||
3345 | 500 | #die "$conf::log_dir is not a directory\n" if ! -d $conf::log_dir; | ||
3346 | 501 | die "$conf::srcdep_lock_dir is not a directory\n" if ! -d $conf::srcdep_lock_dir; | ||
3347 | 502 | die "conf::mailto not set\n" if !$conf::mailto; | ||
3348 | 503 | package main; | ||
3349 | 504 | |||
3350 | 505 | use strict; | ||
3351 | 506 | use GDBM_File; | ||
3352 | 507 | use POSIX; | ||
3353 | 508 | use FileHandle; | ||
3354 | 509 | use Cwd; | ||
3355 | 510 | |||
3356 | 511 | # avoid intermixing of stdout and stderr | ||
3357 | 512 | $| = 1; | ||
3358 | 513 | |||
3359 | 514 | # We should not ignore HUP for our children - it breaks test suites. | ||
3360 | 515 | # in case the terminal disappears, the build should continue | ||
3361 | 516 | #$SIG{'HUP'} = 'IGNORE'; | ||
3362 | 517 | |||
3363 | 518 | $main::distribution = ""; | ||
3364 | 519 | $main::distribution = $conf::default_distribution if $conf::default_distribution; | ||
3365 | 520 | |||
3366 | 521 | chomp( $main::arch = `$conf::dpkg --print-architecture` ); | ||
3367 | 522 | $main::username = (getpwuid($<))[0] || $ENV{'LOGNAME'} || $ENV{'USER'}; | ||
3368 | 523 | $main::debug = 0; | ||
3369 | 524 | $main::verbose = 0; | ||
3370 | 525 | $main::batchmode = 0; | ||
3371 | 526 | $main::auto_giveback = 0; | ||
3372 | 527 | $main::nomail = 0; | ||
3373 | 528 | $main::build_arch_all = 0; | ||
3374 | 529 | $main::build_source = 0; | ||
3375 | 530 | $main::jobs_file = cwd() . "/build-progress"; | ||
3376 | 531 | $main::max_lock_trys = 120; | ||
3377 | 532 | $main::lock_interval = 5; | ||
3378 | 533 | $main::cwd = cwd(); | ||
3379 | 534 | $main::ilock_file = "$conf::srcdep_lock_dir/install"; | ||
3380 | 535 | $main::srcdep_lock_cnt = 0; | ||
3381 | 536 | $main::chroot_dir = ""; | ||
3382 | 537 | $main::chroot_build_dir = ""; | ||
3383 | 538 | $main::chroot_apt_options = ""; | ||
3384 | 539 | @main::toolchain_pkgs = (); | ||
3385 | 540 | $main::component=""; | ||
3386 | 541 | $main::nr_processors = $ENV{'NR_PROCESSORS'} if $ENV{'NR_PROCESSORS'}; | ||
3387 | 542 | |||
3388 | 543 | umask(022); | ||
3389 | 544 | |||
3390 | 545 | $main::new_dpkg = 0; | ||
3391 | 546 | check_dpkg_version(); | ||
3392 | 547 | |||
3393 | 548 | while( @ARGV && $ARGV[0] =~ /^-/ ) { | ||
3394 | 549 | $_ = shift @ARGV; | ||
3395 | 550 | if (/^-v$/ || /^--verbose$/) { | ||
3396 | 551 | $main::verbose++; | ||
3397 | 552 | } | ||
3398 | 553 | elsif (/^-D$/ || /^--debug$/) { | ||
3399 | 554 | $main::debug++; | ||
3400 | 555 | } | ||
3401 | 556 | elsif (/^-b$/ || /^--batch$/) { | ||
3402 | 557 | $main::batchmode = 1; | ||
3403 | 558 | } | ||
3404 | 559 | elsif (/^-n$/ || /^--nolog$/) { | ||
3405 | 560 | $main::nolog = 1; | ||
3406 | 561 | } | ||
3407 | 562 | elsif (/^-A$/ || /^--arch-all$/) { | ||
3408 | 563 | $main::build_arch_all++; | ||
3409 | 564 | } | ||
3410 | 565 | elsif (/^-s$/ || /^--source$/) { | ||
3411 | 566 | $main::build_source++; | ||
3412 | 567 | $conf::purge_build_directory = "never"; | ||
3413 | 568 | } | ||
3414 | 569 | elsif (/^--architecture=(.)/) { | ||
3415 | 570 | $conf::arch=$1.$'; | ||
3416 | 571 | } | ||
3417 | 572 | elsif (/^--archive=(.)/) { | ||
3418 | 573 | $main::archive=$1.$'; | ||
3419 | 574 | } | ||
3420 | 575 | elsif (/^--comp=(.)/) { | ||
3421 | 576 | $main::component=$1.$'; | ||
3422 | 577 | } | ||
3423 | 578 | elsif (/^--purpose=(.)/) { | ||
3424 | 579 | $main::purpose=$1.$'; | ||
3425 | 580 | } | ||
3426 | 581 | elsif (/^--build-debug-symbols$/) { | ||
3427 | 582 | $main::build_debug_symbols = 1; | ||
3428 | 583 | } | ||
3429 | 584 | elsif (/^-d/ || /^--dist/) { | ||
3430 | 585 | if (/^-d(.)/ || /^--dist=(.)/) { | ||
3431 | 586 | $main::distribution = $1.$'; | ||
3432 | 587 | } | ||
3433 | 588 | elsif (!@ARGV) { | ||
3434 | 589 | die "$_ option missing argument\n"; | ||
3435 | 590 | } | ||
3436 | 591 | else { | ||
3437 | 592 | $main::distribution = shift @ARGV; | ||
3438 | 593 | } | ||
3439 | 594 | $main::distribution = "stable" if $main::distribution eq "s"; | ||
3440 | 595 | $main::distribution = "testing" if $main::distribution eq "t"; | ||
3441 | 596 | $main::distribution = "unstable" if $main::distribution eq "u"; | ||
3442 | 597 | } | ||
3443 | 598 | elsif (/^-p/ || /^--purge/) { | ||
3444 | 599 | if (/^-p(.)/ || /^--purge=(.)/) { | ||
3445 | 600 | $conf::purge_build_directory = $1.$'; | ||
3446 | 601 | } | ||
3447 | 602 | elsif (!@ARGV) { | ||
3448 | 603 | die "$_ option missing argument\n"; | ||
3449 | 604 | } | ||
3450 | 605 | else { | ||
3451 | 606 | $conf::purge_build_directory = shift @ARGV; | ||
3452 | 607 | } | ||
3453 | 608 | die "Bad purge mode\n" | ||
3454 | 609 | if !isin($conf::purge_build_directory, qw(always successful never)); | ||
3455 | 610 | } | ||
3456 | 611 | elsif (/^-m/ || /^--maintainer/) { | ||
3457 | 612 | if (/^-m(.)/ || /^--maintainer=(.)/) { | ||
3458 | 613 | $conf::maintainer_name = $1.$'; | ||
3459 | 614 | } | ||
3460 | 615 | elsif (!@ARGV) { | ||
3461 | 616 | die "$_ option missing argument\n"; | ||
3462 | 617 | } | ||
3463 | 618 | else { | ||
3464 | 619 | $conf::maintainer_name = shift @ARGV; | ||
3465 | 620 | } | ||
3466 | 621 | } | ||
3467 | 622 | elsif (/^-f/ || /^--force-depends/) { | ||
3468 | 623 | if (/^-f(.)/ || /^--force-depends=(.)/) { | ||
3469 | 624 | push( @main::manual_srcdeps, "f".$1.$' ); | ||
3470 | 625 | } | ||
3471 | 626 | elsif (!@ARGV) { | ||
3472 | 627 | die "$_ option missing argument\n"; | ||
3473 | 628 | } | ||
3474 | 629 | else { | ||
3475 | 630 | push( @main::manual_srcdeps, "f".(shift @ARGV) ); | ||
3476 | 631 | } | ||
3477 | 632 | } | ||
3478 | 633 | elsif (/^-a/ || /^--add-depends/) { | ||
3479 | 634 | if (/^-a(.)/ || /^--add-depends=(.)/) { | ||
3480 | 635 | push( @main::manual_srcdeps, "a".$1.$' ); | ||
3481 | 636 | } | ||
3482 | 637 | elsif (!@ARGV) { | ||
3483 | 638 | die "$_ option missing argument\n"; | ||
3484 | 639 | } | ||
3485 | 640 | else { | ||
3486 | 641 | push( @main::manual_srcdeps, "a".(shift @ARGV) ); | ||
3487 | 642 | } | ||
3488 | 643 | } | ||
3489 | 644 | elsif (/^--auto-give-back(=(.*))?$/) { | ||
3490 | 645 | $main::auto_giveback = 1; | ||
3491 | 646 | if ($2) { | ||
3492 | 647 | my @parts = split( '@', $2 ); | ||
3493 | 648 | $main::auto_giveback_socket = "$main::HOME/build" if @parts > 3; | ||
3494 | 649 | $main::auto_giveback_socket .= $parts[$#parts-3] if @parts > 3; | ||
3495 | 650 | $main::auto_giveback_wb_user = $parts[$#parts-2] if @parts > 2; | ||
3496 | 651 | $main::auto_giveback_user = $parts[$#parts-1] if @parts > 1; | ||
3497 | 652 | $main::auto_giveback_host = $parts[$#parts]; | ||
3498 | 653 | } | ||
3499 | 654 | } | ||
3500 | 655 | elsif (/^--database=(.+)$/) { | ||
3501 | 656 | $main::database = $1; | ||
3502 | 657 | } | ||
3503 | 658 | elsif (/^--stats-dir=(.+)$/) { | ||
3504 | 659 | $main::stats_dir = $1; | ||
3505 | 660 | } | ||
3506 | 661 | elsif (/^--make-binNMU=(.+)$/) { | ||
3507 | 662 | $main::binNMU = $1; | ||
3508 | 663 | $main::binNMUver ||= 1; | ||
3509 | 664 | } | ||
3510 | 665 | elsif (/^--binNMU=(\d+)$/) { | ||
3511 | 666 | $main::binNMUver = $1; | ||
3512 | 667 | } | ||
3513 | 668 | elsif (/^--use-snapshot$/) { | ||
3514 | 669 | $main::useSNAP = 1; | ||
3515 | 670 | $main::ld_library_path = "/usr/lib/gcc-snapshot/lib"; | ||
3516 | 671 | $conf::path = "/usr/lib/gcc-snapshot/bin:$conf::path"; | ||
3517 | 672 | } | ||
3518 | 673 | else { | ||
3519 | 674 | die "Unknown option: $_\n"; | ||
3520 | 675 | } | ||
3521 | 676 | } | ||
3522 | 677 | |||
3523 | 678 | die "Need distribution\n" if $main::distribution eq ""; | ||
3524 | 679 | |||
3525 | 680 | $conf::mailto = $conf::mailto{$main::distribution} | ||
3526 | 681 | if $conf::mailto{$main::distribution}; | ||
3527 | 682 | |||
3528 | 683 | $main::arch = $conf::arch if $conf::arch; | ||
3529 | 684 | |||
3530 | 685 | # variables for scripts: | ||
3531 | 686 | open_log(); | ||
3532 | 687 | $SIG{'INT'} = \&shutdown; | ||
3533 | 688 | $SIG{'TERM'} = \&shutdown; | ||
3534 | 689 | $SIG{'ALRM'} = \&shutdown; | ||
3535 | 690 | $SIG{'PIPE'} = \&shutdown; | ||
3536 | 691 | read_deps( map { m,(?:.*/)?([^_/]+)[^/]*, } @ARGV ); | ||
3537 | 692 | if (-d "chroot-autobuild") { | ||
3538 | 693 | $main::chroot_dir = "chroot-autobuild"; | ||
3539 | 694 | $main::chroot_build_dir = "$main::chroot_dir/build/$main::username/"; | ||
3540 | 695 | $conf::srcdep_lock_dir = "$main::chroot_dir/var/debbuild/srcdep-lock"; | ||
3541 | 696 | $main::ilock_file = "$conf::srcdep_lock_dir/install"; | ||
3542 | 697 | my $absroot = "$main::cwd/$main::chroot_dir"; | ||
3543 | 698 | $main::chroot_apt_options = | ||
3544 | 699 | "-o APT::Architecture=$main::arch ". | ||
3545 | 700 | "-o Dir::State=$absroot/var/". | ||
3546 | 701 | (-d "$absroot/var/lib/apt" ? "lib":"state")."/apt ". | ||
3547 | 702 | "-o Dir::State::status=$absroot/var/lib/dpkg/status ". | ||
3548 | 703 | "-o Dir::Cache=$absroot/var/cache/apt ". | ||
3549 | 704 | "-o Dir::Etc=$absroot/etc/apt ". | ||
3550 | 705 | "-o DPkg::Options::=--root=$absroot ". | ||
3551 | 706 | "-o DPkg::Options::=--force-architecture ". | ||
3552 | 707 | "-o DPkg::Run-Directory=$absroot"; | ||
3553 | 708 | $main::chroot_apt_op = '$CHROOT_OPTIONS'; | ||
3554 | 709 | } | ||
3555 | 710 | write_jobs_file(); | ||
3556 | 711 | |||
3557 | 712 | my( $pkgv, $pkg ); | ||
3558 | 713 | foreach $pkgv (@ARGV) { | ||
3559 | 714 | my $urlbase; | ||
3560 | 715 | |||
3561 | 716 | |||
3562 | 717 | ($urlbase, $pkgv) = ($1, $3) if $pkgv =~ m,^(\w+://(\S+/)?)([^/]+)$,; | ||
3563 | 718 | $pkgv =~ s/\.dsc$//; | ||
3564 | 719 | next if !open_pkg_log( $pkgv ); | ||
3565 | 720 | (my $pkg = $pkgv) =~ s/_.*$//; | ||
3566 | 721 | $main::pkg_start_time = time; | ||
3567 | 722 | $main::this_space = 0; | ||
3568 | 723 | $main::pkg_status = "failed"; # assume for now | ||
3569 | 724 | $main::current_job = $main::binNMU_name || $pkgv; | ||
3570 | 725 | $main::additional_deps = []; | ||
3571 | 726 | write_jobs_file( "currently building" ); | ||
3572 | 727 | if (should_skip( $pkgv )) { | ||
3573 | 728 | $main::pkg_status = "skipped"; | ||
3574 | 729 | goto cleanup_close; | ||
3575 | 730 | } | ||
3576 | 731 | my $dscfile = $pkgv.".dsc"; | ||
3577 | 732 | $main::pkg_fail_stage = "fetch-src"; | ||
3578 | 733 | my @files_to_rm = fetch_source_files( \$dscfile ); | ||
3579 | 734 | if (@files_to_rm && $files_to_rm[0] eq "ERROR") { | ||
3580 | 735 | shift @files_to_rm; | ||
3581 | 736 | goto cleanup_symlinks; | ||
3582 | 737 | } | ||
3583 | 738 | |||
3584 | 739 | $main::pkg_fail_stage = "install-deps"; | ||
3585 | 740 | if (!install_deps( $pkg )) { | ||
3586 | 741 | print PLOG "Source-dependencies not satisfied; skipping $pkg\n"; | ||
3587 | 742 | goto cleanup_packages; | ||
3588 | 743 | } | ||
3589 | 744 | |||
3590 | 745 | my $dscbase = basename( $dscfile ); | ||
3591 | 746 | $main::pkg_status = "successful" if build( $dscbase, $pkgv ); | ||
3592 | 747 | chdir( $main::cwd ); | ||
3593 | 748 | write_jobs_file( $main::pkg_status ); | ||
3594 | 749 | append_to_FINISHED( $main::current_job ); | ||
3595 | 750 | |||
3596 | 751 | cleanup_packages: | ||
3597 | 752 | undo_specials(); | ||
3598 | 753 | uninstall_deps(); | ||
3599 | 754 | remove_srcdep_lock_file(); | ||
3600 | 755 | cleanup_symlinks: | ||
3601 | 756 | remove_files( @files_to_rm ); | ||
3602 | 757 | cleanup_close: | ||
3603 | 758 | analyze_fail_stage( $pkgv ); | ||
3604 | 759 | if( $main::pkg_status eq 'failed' ) { | ||
3605 | 760 | $main::pkg_status = 'failed ' . $main::pkg_fail_stage; | ||
3606 | 761 | } | ||
3607 | 762 | write_jobs_file( $main::pkg_status ); | ||
3608 | 763 | close_pkg_log( $pkgv ); | ||
3609 | 764 | $main::current_job = ""; | ||
3610 | 765 | if ( $main::batchmode and (-f "$main::HOME/EXIT-DAEMON-PLEASE") ) { | ||
3611 | 766 | main::shutdown("NONE (flag file exit)"); | ||
3612 | 767 | } | ||
3613 | 768 | } | ||
3614 | 769 | write_jobs_file(); | ||
3615 | 770 | |||
3616 | 771 | close_log(); | ||
3617 | 772 | #unlink( $main::jobs_file ) if $main::batchmode; | ||
3618 | 773 | unlink( "SBUILD-FINISHED" ) if $main::batchmode; | ||
3619 | 774 | exit 0; | ||
3620 | 775 | |||
3621 | 776 | sub fetch_source_files { | ||
3622 | 777 | my $dscfile_ref = shift; | ||
3623 | 778 | my $dscfile = $$dscfile_ref; | ||
3624 | 779 | my ($dir, $dscbase, $files, @other_files, $dscarchs, @made); | ||
3625 | 780 | my ($build_depends, $build_depends_indep, $build_conflicts, | ||
3626 | 781 | $build_conflicts_indep); | ||
3627 | 782 | local( *F ); | ||
3628 | 783 | |||
3629 | 784 | $dscfile =~ m,^(.*)/([^/]+)$,; | ||
3630 | 785 | ($dir, $dscbase) = ($1, $2); | ||
3631 | 786 | my $urlbase; | ||
3632 | 787 | $urlbase = $1 if $dscfile =~ m,^(\w+://(\S+/)?)([^/]+)$,; | ||
3633 | 788 | (my $pkgv = $dscfile) =~ s,^(.*/)?([^/]+)\.dsc$,$2,; | ||
3634 | 789 | my ($pkg, $version) = split /_/, $pkgv; | ||
3635 | 790 | @main::have_dsc_build_deps = (); | ||
3636 | 791 | |||
3637 | 792 | if (-d $dscfile) { | ||
3638 | 793 | if (-f "$dscfile/debian/.sbuild-build-deps") { | ||
3639 | 794 | open( F, "<$dscfile/debian/.sbuild-build-deps" ); | ||
3640 | 795 | my $pkg; | ||
3641 | 796 | while( <F> ) { | ||
3642 | 797 | /^Package:\s*(.*)\s*$/i and $pkg = $1; | ||
3643 | 798 | /^Build-Depends:\s*(.*)\s*$/i and $build_depends = $1; | ||
3644 | 799 | /^Build-Depends-Indep:\s*(.*)\s*$/i and $build_depends_indep = $1; | ||
3645 | 800 | /^Build-Conflicts:\s*(.*)\s*$/i and $build_conflicts = $1; | ||
3646 | 801 | /^Build-Conflicts-Indep:\s*(.*)\s*$/i and $build_conflicts_indep = $1; | ||
3647 | 802 | } | ||
3648 | 803 | close( F ); | ||
3649 | 804 | if ($build_depends || $build_depends_indep || $build_conflicts || | ||
3650 | 805 | $build_conflicts_indep) { | ||
3651 | 806 | merge_pkg_build_deps( $pkg, $build_depends, | ||
3652 | 807 | $build_depends_indep, $build_conflicts, | ||
3653 | 808 | $build_conflicts_indep ); | ||
3654 | 809 | } | ||
3655 | 810 | } | ||
3656 | 811 | return; | ||
3657 | 812 | } | ||
3658 | 813 | |||
3659 | 814 | if ($dir ne ".") { | ||
3660 | 815 | { | ||
3661 | 816 | if (-f "${pkgv}.dsc") { | ||
3662 | 817 | print PLOG "${pkgv}.dsc exists in cwd\n"; | ||
3663 | 818 | } | ||
3664 | 819 | else { | ||
3665 | 820 | my %entries; | ||
3666 | 821 | my $retried = 0; | ||
3667 | 822 | |||
3668 | 823 | retry: | ||
3669 | 824 | print PLOG "Checking available source versions...\n"; | ||
3670 | 825 | if (!open( PIPE, "$conf::sudo /usr/sbin/chroot ". | ||
3671 | 826 | "$main::chroot_dir $conf::apt_cache ". | ||
3672 | 827 | "-q showsrc $pkg 2>&1 </dev/null |" )) { | ||
3673 | 828 | print PLOG "Can't open pipe to apt-cache: $!\n"; | ||
3674 | 829 | return ("ERROR"); | ||
3675 | 830 | } | ||
3676 | 831 | { local($/) = ""; | ||
3677 | 832 | while( <PIPE> ) { | ||
3678 | 833 | my $ver = $1 if /^Version:\s+(\S+)\s*$/mi; | ||
3679 | 834 | my $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi; | ||
3680 | 835 | @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] } | ||
3681 | 836 | split( "\n", $tfile ); | ||
3682 | 837 | } | ||
3683 | 838 | } | ||
3684 | 839 | close( PIPE ); | ||
3685 | 840 | if ($?) { | ||
3686 | 841 | print PLOG "$conf::apt_cache failed\n"; | ||
3687 | 842 | return ("ERROR"); | ||
3688 | 843 | } | ||
3689 | 844 | |||
3690 | 845 | if (!defined($entries{$version})) { | ||
3691 | 846 | if (!$retried) { | ||
3692 | 847 | # try to update apt's cache if nothing found | ||
3693 | 848 | system "$conf::sudo /usr/sbin/chroot ". | ||
3694 | 849 | "$main::chroot_dir $conf::apt_get ". | ||
3695 | 850 | "update >/dev/null"; | ||
3696 | 851 | $retried = 1; | ||
3697 | 852 | goto retry; | ||
3698 | 853 | } | ||
3699 | 854 | print PLOG "Can't find source for $pkgv\n"; | ||
3700 | 855 | print PLOG "(only different version(s) ", | ||
3701 | 856 | join( ", ", sort keys %entries), " found)\n" | ||
3702 | 857 | if %entries; | ||
3703 | 858 | return( "ERROR" ); | ||
3704 | 859 | } | ||
3705 | 860 | |||
3706 | 861 | print PLOG "Fetching source files...\n"; | ||
3707 | 862 | @made = @{$entries{$version}}; | ||
3708 | 863 | if (!open( PIPE, "$conf::apt_get $main::chroot_apt_options ". | ||
3709 | 864 | "--only-source -q -d source $pkg=$version 2>&1 </dev/null |" )) { | ||
3710 | 865 | print PLOG "Can't open pipe to $conf::apt_get: $!\n"; | ||
3711 | 866 | return ("ERROR", @made); | ||
3712 | 867 | } | ||
3713 | 868 | while( <PIPE> ) { | ||
3714 | 869 | print PLOG $_; | ||
3715 | 870 | } | ||
3716 | 871 | close( PIPE ); | ||
3717 | 872 | if ($?) { | ||
3718 | 873 | print PLOG "$conf::apt_get for sources failed\n"; | ||
3719 | 874 | return( "ERROR", @made ); | ||
3720 | 875 | } | ||
3721 | 876 | # touch the downloaded files, otherwise buildd-watcher | ||
3722 | 877 | # will complain that they're old :) | ||
3723 | 878 | $$dscfile_ref = $dscfile = (grep { /\.dsc$/ } @made)[0]; | ||
3724 | 879 | } | ||
3725 | 880 | } | ||
3726 | 881 | } | ||
3727 | 882 | |||
3728 | 883 | if (!open( F, "<$dscfile" )) { | ||
3729 | 884 | print PLOG "Can't open $dscfile: $!\n"; | ||
3730 | 885 | return( "ERROR", @made ); | ||
3731 | 886 | } | ||
3732 | 887 | my $dsctext; | ||
3733 | 888 | { local($/); $dsctext = <F>; } | ||
3734 | 889 | close( F ); | ||
3735 | 890 | |||
3736 | 891 | $dsctext =~ /^Build-Depends:\s*((.|\n\s+)*)\s*$/mi | ||
3737 | 892 | and $build_depends = $1; | ||
3738 | 893 | $dsctext =~ /^Build-Depends-Indep:\s*((.|\n\s+)*)\s*$/mi | ||
3739 | 894 | and $build_depends_indep = $1; | ||
3740 | 895 | $dsctext =~ /^Build-Conflicts:\s*((.|\n\s+)*)\s*$/mi | ||
3741 | 896 | and $build_conflicts = $1; | ||
3742 | 897 | $dsctext =~ /^Build-Conflicts-Indep:\s*((.|\n\s+)*)\s*$/mi | ||
3743 | 898 | and $build_conflicts_indep = $1; | ||
3744 | 899 | $build_depends =~ s/\n\s+/ /g if defined $build_depends; | ||
3745 | 900 | $build_depends_indep =~ s/\n\s+/ /g if defined $build_depends_indep; | ||
3746 | 901 | $build_conflicts =~ s/\n\s+/ /g if defined $build_conflicts; | ||
3747 | 902 | $build_conflicts_indep =~ s/\n\s+/ /g if defined $build_conflicts_indep; | ||
3748 | 903 | |||
3749 | 904 | $dsctext =~ /^Architecture:\s*(.*)$/mi and $dscarchs = $1; | ||
3750 | 905 | |||
3751 | 906 | $dsctext =~ /^Files:\s*\n((\s+.*\s*\n)+)/mi and $files = $1; | ||
3752 | 907 | @other_files = map { (split( /\s+/, $_ ))[3] } split( "\n", $files ); | ||
3753 | 908 | |||
3754 | 909 | if (!$dscarchs) { | ||
3755 | 910 | print PLOG "$dscbase has no Architecture: field -- skipping arch check!\n"; | ||
3756 | 911 | } | ||
3757 | 912 | else { | ||
3758 | 913 | my $valid_arch; | ||
3759 | 914 | for my $a (split(/\s+/, $dscarchs)) { | ||
3760 | 915 | if (system('dpkg-architecture', '-a' . $main::arch, '-i' . $a) eq 0) { | ||
3761 | 916 | $valid_arch = 1; | ||
3762 | 917 | last; | ||
3763 | 918 | } | ||
3764 | 919 | } | ||
3765 | 920 | if ($dscarchs ne "any" && !($valid_arch) && | ||
3766 | 921 | !($dscarchs eq "all" && $main::build_arch_all) ) { | ||
3767 | 922 | my $msg = "$dscbase: $main::arch not in arch list or does not match any arch "; | ||
3768 | 923 | $msg .= "wildcards: $dscarchs -- skipping\n"; | ||
3769 | 924 | print PLOG $msg; | ||
3770 | 925 | $main::pkg_fail_stage = "arch-check"; | ||
3771 | 926 | return( "ERROR", @made ); | ||
3772 | 927 | } | ||
3773 | 928 | } | ||
3774 | 929 | print "Arch check ok ($main::arch included in $dscarchs)\n" | ||
3775 | 930 | if $main::debug; | ||
3776 | 931 | |||
3777 | 932 | if ($build_depends || $build_depends_indep || $build_conflicts || | ||
3778 | 933 | $build_conflicts_indep) { | ||
3779 | 934 | @main::have_dsc_build_deps = ($build_depends, $build_depends_indep, | ||
3780 | 935 | $build_conflicts,$build_conflicts_indep); | ||
3781 | 936 | merge_pkg_build_deps( $pkg, $build_depends, $build_depends_indep, | ||
3782 | 937 | $build_conflicts, $build_conflicts_indep ); | ||
3783 | 938 | } | ||
3784 | 939 | |||
3785 | 940 | return @made; | ||
3786 | 941 | } | ||
3787 | 942 | |||
3788 | 943 | sub build { | ||
3789 | 944 | my $dsc = shift; | ||
3790 | 945 | my $pkgv = shift; | ||
3791 | 946 | my( $dir, $rv, $changes ); | ||
3792 | 947 | my $do_apply_patches = 1; | ||
3793 | 948 | local( *PIPE, *F, *F2 ); | ||
3794 | 949 | |||
3795 | 950 | fixup_pkgv( \$pkgv ); | ||
3796 | 951 | print PLOG "-"x78, "\n"; | ||
3797 | 952 | # count build time from now, ignoring the installation of source deps | ||
3798 | 953 | $main::pkg_start_time = time; | ||
3799 | 954 | $main::this_space = 0; | ||
3800 | 955 | $pkgv =~ /^([a-zA-Z\d.+-]+)_([a-zA-Z\d:.+~-]+)/; | ||
3801 | 956 | my ($pkg, $version) = ($1,$2); | ||
3802 | 957 | (my $sversion = $version) =~ s/^\d+://; | ||
3803 | 958 | my $tmpunpackdir = $dsc; | ||
3804 | 959 | $tmpunpackdir =~ s/-.*$/.orig.tmp-nest/; | ||
3805 | 960 | $tmpunpackdir =~ s/_/-/; | ||
3806 | 961 | $tmpunpackdir = "$main::chroot_build_dir$tmpunpackdir"; | ||
3807 | 962 | |||
3808 | 963 | if (-d "$main::chroot_build_dir$dsc" && -l "$main::chroot_build_dir$dsc") { | ||
3809 | 964 | # if the package dir already exists but is a symlink, complain | ||
3810 | 965 | print PLOG "Cannot unpack source: a symlink to a directory with the\n", | ||
3811 | 966 | "same name already exists.\n"; | ||
3812 | 967 | return 0; | ||
3813 | 968 | } | ||
3814 | 969 | if (! -d "$main::chroot_build_dir$dsc") { | ||
3815 | 970 | $main::pkg_fail_stage = "unpack"; | ||
3816 | 971 | # dpkg-source refuses to remove the remanants of an | ||
3817 | 972 | # aborted dpkg-source extraction, so we will if necessary. | ||
3818 | 973 | if (-d $tmpunpackdir) { | ||
3819 | 974 | system ("rm -fr $tmpunpackdir"); | ||
3820 | 975 | } | ||
3821 | 976 | $main::sub_pid = open( PIPE, "-|" ); | ||
3822 | 977 | if (!defined $main::sub_pid) { | ||
3823 | 978 | print PLOG "Can't spawn dpkg-source: $!\n"; | ||
3824 | 979 | return 0; | ||
3825 | 980 | } | ||
3826 | 981 | if ($main::sub_pid == 0) { | ||
3827 | 982 | setpgrp( 0, $$ ); | ||
3828 | 983 | if ($main::chroot_build_dir && !chdir( $main::chroot_build_dir )) { | ||
3829 | 984 | print PLOG "Couldn't cd to $main::chroot_build_dir: $!\n"; | ||
3830 | 985 | system ("rm -fr $tmpunpackdir") if -d $tmpunpackdir; | ||
3831 | 986 | exit 1; | ||
3832 | 987 | } | ||
3833 | 988 | |||
3834 | 989 | my @files; | ||
3835 | 990 | push( @files, $dsc ); | ||
3836 | 991 | if (!open( F, "<$main::cwd/$dsc" )) { | ||
3837 | 992 | print PLOG "Can't open $main::cwd/$dsc: $!\n"; | ||
3838 | 993 | return 0; | ||
3839 | 994 | } | ||
3840 | 995 | my $dsctext; | ||
3841 | 996 | { local($/); $dsctext = <F>; } | ||
3842 | 997 | close( F ); | ||
3843 | 998 | my $files; | ||
3844 | 999 | $dsctext =~ /^Files:\s*\n((\s+.*\s*\n)+)/mi and $files = $1; | ||
3845 | 1000 | push(@files, map { (split( /\s+/, $_ ))[3] } split( "\n", $files )); | ||
3846 | 1001 | |||
3847 | 1002 | my $file; | ||
3848 | 1003 | foreach $file (@files) { | ||
3849 | 1004 | system ("cp", "$main::cwd/$file", "$file"); | ||
3850 | 1005 | } | ||
3851 | 1006 | exec "$conf::sudo", "/usr/sbin/chroot", "$main::cwd/$main::chroot_dir", | ||
3852 | 1007 | "$conf::su", $main::username, "-s", "/bin/sh", "-c", | ||
3853 | 1008 | "cd /build/$main::username && $conf::dpkg_source -sn -x $dsc 2>&1"; | ||
3854 | 1009 | unlink @files; | ||
3855 | 1010 | } | ||
3856 | 1011 | $main::sub_task = "dpkg-source"; | ||
3857 | 1012 | |||
3858 | 1013 | while( <PIPE> ) { | ||
3859 | 1014 | print PLOG $_; | ||
3860 | 1015 | $dir = $1 if /^dpkg-source: (?:info: )?extracting \S+ in (\S+)/; | ||
3861 | 1016 | $main::pkg_fail_stage = "unpack-check" | ||
3862 | 1017 | if /^dpkg-source: error: file.*instead of expected/; | ||
3863 | 1018 | } | ||
3864 | 1019 | close( PIPE ); | ||
3865 | 1020 | undef $main::sub_pid; | ||
3866 | 1021 | if ($?) { | ||
3867 | 1022 | print PLOG "FAILED [dpkg-source died]\n"; | ||
3868 | 1023 | |||
3869 | 1024 | system ("rm -fr $tmpunpackdir") if -d $tmpunpackdir; | ||
3870 | 1025 | return 0; | ||
3871 | 1026 | } | ||
3872 | 1027 | if (!$dir) { | ||
3873 | 1028 | print PLOG "Couldn't find directory of $dsc in dpkg-source output\n"; | ||
3874 | 1029 | system ("rm -fr $tmpunpackdir") if -d $tmpunpackdir; | ||
3875 | 1030 | return 0; | ||
3876 | 1031 | } | ||
3877 | 1032 | $dir = "$main::chroot_build_dir$dir"; | ||
3878 | 1033 | |||
3879 | 1034 | if (system( "chmod -R g-s,go+rX $dir" ) != 0) { | ||
3880 | 1035 | print PLOG "chmod -R g-s,go+rX $dir failed.\n"; | ||
3881 | 1036 | return 0; | ||
3882 | 1037 | } | ||
3883 | 1038 | |||
3884 | 1039 | if (@main::have_dsc_build_deps && !defined $main::build_source) { | ||
3885 | 1040 | my ($d, $di, $c, $ci) = @main::have_dsc_build_deps; | ||
3886 | 1041 | open( F, ">$dir/debian/.sbuild-build-deps" ); | ||
3887 | 1042 | print F "Package: $pkg\n"; | ||
3888 | 1043 | print F "Build-Depends: $d\n" if $d; | ||
3889 | 1044 | print F "Build-Depends-Indep: $di\n" if $di; | ||
3890 | 1045 | print F "Build-Conflicts: $c\n" if $c; | ||
3891 | 1046 | print F "Build-Conflicts-Indep: $ci\n" if $ci; | ||
3892 | 1047 | close( F ); | ||
3893 | 1048 | } | ||
3894 | 1049 | } | ||
3895 | 1050 | else { | ||
3896 | 1051 | $dir = "$main::chroot_build_dir$dsc"; | ||
3897 | 1052 | $do_apply_patches = 0; | ||
3898 | 1053 | |||
3899 | 1054 | $main::pkg_fail_stage = "check-unpacked-version"; | ||
3900 | 1055 | # check if the unpacked tree is really the version we need | ||
3901 | 1056 | $main::sub_pid = open( PIPE, "-|" ); | ||
3902 | 1057 | if (!defined $main::sub_pid) { | ||
3903 | 1058 | print PLOG "Can't spawn dpkg-parsechangelog: $!\n"; | ||
3904 | 1059 | return 0; | ||
3905 | 1060 | } | ||
3906 | 1061 | if ($main::sub_pid == 0) { | ||
3907 | 1062 | setpgrp( 0, $$ ); | ||
3908 | 1063 | chdir( $dir ); | ||
3909 | 1064 | exec "dpkg-parsechangelog 2>&1"; | ||
3910 | 1065 | } | ||
3911 | 1066 | $main::sub_task = "dpkg-parsechangelog"; | ||
3912 | 1067 | |||
3913 | 1068 | my $clog = ""; | ||
3914 | 1069 | while( <PIPE> ) { | ||
3915 | 1070 | $clog .= $_; | ||
3916 | 1071 | } | ||
3917 | 1072 | close( PIPE ); | ||
3918 | 1073 | undef $main::sub_pid; | ||
3919 | 1074 | if ($?) { | ||
3920 | 1075 | print PLOG "FAILED [dpkg-parsechangelog died]\n"; | ||
3921 | 1076 | return 0; | ||
3922 | 1077 | } | ||
3923 | 1078 | if ($clog !~ /^Version:\s*(.+)\s*$/mi) { | ||
3924 | 1079 | print PLOG "dpkg-parsechangelog didn't print Version:\n"; | ||
3925 | 1080 | return 0; | ||
3926 | 1081 | } | ||
3927 | 1082 | my $tree_version = $1; | ||
3928 | 1083 | my $cmp_version = ($main::binNMU && -f "$dir/debian/.sbuild-binNMU-done") ? | ||
3929 | 1084 | binNMU_version($version) : $version; | ||
3930 | 1085 | if ($tree_version ne $cmp_version) { | ||
3931 | 1086 | print PLOG "The unpacked source tree $dir is version ". | ||
3932 | 1087 | "$tree_version, not wanted $cmp_version!\n"; | ||
3933 | 1088 | return 0; | ||
3934 | 1089 | } | ||
3935 | 1090 | } | ||
3936 | 1091 | |||
3937 | 1092 | if (!chdir( $dir )) { | ||
3938 | 1093 | print PLOG "Couldn't cd to $dir: $!\n"; | ||
3939 | 1094 | system ("rm -fr $tmpunpackdir") if -d $tmpunpackdir; | ||
3940 | 1095 | return 0; | ||
3941 | 1096 | } | ||
3942 | 1097 | |||
3943 | 1098 | $main::pkg_fail_stage = "check-space"; | ||
3944 | 1099 | my $current_usage = `/usr/bin/du -s .`; | ||
3945 | 1100 | $current_usage =~ /^(\d+)/; | ||
3946 | 1101 | $current_usage = $1; | ||
3947 | 1102 | if ($current_usage) { | ||
3948 | 1103 | my $free = df( "." ); | ||
3949 | 1104 | if ($free < 2*$current_usage) { | ||
3950 | 1105 | print PLOG "Disk space is propably not enough for building.\n". | ||
3951 | 1106 | "(Source needs $current_usage KB, free are $free KB.)\n"; | ||
3952 | 1107 | print PLOG "Purging $dir\n"; | ||
3953 | 1108 | chdir( $main::cwd ); | ||
3954 | 1109 | system "$conf::sudo rm -rf $dir"; | ||
3955 | 1110 | return 0; | ||
3956 | 1111 | } | ||
3957 | 1112 | } | ||
3958 | 1113 | |||
3959 | 1114 | $main::pkg_fail_stage = "hack-binNMU"; | ||
3960 | 1115 | if ($main::binNMU && ! -f "debian/.sbuild-binNMU-done") { | ||
3961 | 1116 | if (open( F, "<debian/changelog" )) { | ||
3962 | 1117 | my($firstline, $text); | ||
3963 | 1118 | $firstline = <F> while $firstline =~ /^$/; | ||
3964 | 1119 | { local($/); undef $/; $text = <F>; } | ||
3965 | 1120 | close( F ); | ||
3966 | 1121 | $firstline =~ /^(\S+)\s+\((\S+)\)\s+([^;]+)\s*;\s*urgency=(\S+)\s*$/; | ||
3967 | 1122 | my ($name, $version, $dists, $urgent) = ($1, $2, $3, $4); | ||
3968 | 1123 | my $NMUversion = binNMU_version($version); | ||
3969 | 1124 | chomp( my $date = `822-date` ); | ||
3970 | 1125 | if (!open( F, ">debian/changelog" )) { | ||
3971 | 1126 | print PLOG "Can't open debian/changelog for binNMU hack: $!\n"; | ||
3972 | 1127 | chdir( $main::cwd ); | ||
3973 | 1128 | return 0; | ||
3974 | 1129 | } | ||
3975 | 1130 | $dists = $main::distribution; | ||
3976 | 1131 | print F "$name ($NMUversion) $dists; urgency=low\n\n"; | ||
3977 | 1132 | print F " * Binary-only non-maintainer upload for $main::arch; ", | ||
3978 | 1133 | "no source changes.\n"; | ||
3979 | 1134 | print F " * ", join( " ", split( "\n", $main::binNMU )), "\n\n"; | ||
3980 | 1135 | print F " -- $conf::maintainer_name $date\n\n"; | ||
3981 | 1136 | |||
3982 | 1137 | print F $firstline, $text; | ||
3983 | 1138 | close( F ); | ||
3984 | 1139 | system "touch debian/.sbuild-binNMU-done"; | ||
3985 | 1140 | print PLOG "*** Created changelog entry for bin-NMU version $NMUversion\n"; | ||
3986 | 1141 | } | ||
3987 | 1142 | else { | ||
3988 | 1143 | print PLOG "Can't open debian/changelog -- no binNMU hack!\n"; | ||
3989 | 1144 | } | ||
3990 | 1145 | } | ||
3991 | 1146 | |||
3992 | 1147 | if ($do_apply_patches) { | ||
3993 | 1148 | if (!apply_patches( $pkg )) { | ||
3994 | 1149 | chdir( $main::cwd ); | ||
3995 | 1150 | return 0; | ||
3996 | 1151 | } | ||
3997 | 1152 | } | ||
3998 | 1153 | |||
3999 | 1154 | if (-f "debian/files") { | ||
4000 | 1155 | local( *FILES ); | ||
4001 | 1156 | my @lines; | ||
4002 | 1157 | open( FILES, "<debian/files" ); | ||
4003 | 1158 | chomp( @lines = <FILES> ); | ||
4004 | 1159 | close( FILES ); | ||
4005 | 1160 | @lines = map { my $ind = 68-length($_); | ||
4006 | 1161 | $ind = 0 if $ind < 0; | ||
4007 | 1162 | "| $_".(" " x $ind)." |\n"; } @lines; | ||
4008 | 1163 | |||
4009 | 1164 | print PLOG <<"EOF"; | ||
4010 | 1165 | |||
4011 | 1166 | +----------------------------------------------------------------------+ | ||
4012 | 1167 | | sbuild Warning: | | ||
4013 | 1168 | | --------------- | | ||
4014 | 1169 | | After unpacking, there exists a file debian/files with the contents: | | ||
4015 | 1170 | | | | ||
4016 | 1171 | EOF | ||
4017 | 1172 | print PLOG @lines; | ||
4018 | 1173 | print PLOG <<"EOF"; | ||
4019 | 1174 | | | | ||
4020 | 1175 | | This should be reported as a bug. | | ||
4021 | 1176 | | The file has been removed to avoid dpkg-genchanges errors. | | ||
4022 | 1177 | +----------------------------------------------------------------------+ | ||
4023 | 1178 | |||
4024 | 1179 | EOF | ||
4025 | 1180 | unlink "debian/files"; | ||
4026 | 1181 | } | ||
4027 | 1182 | |||
4028 | 1183 | open CURRENT, ">$main::cwd/$main::chroot_dir/CurrentlyBuilding" or die "$main::cwd/$main::chroot_dir/CurrentlyBuilding open failed"; | ||
4029 | 1184 | # Package: must be first | ||
4030 | 1185 | print CURRENT "Package: $pkg\nComponent: $main::component\n"; | ||
4031 | 1186 | print CURRENT "Suite: $main::distribution\n" if $main::distribution; | ||
4032 | 1187 | print CURRENT "Purpose: $main::purpose\n" if $main::purpose; | ||
4033 | 1188 | print CURRENT "Build-Debug-Symbols: yes\n" if $main::build_debug_symbols; | ||
4034 | 1189 | close CURRENT; | ||
4035 | 1190 | |||
4036 | 1191 | $main::build_start_time = time; | ||
4037 | 1192 | $main::pkg_fail_stage = "build"; | ||
4038 | 1193 | $main::sub_pid = open( PIPE, "-|" ); | ||
4039 | 1194 | if (!defined $main::sub_pid) { | ||
4040 | 1195 | print PLOG "Can't spawn dpkg-buildpackage: $!\n"; | ||
4041 | 1196 | chdir( $main::cwd ); | ||
4042 | 1197 | return 0; | ||
4043 | 1198 | } | ||
4044 | 1199 | if ($main::sub_pid == 0) { | ||
4045 | 1200 | setpgrp( 0, $$ ); | ||
4046 | 1201 | my $binopt = $main::build_source ? "" : | ||
4047 | 1202 | $main::build_arch_all ? "-b" : "-B"; | ||
4048 | 1203 | my $env_cmnd = $conf::build_env_cmnd; | ||
4049 | 1204 | $env_cmnd = $conf::build_env_cmnd{$pkg} if $conf::build_env_cmnd{$pkg}; | ||
4050 | 1205 | if ($main::chroot_dir) { | ||
4051 | 1206 | my $bdir = $dir; | ||
4052 | 1207 | $bdir =~ s/^\Q$main::chroot_dir\E//; | ||
4053 | 1208 | if (-f "$main::chroot_dir/etc/ld.so.conf" && | ||
4054 | 1209 | ! -r "$main::chroot_dir/etc/ld.so.conf") { | ||
4055 | 1210 | system "$conf::sudo chmod a+r $main::chroot_dir/etc/ld.so.conf"; | ||
4056 | 1211 | print PLOG "ld.so.conf was not readable! Fixed.\n"; | ||
4057 | 1212 | } | ||
4058 | 1213 | exec "$conf::sudo", "/usr/sbin/chroot", "$main::cwd/$main::chroot_dir", | ||
4059 | 1214 | "$conf::su", $main::username, "-s", "/bin/sh", "-c", | ||
4060 | 1215 | "cd $bdir && PATH=$conf::path ". | ||
4061 | 1216 | (defined($main::nr_processors) ? | ||
4062 | 1217 | "DEB_BUILD_OPTIONS=\"parallel=".$main::nr_processors."\" " : ""). | ||
4063 | 1218 | (defined($main::ld_library_path) ? | ||
4064 | 1219 | "LD_LIBRARY_PATH=".$main::ld_library_path." " : ""). | ||
4065 | 1220 | "exec $env_cmnd dpkg-buildpackage $conf::pgp_options ". | ||
4066 | 1221 | "$binopt -m'$conf::maintainer_name' -r$conf::fakeroot 2>&1"; | ||
4067 | 1222 | } | ||
4068 | 1223 | else { | ||
4069 | 1224 | if (-f "/etc/ld.so.conf" && ! -r "/etc/ld.so.conf") { | ||
4070 | 1225 | system "$conf::sudo chmod a+r /etc/ld.so.conf"; | ||
4071 | 1226 | print PLOG "ld.so.conf was not readable! Fixed.\n"; | ||
4072 | 1227 | } | ||
4073 | 1228 | exec "$env_cmnd dpkg-buildpackage $conf::pgp_options $binopt ". | ||
4074 | 1229 | "-m'$conf::maintainer_name' -r$conf::fakeroot 2>&1"; | ||
4075 | 1230 | } | ||
4076 | 1231 | } | ||
4077 | 1232 | $main::sub_task = "dpkg-buildpackage"; | ||
4078 | 1233 | |||
4079 | 1234 | # We must send the signal as root, because some subprocesses of | ||
4080 | 1235 | # dpkg-buildpackage could run as root. So we have to use a shell | ||
4081 | 1236 | # command to send the signal... but /bin/kill can't send to | ||
4082 | 1237 | # process groups :-( So start another Perl :-) | ||
4083 | 1238 | my $timeout = $conf::individual_stalled_pkg_timeout{$pkg} || | ||
4084 | 1239 | $conf::stalled_pkg_timeout; | ||
4085 | 1240 | $timeout *= 60; | ||
4086 | 1241 | my $timed_out = 0; | ||
4087 | 1242 | my(@timeout_times, @timeout_sigs, $last_time); | ||
4088 | 1243 | $SIG{'ALRM'} = sub { | ||
4089 | 1244 | my $signal = ($timed_out > 0) ? 9 : 15; | ||
4090 | 1245 | system "$conf::sudo perl -e 'kill( -$signal, $main::sub_pid )'"; | ||
4091 | 1246 | $timeout_times[$timed_out] = time - $last_time; | ||
4092 | 1247 | $timeout_sigs[$timed_out] = $signal; | ||
4093 | 1248 | $timed_out++; | ||
4094 | 1249 | $timeout = 5*60; # only wait 5 minutes until next signal | ||
4095 | 1250 | }; | ||
4096 | 1251 | |||
4097 | 1252 | alarm( $timeout ); | ||
4098 | 1253 | while( <PIPE> ) { | ||
4099 | 1254 | alarm( $timeout ); | ||
4100 | 1255 | $last_time = time; | ||
4101 | 1256 | print PLOG $_; | ||
4102 | 1257 | } | ||
4103 | 1258 | close( PIPE ); | ||
4104 | 1259 | undef $main::sub_pid; | ||
4105 | 1260 | alarm( 0 ); | ||
4106 | 1261 | $rv = $?; | ||
4107 | 1262 | |||
4108 | 1263 | my $i; | ||
4109 | 1264 | for( $i = 0; $i < $timed_out; ++$i ) { | ||
4110 | 1265 | print PLOG "Build killed with signal ", $timeout_sigs[$i], | ||
4111 | 1266 | " after ", int($timeout_times[$i]/60), | ||
4112 | 1267 | " minutes of inactivity\n"; | ||
4113 | 1268 | } | ||
4114 | 1269 | $main::pkg_end_time = time; | ||
4115 | 1270 | my $date = `date +%Y%m%d-%H%M`; | ||
4116 | 1271 | print PLOG "*"x78, "\n"; | ||
4117 | 1272 | print PLOG "Build finished at $date"; | ||
4118 | 1273 | chdir( $main::cwd ); | ||
4119 | 1274 | |||
4120 | 1275 | my @space_files = ("$dir"); | ||
4121 | 1276 | if (!$main::nolog and defined $conf::exit_hook and open TMP, '-|', "$conf::exit_hook <$main::pkg_logfile") { | ||
4122 | 1277 | local $/ = undef; | ||
4123 | 1278 | my $log = <TMP>; | ||
4124 | 1279 | close TMP; | ||
4125 | 1280 | $rv |= $?; | ||
4126 | 1281 | print PLOG $log; | ||
4127 | 1282 | } | ||
4128 | 1283 | if ($rv) { | ||
4129 | 1284 | print PLOG "FAILED [dpkg-buildpackage died]\n"; | ||
4130 | 1285 | } | ||
4131 | 1286 | else { | ||
4132 | 1287 | my $trans_oldfmt="$main::chroot_build_dir${pkg}_${version}_translations.tar.gz"; | ||
4133 | 1288 | my $trans_newfmt="$main::chroot_build_dir${pkg}_${version}_${main::arch}_translations.tar.gz"; | ||
4134 | 1289 | my $translations=""; | ||
4135 | 1290 | if (-r $trans_newfmt) { | ||
4136 | 1291 | $translations = $trans_newfmt; | ||
4137 | 1292 | } elsif (-r $trans_oldfmt) { | ||
4138 | 1293 | $translations = $trans_oldfmt; | ||
4139 | 1294 | } | ||
4140 | 1295 | if ($translations) { | ||
4141 | 1296 | print PLOG "Publishing $translations for rosetta.\n"; | ||
4142 | 1297 | my $date = strftime '%Y%m%d',gmtime; | ||
4143 | 1298 | my $target = "$main::HOME/public_html/translations/$date/"; | ||
4144 | 1299 | system "mkdir -p $target"; | ||
4145 | 1300 | if (system("cp",$translations,$target) != 0) { | ||
4146 | 1301 | print PLOG "ERROR: Could not move $translations to $target\n"; | ||
4147 | 1302 | } else { | ||
4148 | 1303 | open TRANS, ">>$target/translations.txt"; | ||
4149 | 1304 | print TRANS "File: " . basename(${translations}) . "\n". | ||
4150 | 1305 | "Distribution: ${main::archive}\n". | ||
4151 | 1306 | "Release: ${main::distribution}\n". | ||
4152 | 1307 | "Component: ${main::component}\n". | ||
4153 | 1308 | "Source: ${pkg}\n". | ||
4154 | 1309 | "Version: ${version}\n\n"; | ||
4155 | 1310 | close TRANS; | ||
4156 | 1311 | system("chmod -R go+rX $main::HOME/public_html/translations"); | ||
4157 | 1312 | } | ||
4158 | 1313 | } | ||
4159 | 1314 | |||
4160 | 1315 | my $ddebtar = ""; | ||
4161 | 1316 | my $ddebstring = ""; | ||
4162 | 1317 | if (-r glob("$main::chroot_build_dir/*.ddeb")) { | ||
4163 | 1318 | my @ddeblist = glob("$main::chroot_build_dir/*.ddeb"); | ||
4164 | 1319 | $ddebtar="${pkg}_${version}_${main::arch}_ddebs.tar"; | ||
4165 | 1320 | while (@ddeblist) { | ||
4166 | 1321 | $ddebstring .= basename(@ddeblist[0]) . " "; | ||
4167 | 1322 | shift @ddeblist; | ||
4168 | 1323 | } | ||
4169 | 1324 | } | ||
4170 | 1325 | if ($ddebstring) { | ||
4171 | 1326 | print PLOG "Publishing debug debs.\n"; | ||
4172 | 1327 | my $date = strftime '%Y%m%d',gmtime; | ||
4173 | 1328 | my $target = "$main::HOME/public_html/ddebs/$date/"; | ||
4174 | 1329 | system "mkdir -p $target"; | ||
4175 | 1330 | if (system("tar -C $main::chroot_build_dir -chf $target/$ddebtar $ddebstring") != 0) { | ||
4176 | 1331 | print PLOG "ERROR: Could not create $ddebtar in $target\n"; | ||
4177 | 1332 | } else { | ||
4178 | 1333 | open TRANS, ">>$target/ddebs.txt"; | ||
4179 | 1334 | print TRANS "File: " . basename(${ddebtar}) . "\n". | ||
4180 | 1335 | "Distribution: ${main::archive}\n". | ||
4181 | 1336 | "Release: ${main::distribution}\n". | ||
4182 | 1337 | "Component: ${main::component}\n". | ||
4183 | 1338 | "Source: ${pkg}\n". | ||
4184 | 1339 | "Version: ${version}\n\n"; | ||
4185 | 1340 | close TRANS; | ||
4186 | 1341 | system("chmod -R go+rX $main::HOME/public_html/ddebs"); | ||
4187 | 1342 | } | ||
4188 | 1343 | } | ||
4189 | 1344 | |||
4190 | 1345 | if (-r "$dir/debian/files") { | ||
4191 | 1346 | my @debs; | ||
4192 | 1347 | my @files; | ||
4193 | 1348 | open( F, "<$dir/debian/files" ); | ||
4194 | 1349 | while( <F> ) { | ||
4195 | 1350 | my $f = (split( /\s+/, $_ ))[0]; | ||
4196 | 1351 | push( @files, "$main::chroot_build_dir$f" ); | ||
4197 | 1352 | if ($main::build_arch_all) { | ||
4198 | 1353 | next if ($f !~ /$main::arch\.[\w\d.-]*$/ && $f !~ /all\.[\w\d.-]*$/); | ||
4199 | 1354 | } else { | ||
4200 | 1355 | next if ($f !~ /$main::arch\.[\w\d.-]*$/); | ||
4201 | 1356 | } | ||
4202 | 1357 | push( @debs, "$main::chroot_build_dir$f" ); | ||
4203 | 1358 | push( @space_files, $f ); | ||
4204 | 1359 | } | ||
4205 | 1360 | close( F ); | ||
4206 | 1361 | my @debs2 = @debs; | ||
4207 | 1362 | foreach (@debs) { | ||
4208 | 1363 | print PLOG "\n$_:\n"; | ||
4209 | 1364 | if (!open( PIPE, "dpkg --info $_ 2>&1 |" )) { | ||
4210 | 1365 | print PLOG "Can't spawn dpkg: $! -- can't dump infos\n"; | ||
4211 | 1366 | } | ||
4212 | 1367 | else { | ||
4213 | 1368 | print PLOG $_ while( <PIPE> ); | ||
4214 | 1369 | close( PIPE ); | ||
4215 | 1370 | } | ||
4216 | 1371 | } | ||
4217 | 1372 | foreach (@debs2) { | ||
4218 | 1373 | print PLOG "\n$_:\n"; | ||
4219 | 1374 | if (!open( PIPE, "dpkg --contents $_ 2>&1 |" )) { | ||
4220 | 1375 | print PLOG "Can't spawn dpkg: $! -- can't dump infos\n"; | ||
4221 | 1376 | } | ||
4222 | 1377 | else { | ||
4223 | 1378 | print PLOG $_ while( <PIPE> ); | ||
4224 | 1379 | close( PIPE ); | ||
4225 | 1380 | } | ||
4226 | 1381 | } | ||
4227 | 1382 | if ($main::chroot_build_dir) { | ||
4228 | 1383 | foreach (@files) { | ||
4229 | 1384 | system "mv", $_, "." | ||
4230 | 1385 | and print PLOG "ERROR: Could not move $_ to .\n"; | ||
4231 | 1386 | } | ||
4232 | 1387 | } | ||
4233 | 1388 | } | ||
4234 | 1389 | |||
4235 | 1390 | if (-r $translations) { | ||
4236 | 1391 | system("rm",$translations); | ||
4237 | 1392 | } | ||
4238 | 1393 | |||
4239 | 1394 | $changes = "${pkg}_". | ||
4240 | 1395 | ($main::binNMU ? binNMU_version($sversion) : $sversion). | ||
4241 | 1396 | "_$main::arch.changes"; | ||
4242 | 1397 | if (-r "$main::chroot_build_dir$changes") { | ||
4243 | 1398 | my(@do_dists, @saved_dists); | ||
4244 | 1399 | print PLOG "\n$changes:\n"; | ||
4245 | 1400 | open( F, "<$main::chroot_build_dir$changes" ); | ||
4246 | 1401 | if (open( F2, ">$changes.new" )) { | ||
4247 | 1402 | while( <F> ) { | ||
4248 | 1403 | if (/^Distribution:\s*(.*)\s*$/) { | ||
4249 | 1404 | print PLOG "Distribution: $main::distribution\n"; | ||
4250 | 1405 | print F2 "Distribution: $main::distribution\n"; | ||
4251 | 1406 | } | ||
4252 | 1407 | else { | ||
4253 | 1408 | print F2 $_; | ||
4254 | 1409 | while (length $_ > 989) | ||
4255 | 1410 | { | ||
4256 | 1411 | my $index = rindex($_,' ',989); | ||
4257 | 1412 | print PLOG substr ($_,0,$index) . "\n"; | ||
4258 | 1413 | $_ = ' ' . substr ($_,$index+1); | ||
4259 | 1414 | } | ||
4260 | 1415 | print PLOG $_; | ||
4261 | 1416 | } | ||
4262 | 1417 | } | ||
4263 | 1418 | close( F2 ); | ||
4264 | 1419 | rename( "$changes.new", "$changes" ) | ||
4265 | 1420 | or print PLOG "$changes.new could not be renamed ". | ||
4266 | 1421 | "to $changes: $!\n"; | ||
4267 | 1422 | unlink( "$main::chroot_build_dir$changes" ) | ||
4268 | 1423 | if $main::chroot_build_dir; | ||
4269 | 1424 | } | ||
4270 | 1425 | else { | ||
4271 | 1426 | print PLOG "Cannot create $changes.new: $!\n"; | ||
4272 | 1427 | print PLOG "Distribution field may be wrong!!!\n"; | ||
4273 | 1428 | if ($main::chroot_build_dir) { | ||
4274 | 1429 | system "mv", "$main::chroot_build_dir$changes", "." | ||
4275 | 1430 | and print PLOG "ERROR: Could not move $_ to .\n"; | ||
4276 | 1431 | } | ||
4277 | 1432 | } | ||
4278 | 1433 | close( F ); | ||
4279 | 1434 | print PLOG "\n"; | ||
4280 | 1435 | } | ||
4281 | 1436 | else { | ||
4282 | 1437 | print PLOG "Can't find $changes -- can't dump infos\n"; | ||
4283 | 1438 | } | ||
4284 | 1439 | |||
4285 | 1440 | print PLOG "*"x78, "\n"; | ||
4286 | 1441 | print PLOG "Built successfully\n"; | ||
4287 | 1442 | } | ||
4288 | 1443 | |||
4289 | 1444 | check_watches(); | ||
4290 | 1445 | check_space( @space_files ); | ||
4291 | 1446 | |||
4292 | 1447 | if ($conf::purge_build_directory eq "always" || | ||
4293 | 1448 | ($conf::purge_build_directory eq "successful" && $rv == 0)) { | ||
4294 | 1449 | print PLOG "Purging $dir\n"; | ||
4295 | 1450 | system "$conf::sudo rm -rf $dir"; | ||
4296 | 1451 | } | ||
4297 | 1452 | |||
4298 | 1453 | print PLOG "-"x78, "\n"; | ||
4299 | 1454 | return $rv == 0 ? 1 : 0; | ||
4300 | 1455 | } | ||
4301 | 1456 | |||
4302 | 1457 | sub apply_patches { | ||
4303 | 1458 | my $pkg = shift; | ||
4304 | 1459 | my $name; | ||
4305 | 1460 | |||
4306 | 1461 | $main::pkg_fail_stage = "apply-patch"; | ||
4307 | 1462 | foreach $name ((map { $_->{'Package'} } @{$main::deps{$pkg}}), | ||
4308 | 1463 | @main::global_patches) { | ||
4309 | 1464 | if ($name =~ /^\*/ && exists $main::specials{$name}->{'patch'}) { | ||
4310 | 1465 | if (exists $main::specials{$name}->{'patchcond'}) { | ||
4311 | 1466 | print "Testing condition for $name patch:\n" | ||
4312 | 1467 | if $main::debug; | ||
4313 | 1468 | if (run_script("+e",$main::specials{$name}->{'patchcond'})!=0){ | ||
4314 | 1469 | print PLOG "Condition for $name patch not true -- ", | ||
4315 | 1470 | "not applying\n" if $name !~ /^\*\*/; | ||
4316 | 1471 | next; | ||
4317 | 1472 | } | ||
4318 | 1473 | print PLOG "Condition for $name patch ok\n"; | ||
4319 | 1474 | } | ||
4320 | 1475 | print PLOG "Applying $name patch\n"; | ||
4321 | 1476 | $main::sub_pid = open( PIPE, "|-" ); | ||
4322 | 1477 | if (!defined $main::sub_pid) { | ||
4323 | 1478 | print PLOG "Can't spawn patch: $! -- can't patch\n"; | ||
4324 | 1479 | return 0; | ||
4325 | 1480 | } | ||
4326 | 1481 | if ($main::sub_pid == 0) { | ||
4327 | 1482 | setpgrp( 0, $$ ); | ||
4328 | 1483 | open( STDOUT, ">&PLOG" ); | ||
4329 | 1484 | open( STDERR, ">&PLOG" ); | ||
4330 | 1485 | exec "patch --batch --quiet -p1 -E -N --no-backup-if-mismatch"; | ||
4331 | 1486 | } | ||
4332 | 1487 | $main::sub_task = "patch"; | ||
4333 | 1488 | |||
4334 | 1489 | print PIPE $main::specials{$name}->{'patch'}; | ||
4335 | 1490 | close( PIPE ); | ||
4336 | 1491 | undef $main::sub_pid; | ||
4337 | 1492 | if ($name !~ /^\*\*/ && $?) { | ||
4338 | 1493 | print PLOG "FAILED [patch died]\n"; | ||
4339 | 1494 | return 0; | ||
4340 | 1495 | } | ||
4341 | 1496 | } | ||
4342 | 1497 | } | ||
4343 | 1498 | return 1; | ||
4344 | 1499 | } | ||
4345 | 1500 | |||
4346 | 1501 | sub analyze_fail_stage { | ||
4347 | 1502 | my $pkgv = shift; | ||
4348 | 1503 | |||
4349 | 1504 | return if $main::pkg_status ne "failed"; | ||
4350 | 1505 | return if !$main::auto_giveback; | ||
4351 | 1506 | if (isin( $main::pkg_fail_stage, | ||
4352 | 1507 | qw(find-dsc fetch-src unpack-check check-space install-deps-env))) { | ||
4353 | 1508 | $main::pkg_status = "given-back"; | ||
4354 | 1509 | print PLOG "Giving back package $pkgv after failure in ". | ||
4355 | 1510 | "$main::pkg_fail_stage stage.\n"; | ||
4356 | 1511 | chdir( $main::cwd ); | ||
4357 | 1512 | my $cmd = ""; | ||
4358 | 1513 | $cmd = "ssh -l$main::auto_giveback_user $main::auto_giveback_host " | ||
4359 | 1514 | if $main::auto_giveback_host; | ||
4360 | 1515 | $cmd .= "-S $main::auto_giveback_socket " | ||
4361 | 1516 | if ($main::auto_giveback_socket and -S "$main::auto_giveback_socket"); | ||
4362 | 1517 | $cmd .= "wanna-build --give-back --no-down-propagation ". | ||
4363 | 1518 | "--dist=$main::distribution"; | ||
4364 | 1519 | $cmd .= " --database=$main::database" if $main::database; | ||
4365 | 1520 | $cmd .= " --user=$main::auto_giveback_wb_user " | ||
4366 | 1521 | if $main::auto_giveback_wb_user; | ||
4367 | 1522 | $cmd .= " $pkgv"; | ||
4368 | 1523 | system $cmd; | ||
4369 | 1524 | if ($?) { | ||
4370 | 1525 | print PLOG "wanna-build failed with status $?\n"; | ||
4371 | 1526 | } | ||
4372 | 1527 | else { | ||
4373 | 1528 | add_givenback( $pkgv, time ); | ||
4374 | 1529 | if ($main::stats_dir) { | ||
4375 | 1530 | local( *F ); | ||
4376 | 1531 | lock_file( "$main::stats_dir" ); | ||
4377 | 1532 | open( F, ">>$main::stats_dir/give-back" ); | ||
4378 | 1533 | print F "1\n"; | ||
4379 | 1534 | close( F ); | ||
4380 | 1535 | unlock_file( "$main::stats_dir" ); | ||
4381 | 1536 | } | ||
4382 | 1537 | } | ||
4383 | 1538 | } | ||
4384 | 1539 | } | ||
4385 | 1540 | |||
4386 | 1541 | sub remove_files { | ||
4387 | 1542 | |||
4388 | 1543 | foreach (@_) { | ||
4389 | 1544 | unlink $_; | ||
4390 | 1545 | print "Removed $_\n" if $main::debug; | ||
4391 | 1546 | } | ||
4392 | 1547 | } | ||
4393 | 1548 | |||
4394 | 1549 | |||
4395 | 1550 | sub install_deps { | ||
4396 | 1551 | my $pkg = shift; | ||
4397 | 1552 | my( @positive, @negative, @special, @instd, @rmvd ); | ||
4398 | 1553 | |||
4399 | 1554 | if (!exists $main::deps{$pkg}) { | ||
4400 | 1555 | prepare_watches( [] ); | ||
4401 | 1556 | return 1; | ||
4402 | 1557 | } | ||
4403 | 1558 | |||
4404 | 1559 | my $dep = $main::deps{$pkg}; | ||
4405 | 1560 | if ($main::debug) { | ||
4406 | 1561 | print "Source dependencies of $pkg: ", format_deps(@$dep), "\n"; | ||
4407 | 1562 | } | ||
4408 | 1563 | |||
4409 | 1564 | repeat: | ||
4410 | 1565 | lock_file( "$main::ilock_file", 1 ); | ||
4411 | 1566 | |||
4412 | 1567 | print "Filtering dependencies\n" if $main::debug; | ||
4413 | 1568 | if (!filter_dependencies( $dep, \@positive, \@negative, \@special )) { | ||
4414 | 1569 | print PLOG "Package installation not possible\n"; | ||
4415 | 1570 | unlock_file( "$main::ilock_file" ); | ||
4416 | 1571 | return 0; | ||
4417 | 1572 | } | ||
4418 | 1573 | |||
4419 | 1574 | print PLOG "Checking for source dependency conflicts...\n"; | ||
4420 | 1575 | if (!run_apt( "-s", \@instd, \@rmvd, @positive )) { | ||
4421 | 1576 | print PLOG "Test what should be installed failed.\n"; | ||
4422 | 1577 | unlock_file( "$main::ilock_file" ); | ||
4423 | 1578 | return 0; | ||
4424 | 1579 | } | ||
4425 | 1580 | # add negative deps as to be removed for checking srcdep conflicts | ||
4426 | 1581 | push( @rmvd, @negative ); | ||
4427 | 1582 | my @confl; | ||
4428 | 1583 | if (@confl = check_srcdep_conflicts( \@instd, \@rmvd, \@special )) { | ||
4429 | 1584 | print PLOG "Waiting for job(s) @confl to finish\n"; | ||
4430 | 1585 | |||
4431 | 1586 | unlock_file( "$main::ilock_file" ); | ||
4432 | 1587 | wait_for_srcdep_conflicts( @confl ); | ||
4433 | 1588 | goto repeat; | ||
4434 | 1589 | } | ||
4435 | 1590 | |||
4436 | 1591 | write_srcdep_lock_file( $dep, \@special ); | ||
4437 | 1592 | |||
4438 | 1593 | foreach my $sp (@special) { | ||
4439 | 1594 | next if $sp !~ /^\*/ || !exists $main::specials{$sp}->{'prepre'}; | ||
4440 | 1595 | print PLOG "Running prepre script for $sp\n"; | ||
4441 | 1596 | if (run_script( "-e", $main::specials{$sp}->{'prepre'} ) != 0) { | ||
4442 | 1597 | print PLOG "prepre script of special dependency $sp failed\n"; | ||
4443 | 1598 | unlock_file( "$main::ilock_file" ); | ||
4444 | 1599 | return 0; | ||
4445 | 1600 | } | ||
4446 | 1601 | } | ||
4447 | 1602 | |||
4448 | 1603 | print "Installing positive dependencies: @positive\n" if $main::debug; | ||
4449 | 1604 | if (!run_apt( "-y", \@instd, \@rmvd, @positive )) { | ||
4450 | 1605 | print PLOG "Package installation failed\n"; | ||
4451 | 1606 | # try to reinstall removed packages | ||
4452 | 1607 | print PLOG "Trying to reinstall removed packages:\n"; | ||
4453 | 1608 | print "Reinstalling removed packages: @rmvd\n" if $main::debug; | ||
4454 | 1609 | my (@instd2, @rmvd2); | ||
4455 | 1610 | print PLOG "Failed to reinstall removed packages!\n" | ||
4456 | 1611 | if !run_apt( "-y", \@instd2, \@rmvd2, @rmvd ); | ||
4457 | 1612 | print "Installed were: @instd2\n" if $main::debug; | ||
4458 | 1613 | print "Removed were: @rmvd2\n" if $main::debug; | ||
4459 | 1614 | # remove additional packages | ||
4460 | 1615 | print PLOG "Trying to uninstall newly installed packages:\n"; | ||
4461 | 1616 | uninstall_debs( $main::chroot_dir ? "purge" : "remove", @instd ); | ||
4462 | 1617 | unlock_file( "$main::ilock_file" ); | ||
4463 | 1618 | return 0; | ||
4464 | 1619 | } | ||
4465 | 1620 | set_installed( @instd ); | ||
4466 | 1621 | set_removed( @rmvd ); | ||
4467 | 1622 | |||
4468 | 1623 | print "Removing negative dependencies: @negative\n" if $main::debug; | ||
4469 | 1624 | if (!uninstall_debs( $main::chroot_dir ? "purge" : "remove", @negative )) { | ||
4470 | 1625 | print PLOG "Removal of packages failed\n"; | ||
4471 | 1626 | unlock_file( "$main::ilock_file" ); | ||
4472 | 1627 | return 0; | ||
4473 | 1628 | } | ||
4474 | 1629 | set_removed( @negative ); | ||
4475 | 1630 | |||
4476 | 1631 | my $fail = check_dependencies( $dep ); | ||
4477 | 1632 | if ($fail) { | ||
4478 | 1633 | print PLOG "After installing, the following source dependencies are ". | ||
4479 | 1634 | "still unsatisfied:\n$fail\n"; | ||
4480 | 1635 | unlock_file( "$main::ilock_file" ); | ||
4481 | 1636 | return 0; | ||
4482 | 1637 | } | ||
4483 | 1638 | |||
4484 | 1639 | foreach my $sp (@special) { | ||
4485 | 1640 | next if $sp !~ /^\*/ || | ||
4486 | 1641 | (!exists $main::specials{$sp}->{'pre'} && | ||
4487 | 1642 | !exists $main::specials{$sp}->{'post'} && | ||
4488 | 1643 | !exists $main::specials{$sp}->{'unpack'}); | ||
4489 | 1644 | if (exists $main::specials{$sp}->{'unpack'}) { | ||
4490 | 1645 | my $s = $main::specials{$sp}->{'unpack'}; | ||
4491 | 1646 | $s =~ s/^\s+//mg; | ||
4492 | 1647 | $s =~ s/\s+$//mg; | ||
4493 | 1648 | my @s = split( /\s+/, $s ); | ||
4494 | 1649 | my @rem; | ||
4495 | 1650 | print PLOG "Unpacking special sources $sp: @s\n"; | ||
4496 | 1651 | if (!(@rem = unpack_special_source( @s ))) { | ||
4497 | 1652 | print PLOG "unpacking of special dependency sources for $sp failed\n"; | ||
4498 | 1653 | unlock_file( "$main::ilock_file" ); | ||
4499 | 1654 | return 0; | ||
4500 | 1655 | } | ||
4501 | 1656 | $main::changes->{'unpacked'}->{$sp} = \@rem; | ||
4502 | 1657 | } | ||
4503 | 1658 | if (exists $main::specials{$sp}->{'pre'}) { | ||
4504 | 1659 | print PLOG "Running pre script for $sp\n"; | ||
4505 | 1660 | $main::changes->{'specials'}->{$sp} = 1; | ||
4506 | 1661 | if (run_script( "-e", $main::specials{$sp}->{'pre'} ) != 0) { | ||
4507 | 1662 | print PLOG "pre script of special dependency $sp failed\n"; | ||
4508 | 1663 | unlock_file( "$main::ilock_file" ); | ||
4509 | 1664 | return 0; | ||
4510 | 1665 | } | ||
4511 | 1666 | } | ||
4512 | 1667 | } | ||
4513 | 1668 | |||
4514 | 1669 | local (*F); | ||
4515 | 1670 | if (open( F, "| $conf::sudo /usr/sbin/chroot $main::chroot_dir $conf::dpkg --set-selections")) { | ||
4516 | 1671 | foreach my $tpkg (@instd) { | ||
4517 | 1672 | print F $tpkg . " purge\n"; | ||
4518 | 1673 | } | ||
4519 | 1674 | close( F ); | ||
4520 | 1675 | if ($?) { | ||
4521 | 1676 | print PLOG "$conf::dpkg --set-selections failed"; | ||
4522 | 1677 | } | ||
4523 | 1678 | } | ||
4524 | 1679 | |||
4525 | 1680 | unlock_file( "$main::ilock_file" ); | ||
4526 | 1681 | |||
4527 | 1682 | prepare_watches( $dep, @instd ); | ||
4528 | 1683 | return 1; | ||
4529 | 1684 | } | ||
4530 | 1685 | |||
4531 | 1686 | sub unpack_special_source { | ||
4532 | 1687 | my @s = @_; | ||
4533 | 1688 | my (@files, @dirs); | ||
4534 | 1689 | local (*PIPE); | ||
4535 | 1690 | |||
4536 | 1691 | foreach my $s (@s) { | ||
4537 | 1692 | my $dsc; | ||
4538 | 1693 | |||
4539 | 1694 | { | ||
4540 | 1695 | if (!open( PIPE, "$conf::apt_get $main::chroot_apt_options ". | ||
4541 | 1696 | "--only-source -q -d source $s 2>&1 </dev/null |" )) { | ||
4542 | 1697 | print PLOG "Can't open pipe to apt-get: $!\n"; | ||
4543 | 1698 | goto failed; | ||
4544 | 1699 | } | ||
4545 | 1700 | while( <PIPE> ) { | ||
4546 | 1701 | $dsc = "$1_$2.dsc" if /(\S+) (?:[^:]+:)?(\S+) \(dsc\)/; | ||
4547 | 1702 | print PLOG $_; | ||
4548 | 1703 | } | ||
4549 | 1704 | close( PIPE ); | ||
4550 | 1705 | if ($?) { | ||
4551 | 1706 | print PLOG "Apt-get of special unpack sources failed\n"; | ||
4552 | 1707 | goto failed; | ||
4553 | 1708 | } | ||
4554 | 1709 | push( @files, $dsc ); | ||
4555 | 1710 | if (!open( F, "<$dsc" )) { | ||
4556 | 1711 | print PLOG "Can't open $dsc: $!\n"; | ||
4557 | 1712 | goto failed; | ||
4558 | 1713 | } | ||
4559 | 1714 | my $dsctext; | ||
4560 | 1715 | { local($/); $dsctext = <F>; } | ||
4561 | 1716 | close( F ); | ||
4562 | 1717 | my $files; | ||
4563 | 1718 | $dsctext =~ /^Files:\s*\n((\s+.*\s*\n)+)/mi and $files = $1; | ||
4564 | 1719 | push(@files, map { (split( /\s+/, $_ ))[3] } split( "\n", $files )); | ||
4565 | 1720 | } | ||
4566 | 1721 | |||
4567 | 1722 | my $pid = open( PIPE, "-|" ); | ||
4568 | 1723 | if (!defined $pid) { | ||
4569 | 1724 | print PLOG "Can't spawn dpkg-source: $! -- special unpack failed\n"; | ||
4570 | 1725 | goto failed; | ||
4571 | 1726 | } | ||
4572 | 1727 | if ($pid == 0) { | ||
4573 | 1728 | setpgrp( 0, $$ ); | ||
4574 | 1729 | if ($main::chroot_build_dir && !chdir( $main::chroot_build_dir )) { | ||
4575 | 1730 | print PLOG "Couldn't cd to $main::chroot_build_dir: $! -- special unpack failed\n"; | ||
4576 | 1731 | exit 1; | ||
4577 | 1732 | } | ||
4578 | 1733 | exec "$conf::dpkg_source -sn -x $main::cwd/$dsc 2>&1"; | ||
4579 | 1734 | } | ||
4580 | 1735 | my $dir; | ||
4581 | 1736 | while( <PIPE> ) { | ||
4582 | 1737 | print PLOG $_; | ||
4583 | 1738 | $dir = $1 if /^dpkg-source: (?:info: )?extracting \S+ in (\S+)/; | ||
4584 | 1739 | } | ||
4585 | 1740 | close( PIPE ); | ||
4586 | 1741 | if ($?) { | ||
4587 | 1742 | print PLOG "dpkg-source failure -- special unpack failed\n"; | ||
4588 | 1743 | goto failed; | ||
4589 | 1744 | } | ||
4590 | 1745 | push( @dirs, "$main::chroot_build_dir$dir" ); | ||
4591 | 1746 | unlink( @files ); | ||
4592 | 1747 | } | ||
4593 | 1748 | |||
4594 | 1749 | return @dirs; | ||
4595 | 1750 | |||
4596 | 1751 | failed: | ||
4597 | 1752 | unlink( @files ); | ||
4598 | 1753 | system( "rm", "-rf", @dirs ); | ||
4599 | 1754 | return (); | ||
4600 | 1755 | } | ||
4601 | 1756 | |||
4602 | 1757 | sub wait_for_srcdep_conflicts { | ||
4603 | 1758 | my @confl = @_; | ||
4604 | 1759 | |||
4605 | 1760 | for(;;) { | ||
4606 | 1761 | sleep( $conf::srcdep_lock_wait*60 ); | ||
4607 | 1762 | my $allgone = 1; | ||
4608 | 1763 | for (@confl) { | ||
4609 | 1764 | /^(\d+)-(\d+)$/; | ||
4610 | 1765 | my $pid = $1; | ||
4611 | 1766 | if (-f "$conf::srcdep_lock_dir/$_") { | ||
4612 | 1767 | if (kill( 0, $pid ) == 0 && $! == ESRCH) { | ||
4613 | 1768 | print PLOG "Ignoring stale src-dep lock $_\n"; | ||
4614 | 1769 | unlink( "$conf::srcdep_lock_dir/$_" ) or | ||
4615 | 1770 | print PLOG "Cannot remove $conf::srcdep_lock_dir/$_: $!\n"; | ||
4616 | 1771 | } | ||
4617 | 1772 | else { | ||
4618 | 1773 | $allgone = 0; | ||
4619 | 1774 | last; | ||
4620 | 1775 | } | ||
4621 | 1776 | } | ||
4622 | 1777 | } | ||
4623 | 1778 | last if $allgone; | ||
4624 | 1779 | } | ||
4625 | 1780 | } | ||
4626 | 1781 | |||
4627 | 1782 | sub uninstall_deps { | ||
4628 | 1783 | my( @pkgs, @instd, @rmvd ); | ||
4629 | 1784 | |||
4630 | 1785 | lock_file( "$main::ilock_file", 1 ); | ||
4631 | 1786 | |||
4632 | 1787 | @pkgs = keys %{$main::changes->{'removed'}}; | ||
4633 | 1788 | print "Reinstalling removed packages: @pkgs\n" if $main::debug; | ||
4634 | 1789 | print PLOG "Failed to reinstall removed packages!\n" | ||
4635 | 1790 | if !run_apt( "-y", \@instd, \@rmvd, @pkgs ); | ||
4636 | 1791 | print "Installed were: @instd\n" if $main::debug; | ||
4637 | 1792 | print "Removed were: @rmvd\n" if $main::debug; | ||
4638 | 1793 | unset_removed( @instd ); | ||
4639 | 1794 | unset_installed( @rmvd ); | ||
4640 | 1795 | |||
4641 | 1796 | @pkgs = keys %{$main::changes->{'installed'}}; | ||
4642 | 1797 | print "Removing installed packages: @pkgs\n" if $main::debug; | ||
4643 | 1798 | print PLOG "Failed to remove installed packages!\n" | ||
4644 | 1799 | if !uninstall_debs( "purge", @pkgs ); | ||
4645 | 1800 | unset_installed( @pkgs ); | ||
4646 | 1801 | |||
4647 | 1802 | unlock_file( "$main::ilock_file" ); | ||
4648 | 1803 | } | ||
4649 | 1804 | |||
4650 | 1805 | sub uninstall_debs { | ||
4651 | 1806 | my $mode = shift; | ||
4652 | 1807 | local (*PIPE); | ||
4653 | 1808 | |||
4654 | 1809 | return 1 if !@_; | ||
4655 | 1810 | print "Uninstalling packages: @_\n" if $main::debug; | ||
4656 | 1811 | print PLOG " $conf::sudo dpkg --$mode @_\n"; | ||
4657 | 1812 | repeat: | ||
4658 | 1813 | my $output; | ||
4659 | 1814 | if (!open( PIPE, "$conf::sudo /usr/sbin/chroot $main::chroot_dir $conf::dpkg --$mode @_ 2>&1 </dev/null |")) { | ||
4660 | 1815 | print PLOG "Can't open pipe to dpkg: $!\n"; | ||
4661 | 1816 | return 0; | ||
4662 | 1817 | } | ||
4663 | 1818 | while ( <PIPE> ) { | ||
4664 | 1819 | $output .= $_; | ||
4665 | 1820 | print PLOG $_; | ||
4666 | 1821 | } | ||
4667 | 1822 | close( PIPE ); | ||
4668 | 1823 | |||
4669 | 1824 | if ($output =~ /status database area is locked/mi) { | ||
4670 | 1825 | print PLOG "Another dpkg is running -- retrying later\n"; | ||
4671 | 1826 | $output = ""; | ||
4672 | 1827 | sleep( 2*60 ); | ||
4673 | 1828 | goto repeat; | ||
4674 | 1829 | } | ||
4675 | 1830 | print PLOG "dpkg run to remove packages (@_) failed!\n" if $?; | ||
4676 | 1831 | return $? == 0; | ||
4677 | 1832 | } | ||
4678 | 1833 | |||
4679 | 1834 | sub undo_specials { | ||
4680 | 1835 | my $sp; | ||
4681 | 1836 | |||
4682 | 1837 | print "Running post scripts of special dependencies:\n" if $main::debug; | ||
4683 | 1838 | foreach $sp (keys %{$main::changes->{'specials'}}) { | ||
4684 | 1839 | print PLOG "Running post script for $sp\n"; | ||
4685 | 1840 | if (run_script( "-e", $main::specials{$sp}->{'post'} ) != 0) { | ||
4686 | 1841 | print PLOG "post script of special dependency $sp failed\n"; | ||
4687 | 1842 | } | ||
4688 | 1843 | delete $main::changes->{'specials'}->{$sp}; | ||
4689 | 1844 | } | ||
4690 | 1845 | foreach $sp (keys %{$main::changes->{'unpacked'}}) { | ||
4691 | 1846 | my @dirs = @{$main::changes->{'unpacked'}->{$sp}}; | ||
4692 | 1847 | print PLOG "Removing special unpacked sources for $sp: @dirs\n"; | ||
4693 | 1848 | system "rm", "-rf", @dirs; | ||
4694 | 1849 | delete $main::changes->{'unpacked'}->{$sp}; | ||
4695 | 1850 | } | ||
4696 | 1851 | } | ||
4697 | 1852 | |||
4698 | 1853 | |||
4699 | 1854 | sub run_apt { | ||
4700 | 1855 | my $mode = shift; | ||
4701 | 1856 | my $inst_ret = shift; | ||
4702 | 1857 | my $rem_ret = shift; | ||
4703 | 1858 | my @to_install = @_; | ||
4704 | 1859 | my( $msgs, $status, $pkgs, $rpkgs ); | ||
4705 | 1860 | local (*PIPE); | ||
4706 | 1861 | local (%ENV) = %ENV; # make local environment | ||
4707 | 1862 | # hardwire frontend for debconf to non-interactive | ||
4708 | 1863 | $ENV{'DEBIAN_FRONTEND'} = "noninteractive"; | ||
4709 | 1864 | |||
4710 | 1865 | @$inst_ret = (); | ||
4711 | 1866 | @$rem_ret = (); | ||
4712 | 1867 | return 1 if !@to_install; | ||
4713 | 1868 | repeat: | ||
4714 | 1869 | print PLOG " $conf::sudo $conf::apt_get --purge $main::chroot_apt_op -q $mode install @to_install\n" | ||
4715 | 1870 | if $mode ne "-s"; | ||
4716 | 1871 | $msgs = ""; | ||
4717 | 1872 | # redirection of stdin from /dev/null so that conffile question are | ||
4718 | 1873 | # treated as if RETURN was pressed. | ||
4719 | 1874 | # dpkg since 1.4.1.18 issues an error on the conffile question if it reads | ||
4720 | 1875 | # EOF -- hardwire the new --force-confold option to avoid the questions. | ||
4721 | 1876 | if (!open( PIPE, "$conf::sudo /usr/sbin/chroot ". | ||
4722 | 1877 | "$main::chroot_dir $conf::apt_get --purge ". | ||
4723 | 1878 | ($main::new_dpkg ? "-o DPkg::Options::=--force-confold " : ""). | ||
4724 | 1879 | "-q $mode install @to_install 2>&1 </dev/null |" )) { | ||
4725 | 1880 | print PLOG "Can't open pipe to apt-get: $!\n"; | ||
4726 | 1881 | return 0; | ||
4727 | 1882 | } | ||
4728 | 1883 | while( <PIPE> ) { | ||
4729 | 1884 | $msgs .= $_; | ||
4730 | 1885 | print PLOG $_ if $mode ne "-s" || $main::debug; | ||
4731 | 1886 | } | ||
4732 | 1887 | close( PIPE ); | ||
4733 | 1888 | $status = $?; | ||
4734 | 1889 | |||
4735 | 1890 | if ($status != 0 && $msgs =~ /^E: Packages file \S+ (has changed|is out of sync)/mi) { | ||
4736 | 1891 | print PLOG "$conf::sudo $conf::apt_get $main::chroot_apt_op -q update\n"; | ||
4737 | 1892 | if (!open( PIPE, "$conf::sudo /usr/sbin/chroot $main::chroot_dir $conf::apt_get -q update 2>&1 |" )) { | ||
4738 | 1893 | print PLOG "Can't open pipe to apt-get: $!\n"; | ||
4739 | 1894 | return 0; | ||
4740 | 1895 | } | ||
4741 | 1896 | $msgs = ""; | ||
4742 | 1897 | while( <PIPE> ) { | ||
4743 | 1898 | $msgs .= $_; | ||
4744 | 1899 | print PLOG $_; | ||
4745 | 1900 | } | ||
4746 | 1901 | close( PIPE ); | ||
4747 | 1902 | print PLOG "apt-get update failed\n" if $?; | ||
4748 | 1903 | $msgs = ""; | ||
4749 | 1904 | goto repeat; | ||
4750 | 1905 | } | ||
4751 | 1906 | |||
4752 | 1907 | if ($status != 0 && $msgs =~ /^Package (\S+) is a virtual package provided by:\n((^\s.*\n)*)/mi) { | ||
4753 | 1908 | my $to_replace = $1; | ||
4754 | 1909 | my @providers; | ||
4755 | 1910 | foreach (split( "\n", $2 )) { | ||
4756 | 1911 | s/^\s*//; | ||
4757 | 1912 | push( @providers, (split( /\s+/, $_ ))[0] ); | ||
4758 | 1913 | } | ||
4759 | 1914 | print PLOG "$to_replace is a virtual package provided by: @providers\n"; | ||
4760 | 1915 | my $selected; | ||
4761 | 1916 | if (@providers == 1) { | ||
4762 | 1917 | $selected = $providers[0]; | ||
4763 | 1918 | print PLOG "Using $selected (only possibility)\n"; | ||
4764 | 1919 | } | ||
4765 | 1920 | elsif (exists $conf::alternatives{$to_replace}) { | ||
4766 | 1921 | $selected = $conf::alternatives{$to_replace}; | ||
4767 | 1922 | print PLOG "Using $selected (selected in sbuildrc)\n"; | ||
4768 | 1923 | } | ||
4769 | 1924 | else { | ||
4770 | 1925 | $selected = $providers[0]; | ||
4771 | 1926 | print PLOG "Using $selected (no default, using first one)\n"; | ||
4772 | 1927 | } | ||
4773 | 1928 | |||
4774 | 1929 | @to_install = grep { $_ ne $to_replace } @to_install; | ||
4775 | 1930 | push( @to_install, $selected ); | ||
4776 | 1931 | |||
4777 | 1932 | goto repeat; | ||
4778 | 1933 | } | ||
4779 | 1934 | |||
4780 | 1935 | if ($status != 0 && ($msgs =~ /^E: Could( not get lock|n.t lock)/mi || | ||
4781 | 1936 | $msgs =~ /^dpkg: status database area is locked/mi)) { | ||
4782 | 1937 | print PLOG "Another apt-get or dpkg is running -- retrying later\n"; | ||
4783 | 1938 | sleep( 2*60 ); | ||
4784 | 1939 | goto repeat; | ||
4785 | 1940 | } | ||
4786 | 1941 | |||
4787 | 1942 | # check for errors that are probably caused by something broken in | ||
4788 | 1943 | # the build environment, and give back the packages. | ||
4789 | 1944 | if ($status != 0 && $mode ne "-s" && | ||
4790 | 1945 | (($msgs =~ /^E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem./mi) || | ||
4791 | 1946 | ($msgs =~ /^dpkg: parse error, in file `\/.+\/var\/lib\/dpkg\/(?:available|status)' near line/mi) || | ||
4792 | 1947 | ($msgs =~ /^E: Unmet dependencies. Try 'apt-get -f install' with no packages \(or specify a solution\)\./mi))) { | ||
4793 | 1948 | print PLOG "Build environment unusable, giving back\n"; | ||
4794 | 1949 | $main::pkg_fail_stage = "install-deps-env"; | ||
4795 | 1950 | } | ||
4796 | 1951 | |||
4797 | 1952 | if ($status != 0 && $mode ne "-s" && | ||
4798 | 1953 | (($msgs =~ /^E: Unable to fetch some archives, maybe run apt-get update or try with/mi))) { | ||
4799 | 1954 | print PLOG "Unable to fetch build-depends\n"; | ||
4800 | 1955 | $main::pkg_fail_stage = "install-deps-env"; | ||
4801 | 1956 | } | ||
4802 | 1957 | |||
4803 | 1958 | $pkgs = $rpkgs = ""; | ||
4804 | 1959 | if ($msgs =~ /NEW packages will be installed:\n((^[ ].*\n)*)/mi) { | ||
4805 | 1960 | ($pkgs = $1) =~ s/^[ ]*((.|\n)*)\s*$/$1/m; | ||
4806 | 1961 | $pkgs =~ s/\*//g; | ||
4807 | 1962 | } | ||
4808 | 1963 | if ($msgs =~ /packages will be REMOVED:\n((^[ ].*\n)*)/mi) { | ||
4809 | 1964 | ($rpkgs = $1) =~ s/^[ ]*((.|\n)*)\s*$/$1/m; | ||
4810 | 1965 | $rpkgs =~ s/\*//g; | ||
4811 | 1966 | } | ||
4812 | 1967 | @$inst_ret = split( /\s+/, $pkgs ); | ||
4813 | 1968 | @$rem_ret = split( /\s+/, $rpkgs ); | ||
4814 | 1969 | |||
4815 | 1970 | print PLOG "apt-get failed.\n" if $status && $mode ne "-s"; | ||
4816 | 1971 | return $mode eq "-s" || $status == 0; | ||
4817 | 1972 | } | ||
4818 | 1973 | |||
4819 | 1974 | sub filter_dependencies { | ||
4820 | 1975 | my $dependencies = shift; | ||
4821 | 1976 | my $pos_list = shift; | ||
4822 | 1977 | my $neg_list = shift; | ||
4823 | 1978 | my $special_list = shift; | ||
4824 | 1979 | my($dep, $d, $name, %names); | ||
4825 | 1980 | |||
4826 | 1981 | print PLOG "Checking for already installed source dependencies...\n"; | ||
4827 | 1982 | |||
4828 | 1983 | @$pos_list = @$neg_list = @$special_list = (); | ||
4829 | 1984 | foreach $d (@$dependencies) { | ||
4830 | 1985 | my $name = $d->{'Package'}; | ||
4831 | 1986 | $names{$name} = 1 if $name !~ /^\*/; | ||
4832 | 1987 | foreach (@{$d->{'Alternatives'}}) { | ||
4833 | 1988 | my $name = $_->{'Package'}; | ||
4834 | 1989 | $names{$name} = 1 if $name !~ /^\*/; | ||
4835 | 1990 | } | ||
4836 | 1991 | } | ||
4837 | 1992 | my $status = get_dpkg_status( keys %names ); | ||
4838 | 1993 | |||
4839 | 1994 | foreach $dep (@$dependencies) { | ||
4840 | 1995 | $name = $dep->{'Package'}; | ||
4841 | 1996 | next if !$name; | ||
4842 | 1997 | if ($name =~ /^\*/) { | ||
4843 | 1998 | my $doit = 1; | ||
4844 | 1999 | if (exists $main::specials{$name}->{'condition'}) { | ||
4845 | 2000 | print "Testing condition for special dependency $name:\n" | ||
4846 | 2001 | if $main::debug; | ||
4847 | 2002 | if (run_script("+e",$main::specials{$name}->{'condition'})!=0){ | ||
4848 | 2003 | print "Condition false -> not running scripts\n" | ||
4849 | 2004 | if $main::debug; | ||
4850 | 2005 | $doit = 0; | ||
4851 | 2006 | } | ||
4852 | 2007 | } | ||
4853 | 2008 | push( @$special_list, $name ) if $doit; | ||
4854 | 2009 | next; | ||
4855 | 2010 | } | ||
4856 | 2011 | my $stat = $status->{$name}; | ||
4857 | 2012 | if ($dep->{'Neg'}) { | ||
4858 | 2013 | if ($stat->{'Installed'}) { | ||
4859 | 2014 | my ($rel, $vers) = ($dep->{'Rel'}, $dep->{'Version'}); | ||
4860 | 2015 | my $ivers = $stat->{'Version'}; | ||
4861 | 2016 | if (!$rel || version_cmp( $ivers, $rel, $vers )){ | ||
4862 | 2017 | print "$name: neg dep, installed, not versioned or ", | ||
4863 | 2018 | "version relation satisfied --> remove\n" if $main::debug; | ||
4864 | 2019 | print PLOG "$name: installed (negative dependency)"; | ||
4865 | 2020 | print PLOG " (bad version $ivers $rel $vers)" | ||
4866 | 2021 | if $rel; | ||
4867 | 2022 | print PLOG "\n"; | ||
4868 | 2023 | push( @$neg_list, $name ); | ||
4869 | 2024 | } | ||
4870 | 2025 | else { | ||
4871 | 2026 | print PLOG "$name: installed (negative dependency)", | ||
4872 | 2027 | "(but version ok $ivers $rel $vers)\n"; | ||
4873 | 2028 | } | ||
4874 | 2029 | } | ||
4875 | 2030 | else { | ||
4876 | 2031 | print "$name: neg dep, not installed\n" if $main::debug; | ||
4877 | 2032 | print PLOG "$name: already deinstalled\n"; | ||
4878 | 2033 | } | ||
4879 | 2034 | next; | ||
4880 | 2035 | } | ||
4881 | 2036 | |||
4882 | 2037 | my $is_satisfied = 0; | ||
4883 | 2038 | my $installable = ""; | ||
4884 | 2039 | my $upgradeable = ""; | ||
4885 | 2040 | my $downgradeable = ""; | ||
4886 | 2041 | foreach $d ($dep, @{$dep->{'Alternatives'}}) { | ||
4887 | 2042 | my ($name, $rel, $vers) = | ||
4888 | 2043 | ($d->{'Package'}, $d->{'Rel'}, $d->{'Version'}); | ||
4889 | 2044 | my $stat = $status->{$name}; | ||
4890 | 2045 | if (!$stat->{'Installed'}) { | ||
4891 | 2046 | print "$name: pos dep, not installed\n" if $main::debug; | ||
4892 | 2047 | print PLOG "$name: missing\n"; | ||
4893 | 2048 | my $exists = package_exists($name); | ||
4894 | 2049 | print PLOG "$name: does not exist\n" if not $exists; | ||
4895 | 2050 | $installable = $name if !$installable and $exists; | ||
4896 | 2051 | next; | ||
4897 | 2052 | } | ||
4898 | 2053 | my $ivers = $stat->{'Version'}; | ||
4899 | 2054 | if (!$rel || version_cmp( $ivers, $rel, $vers )) { | ||
4900 | 2055 | print "$name: pos dep, installed, no versioned dep or ", | ||
4901 | 2056 | "version ok\n" if $main::debug; | ||
4902 | 2057 | print PLOG "$name: already installed ($ivers"; | ||
4903 | 2058 | print PLOG " $rel $vers is satisfied" | ||
4904 | 2059 | if $rel; | ||
4905 | 2060 | print PLOG ")\n"; | ||
4906 | 2061 | $is_satisfied = 1; | ||
4907 | 2062 | last; | ||
4908 | 2063 | } | ||
4909 | 2064 | print "$name: vers dep, installed $ivers ! $rel $vers\n" | ||
4910 | 2065 | if $main::debug; | ||
4911 | 2066 | print PLOG "$name: non-matching version installed ", | ||
4912 | 2067 | "($ivers ! $rel $vers)\n"; | ||
4913 | 2068 | if ($rel =~ /^</ || | ||
4914 | 2069 | ($rel eq '=' && version_cmp($ivers, '>>', $vers))) { | ||
4915 | 2070 | print "$name: would be a downgrade!\n" if $main::debug; | ||
4916 | 2071 | print PLOG "$name: would have to downgrade!\n"; | ||
4917 | 2072 | $downgradeable = $name if !$downgradeable; | ||
4918 | 2073 | } | ||
4919 | 2074 | else { | ||
4920 | 2075 | $upgradeable = $name if !$upgradeable; | ||
4921 | 2076 | } | ||
4922 | 2077 | } | ||
4923 | 2078 | if (!$is_satisfied) { | ||
4924 | 2079 | if ($upgradeable) { | ||
4925 | 2080 | print "using $upgradeable for upgrade\n" if $main::debug; | ||
4926 | 2081 | push( @$pos_list, $upgradeable ); | ||
4927 | 2082 | } | ||
4928 | 2083 | elsif ($installable) { | ||
4929 | 2084 | print "using $installable for install\n" if $main::debug; | ||
4930 | 2085 | push( @$pos_list, $installable ); | ||
4931 | 2086 | } | ||
4932 | 2087 | elsif ($downgradeable) { | ||
4933 | 2088 | print PLOG "To satisfy this dependency the package(s) would ", | ||
4934 | 2089 | "have\n", | ||
4935 | 2090 | "to be downgraded; this is not implemented.\n"; | ||
4936 | 2091 | return 0; | ||
4937 | 2092 | } | ||
4938 | 2093 | else { | ||
4939 | 2094 | # None of the build-deps exist. Return the | ||
4940 | 2095 | # first one so that we get a useful dep-wait. | ||
4941 | 2096 | $installable = $dep->{'Package'}; | ||
4942 | 2097 | print "using $installable for install (does not exist)\n" if $main::debug; | ||
4943 | 2098 | push( @$pos_list, $installable ); | ||
4944 | 2099 | } | ||
4945 | 2100 | } | ||
4946 | 2101 | } | ||
4947 | 2102 | |||
4948 | 2103 | return 1; | ||
4949 | 2104 | } | ||
4950 | 2105 | |||
4951 | 2106 | sub check_dependencies { | ||
4952 | 2107 | my $dependencies = shift; | ||
4953 | 2108 | my $fail = ""; | ||
4954 | 2109 | my($dep, $d, $name, %names); | ||
4955 | 2110 | |||
4956 | 2111 | print PLOG "Checking correctness of source dependencies...\n"; | ||
4957 | 2112 | |||
4958 | 2113 | foreach $d (@$dependencies) { | ||
4959 | 2114 | my $name = $d->{'Package'}; | ||
4960 | 2115 | $names{$name} = 1 if $name !~ /^\*/; | ||
4961 | 2116 | foreach (@{$d->{'Alternatives'}}) { | ||
4962 | 2117 | my $name = $_->{'Package'}; | ||
4963 | 2118 | $names{$name} = 1 if $name !~ /^\*/; | ||
4964 | 2119 | } | ||
4965 | 2120 | } | ||
4966 | 2121 | foreach $name (@main::toolchain_pkgs) { | ||
4967 | 2122 | $names{$name} = 1; | ||
4968 | 2123 | } | ||
4969 | 2124 | my $status = get_dpkg_status( keys %names ); | ||
4970 | 2125 | |||
4971 | 2126 | foreach $dep (@$dependencies) { | ||
4972 | 2127 | $name = $dep->{'Package'}; | ||
4973 | 2128 | next if $name =~ /^\*/; | ||
4974 | 2129 | my $stat = $status->{$name}; | ||
4975 | 2130 | if ($dep->{'Neg'}) { | ||
4976 | 2131 | if ($stat->{'Installed'}) { | ||
4977 | 2132 | if (!$dep->{'Rel'}) { | ||
4978 | 2133 | $fail .= "$name(still installed) "; | ||
4979 | 2134 | } | ||
4980 | 2135 | elsif (version_cmp($stat->{'Version'}, $dep->{'Rel'}, | ||
4981 | 2136 | $dep->{'Version'})) { | ||
4982 | 2137 | $fail .= "$name(inst $stat->{'Version'} $dep->{'Rel'} ". | ||
4983 | 2138 | "conflicted $dep->{'Version'})\n"; | ||
4984 | 2139 | } | ||
4985 | 2140 | } | ||
4986 | 2141 | } | ||
4987 | 2142 | else { | ||
4988 | 2143 | my $is_satisfied = 0; | ||
4989 | 2144 | my $f = ""; | ||
4990 | 2145 | foreach $d ($dep, @{$dep->{'Alternatives'}}) { | ||
4991 | 2146 | my $name = $d->{'Package'}; | ||
4992 | 2147 | my $stat = $status->{$name}; | ||
4993 | 2148 | if (!$stat->{'Installed'}) { | ||
4994 | 2149 | $f =~ s/ $/\|/ if $f; | ||
4995 | 2150 | $f .= "$name(missing) "; | ||
4996 | 2151 | } | ||
4997 | 2152 | elsif ($d->{'Rel'} && | ||
4998 | 2153 | !version_cmp( $stat->{'Version'}, $d->{'Rel'}, | ||
4999 | 2154 | $d->{'Version'} )) { | ||
5000 | 2155 | $f =~ s/ $/\|/ if $f; |
The diff has been truncated for viewing.