Merge lp:~lifeless/bzr-builddeb/trunk into lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old
- trunk
- Merge into trunk-old
Proposed by
Robert Collins
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | James Westby | ||||||||||||||||
Approved revision: | not available | ||||||||||||||||
Merge reported by: | James Westby | ||||||||||||||||
Merged at revision: | not available | ||||||||||||||||
Proposed branch: | lp:~lifeless/bzr-builddeb/trunk | ||||||||||||||||
Merge into: | lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old | ||||||||||||||||
Diff against target: |
473 lines (+64/-53) 7 files modified
builder.py (+5/-5) changes.py (+1/-1) cmds.py (+19/-19) directory.py (+5/-5) hooks.py (+2/-2) import_dsc.py (+16/-5) upstream.py (+16/-16) |
||||||||||||||||
To merge this branch: | bzr merge lp:~lifeless/bzr-builddeb/trunk | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Robert Collins (lifeless) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
James Westby (james-w) wrote : | # |
On Fri Nov 27 01:15:22 UTC 2009 Robert Collins wrote:
> Robert Collins has proposed merging lp:~lifeless/bzr-builddeb/trunk into
> lp:bzr-builddeb.
>
> Requested reviews:
> Bzr-builddeb-
> Related bugs:
> #486534 merge-upstream doesn't work in shared treeless repo
> https:/
>
>
> Various bits.
The stuff unique to this proposal looks fine to me.
Thanks,
James
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
James Westby (james-w) wrote : | # |
Merged, with the tweak to use subprocess not os.system.
Thanks,
James
review:
Approve
lp:~lifeless/bzr-builddeb/trunk
updated
- 385. By James Westby
-
Use bzrlib.trace.note instead of the deprecated b.t.info. Thanks Jelmer.
- 386. By James Westby
-
Clean up some unused imports.
- 387. By James Westby
-
Handle no-trees repo in merge-upstream, and subprocess_setup in more places.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'builder.py' |
2 | --- builder.py 2009-07-15 20:48:37 +0000 |
3 | +++ builder.py 2009-11-27 01:15:21 +0000 |
4 | @@ -23,7 +23,7 @@ |
5 | import subprocess |
6 | import os |
7 | |
8 | -from bzrlib.trace import info |
9 | +from bzrlib.trace import note |
10 | |
11 | from bzrlib.plugins.builddeb.errors import ( |
12 | NoSourceDirError, |
13 | @@ -69,10 +69,10 @@ |
14 | os.makedirs(parent_dir) |
15 | if os.path.exists(self.target_dir): |
16 | if not self.use_existing: |
17 | - info("Purging the build dir: %s", self.target_dir) |
18 | + note("Purging the build dir: %s", self.target_dir) |
19 | shutil.rmtree(self.target_dir) |
20 | else: |
21 | - info("Not purging build dir as requested: %s", |
22 | + note("Not purging build dir as requested: %s", |
23 | self.target_dir) |
24 | else: |
25 | if self.use_existing: |
26 | @@ -83,7 +83,7 @@ |
27 | |
28 | def build(self): |
29 | """This builds the package using the supplied command.""" |
30 | - info("Building the package in %s, using %s", self.target_dir, |
31 | + note("Building the package in %s, using %s", self.target_dir, |
32 | self.builder) |
33 | proc = subprocess.Popen(self.builder, shell=True, cwd=self.target_dir, |
34 | preexec_fn=subprocess_setup) |
35 | @@ -93,5 +93,5 @@ |
36 | |
37 | def clean(self): |
38 | """This removes the build directory.""" |
39 | - info("Cleaning build dir: %s", self.target_dir) |
40 | + note("Cleaning build dir: %s", self.target_dir) |
41 | shutil.rmtree(self.target_dir) |
42 | |
43 | === modified file 'changes.py' |
44 | --- changes.py 2009-03-16 15:52:52 +0000 |
45 | +++ changes.py 2009-11-27 01:15:21 +0000 |
46 | @@ -18,13 +18,13 @@ |
47 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
48 | # |
49 | |
50 | -import commands |
51 | import os |
52 | |
53 | from debian_bundle import deb822 |
54 | |
55 | from bzrlib.trace import mutter |
56 | |
57 | +from bzrlib.plugins.builddeb import commands |
58 | from bzrlib.plugins.builddeb.errors import DebianError, MissingChanges |
59 | |
60 | class DebianChanges(deb822.Changes): |
61 | |
62 | === modified file 'cmds.py' |
63 | --- cmds.py 2009-11-23 22:02:25 +0000 |
64 | +++ cmds.py 2009-11-27 01:15:21 +0000 |
65 | @@ -44,7 +44,7 @@ |
66 | from bzrlib.export import export |
67 | from bzrlib.option import Option |
68 | from bzrlib.revisionspec import RevisionSpec |
69 | -from bzrlib.trace import info, warning |
70 | +from bzrlib.trace import note, warning |
71 | from bzrlib.workingtree import WorkingTree |
72 | |
73 | from bzrlib.plugins.builddeb import ( |
74 | @@ -223,7 +223,7 @@ |
75 | |
76 | def _get_build_tree(self, revision, tree, branch): |
77 | if revision is None and tree is not None: |
78 | - info("Building using working tree") |
79 | + note("Building using working tree") |
80 | working_tree = True |
81 | else: |
82 | if revision is None: |
83 | @@ -233,7 +233,7 @@ |
84 | else: |
85 | raise BzrCommandError('bzr builddeb --revision takes exactly one ' |
86 | 'revision specifier.') |
87 | - info("Building branch from revision %s", revid) |
88 | + note("Building branch from revision %s", revid) |
89 | tree = branch.repository.revision_tree(revid) |
90 | working_tree = False |
91 | return tree, working_tree |
92 | @@ -242,20 +242,20 @@ |
93 | if not merge: |
94 | merge = config.merge |
95 | if merge: |
96 | - info("Running in merge mode") |
97 | + note("Running in merge mode") |
98 | native = False |
99 | split = False |
100 | else: |
101 | if not native: |
102 | native = config.native |
103 | if native: |
104 | - info("Running in native mode") |
105 | + note("Running in native mode") |
106 | split = False |
107 | else: |
108 | if not split: |
109 | split = config.split |
110 | if split: |
111 | - info("Running in split mode") |
112 | + note("Running in split mode") |
113 | return merge, native, split |
114 | |
115 | def _get_build_command(self, config, builder, quick, build_options): |
116 | @@ -367,7 +367,7 @@ |
117 | try: |
118 | config = debuild_config(tree, working_tree, no_user_config) |
119 | if reuse: |
120 | - info("Reusing existing build dir") |
121 | + note("Reusing existing build dir") |
122 | dont_purge = True |
123 | use_existing = True |
124 | merge, native, split = self._build_type(config, merge, native, split) |
125 | @@ -535,11 +535,11 @@ |
126 | if distribution is None: |
127 | distribution = find_last_distribution(changelog) |
128 | if distribution is not None: |
129 | - info("Using distribution %s" % distribution) |
130 | + note("Using distribution %s" % distribution) |
131 | except MissingChangelogError: |
132 | current_version = None |
133 | if distribution is None: |
134 | - info("No distribution specified, and no changelog, " |
135 | + note("No distribution specified, and no changelog, " |
136 | "assuming 'debian'") |
137 | distribution = "debian" |
138 | |
139 | @@ -583,7 +583,7 @@ |
140 | version = upstream_branch_version(upstream_branch, |
141 | upstream_revision, package, |
142 | current_version.upstream_version) |
143 | - info("Using version string %s for upstream branch." % (version)) |
144 | + note("Using version string %s for upstream branch." % (version)) |
145 | else: |
146 | raise BzrCommandError("You must specify the " |
147 | "version number using --version.") |
148 | @@ -622,11 +622,11 @@ |
149 | package) |
150 | finally: |
151 | tree.unlock() |
152 | - info("The new upstream version has been imported.") |
153 | + note("The new upstream version has been imported.") |
154 | if conflicts: |
155 | - info("You should now resolve the conflicts, review the changes, and then commit.") |
156 | + note("You should now resolve the conflicts, review the changes, and then commit.") |
157 | else: |
158 | - info("You should now review the changes and then commit.") |
159 | + note("You should now review the changes and then commit.") |
160 | |
161 | |
162 | class cmd_import_dsc(Command): |
163 | @@ -810,16 +810,16 @@ |
164 | builder.prepare() |
165 | run_hook(t, 'pre-export', config) |
166 | builder.export() |
167 | - info('Running "%s" in the exported directory.' % (command)) |
168 | + note('Running "%s" in the exported directory.' % (command)) |
169 | if give_instruction: |
170 | - info('If you want to cancel your changes then exit with a non-zero ' |
171 | + note('If you want to cancel your changes then exit with a non-zero ' |
172 | 'exit code, e.g. run "exit 1".') |
173 | try: |
174 | builder.build() |
175 | except BuildFailedError: |
176 | raise BzrCommandError('Not updating the working tree as the ' |
177 | 'command failed.') |
178 | - info("Copying debian/ back") |
179 | + note("Copying debian/ back") |
180 | if larstiq: |
181 | destination = '' |
182 | else: |
183 | @@ -834,7 +834,7 @@ |
184 | if proc.returncode != 0: |
185 | raise BzrCommandError('Copying back debian/ failed') |
186 | builder.clean() |
187 | - info('If any files were added or removed you should run "bzr add" or ' |
188 | + note('If any files were added or removed you should run "bzr add" or ' |
189 | '"bzr rm" as appropriate.') |
190 | |
191 | |
192 | @@ -914,10 +914,10 @@ |
193 | # Merge source packaging branch in to the target packaging branch. |
194 | conflicts = tree.merge_from_branch(source_branch) |
195 | if conflicts > 0: |
196 | - info('The merge resulted in %s conflicts. Please resolve these ' |
197 | + note('The merge resulted in %s conflicts. Please resolve these ' |
198 | 'and commit the changes with "bzr commit".' % conflicts) |
199 | else: |
200 | - info('The merge resulted in no conflicts. You may commit the ' |
201 | + note('The merge resulted in no conflicts. You may commit the ' |
202 | 'changes by running "bzr commit".') |
203 | |
204 | |
205 | |
206 | === modified file 'directory.py' |
207 | --- directory.py 2009-04-16 10:42:12 +0000 |
208 | +++ directory.py 2009-11-27 01:15:21 +0000 |
209 | @@ -19,7 +19,7 @@ |
210 | # |
211 | |
212 | from bzrlib import errors |
213 | -from bzrlib.trace import info |
214 | +from bzrlib.trace import note |
215 | |
216 | import apt_pkg |
217 | |
218 | @@ -61,7 +61,7 @@ |
219 | raise errors.InvalidURL(path=url, |
220 | extra='version %s not found' % version) |
221 | |
222 | - info("Retrieving Vcs locating from %s Debian version %s", name, version) |
223 | + note("Retrieving Vcs locating from %s Debian version %s", name, version) |
224 | |
225 | if "Bzr" in urls[version]: |
226 | return urls[version]["Bzr"] |
227 | @@ -70,7 +70,7 @@ |
228 | try: |
229 | import bzrlib.plugins.svn |
230 | except ImportError: |
231 | - info("This package uses subversion. If you would like to " |
232 | + note("This package uses subversion. If you would like to " |
233 | "access it with bzr then please install bzr-svn " |
234 | "and re-run the command.") |
235 | else: |
236 | @@ -80,7 +80,7 @@ |
237 | try: |
238 | import bzrlib.plugins.git |
239 | except ImportError: |
240 | - info("This package uses git. If you would like to " |
241 | + note("This package uses git. If you would like to " |
242 | "access it with bzr then please install bzr-git " |
243 | "and re-run the command.") |
244 | else: |
245 | @@ -90,7 +90,7 @@ |
246 | try: |
247 | import bzrlib.plugins.hg |
248 | except ImportError: |
249 | - info("This package uses hg. If you would like to " |
250 | + note("This package uses hg. If you would like to " |
251 | "access it with bzr then please install bzr-hg" |
252 | "and re-run the command.") |
253 | else: |
254 | |
255 | === modified file 'hooks.py' |
256 | --- hooks.py 2008-05-18 00:04:21 +0000 |
257 | +++ hooks.py 2009-11-27 01:15:21 +0000 |
258 | @@ -20,7 +20,7 @@ |
259 | |
260 | import subprocess |
261 | |
262 | -from bzrlib.trace import info |
263 | +from bzrlib.trace import note |
264 | |
265 | from bzrlib.plugins.builddeb.errors import HookFailedError |
266 | |
267 | @@ -29,7 +29,7 @@ |
268 | hook = config.get_hook(hook_name) |
269 | if hook is None: |
270 | return |
271 | - info("Running %s as %s hook" % (hook, hook_name)) |
272 | + note("Running %s as %s hook" % (hook, hook_name)) |
273 | proc = subprocess.Popen(hook, shell=True, |
274 | cwd=tree.abspath(wd)) |
275 | proc.wait() |
276 | |
277 | === modified file 'import_dsc.py' |
278 | --- import_dsc.py 2009-09-16 14:52:14 +0000 |
279 | +++ import_dsc.py 2009-11-27 01:15:21 +0000 |
280 | @@ -35,6 +35,7 @@ |
281 | import md5 |
282 | import os |
283 | import shutil |
284 | +import signal |
285 | import stat |
286 | from subprocess import Popen, PIPE |
287 | from StringIO import StringIO |
288 | @@ -54,12 +55,13 @@ |
289 | AlreadyBranchError, |
290 | BzrCommandError, |
291 | NotBranchError, |
292 | + NoWorkingTree, |
293 | ) |
294 | from bzrlib.export import export |
295 | from bzrlib.osutils import file_iterator, isdir, basename, splitpath |
296 | from bzrlib.revisionspec import RevisionSpec |
297 | from bzrlib.revision import NULL_REVISION |
298 | -from bzrlib.trace import warning, info, mutter |
299 | +from bzrlib.trace import warning, note, mutter |
300 | from bzrlib.transform import TreeTransform, cook_conflicts, resolve_conflicts |
301 | from bzrlib.transport import ( |
302 | get_transport, |
303 | @@ -1551,7 +1553,11 @@ |
304 | dir_to = self.branch.bzrdir.sprout(to_location, |
305 | revision_id=upstream_tip, |
306 | accelerator_tree=self.tree) |
307 | - self.upstream_tree = dir_to.open_workingtree() |
308 | + try: |
309 | + self.upstream_tree = dir_to.open_workingtree() |
310 | + except NoWorkingTree: |
311 | + # Handle shared treeless repo's. |
312 | + self.upstream_tree = dir_to.create_workingtree() |
313 | self.upstream_branch = self.upstream_tree.branch |
314 | |
315 | _extract_upstream_tree = extract_upstream_tree |
316 | @@ -1583,8 +1589,13 @@ |
317 | def _extract_tarball_to_tempdir(self, tarball_filename): |
318 | tempdir = tempfile.mkdtemp() |
319 | try: |
320 | - assert os.system("tar xzf %s -C %s --strip-components 1" |
321 | - % (tarball_filename, tempdir)) == 0 |
322 | + old_sig = signal.getsignal(signal.SIGPIPE) |
323 | + signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
324 | + try: |
325 | + assert os.system("tar xzf %s -C %s --strip-components 1" |
326 | + % (tarball_filename, tempdir)) == 0 |
327 | + finally: |
328 | + signal.signal(signal.SIGPIPE, old_sig) |
329 | return tempdir |
330 | except: |
331 | shutil.rmtree(tempdir) |
332 | @@ -1728,7 +1739,7 @@ |
333 | finally: |
334 | tree.unlock() |
335 | command = ["/usr/bin/pristine-tar", "gendelta", tarball_path, "-"] |
336 | - info(" ".join(command)) |
337 | + note(" ".join(command)) |
338 | proc = Popen(command, stdout=PIPE, cwd=dest) |
339 | (stdout, stderr) = proc.communicate() |
340 | if proc.returncode != 0: |
341 | |
342 | === modified file 'upstream.py' |
343 | --- upstream.py 2009-09-14 15:38:18 +0000 |
344 | +++ upstream.py 2009-11-27 01:15:21 +0000 |
345 | @@ -28,7 +28,7 @@ |
346 | |
347 | from bzrlib.export import export |
348 | from bzrlib.revisionspec import RevisionSpec |
349 | -from bzrlib.trace import info |
350 | +from bzrlib.trace import note |
351 | |
352 | from bzrlib.plugins.builddeb.errors import ( |
353 | MissingUpstreamTarball, |
354 | @@ -83,7 +83,7 @@ |
355 | revid = db.revid_of_upstream_version_from_branch(version) |
356 | if not db.has_pristine_tar_delta(revid): |
357 | raise PackageVersionNotPresent(package, version, self) |
358 | - info("Using pristine-tar to reconstruct the needed tarball.") |
359 | + note("Using pristine-tar to reconstruct the needed tarball.") |
360 | try: |
361 | db.reconstruct_pristine_tar(revid, package, version, target_filename) |
362 | except PristineTarError: |
363 | @@ -109,14 +109,14 @@ |
364 | raise PackageVersionNotPresent(package, upstream_version, self) |
365 | |
366 | sources.Restart() |
367 | - info("Using apt to look for the upstream tarball.") |
368 | + note("Using apt to look for the upstream tarball.") |
369 | while sources.Lookup(package): |
370 | if upstream_version \ |
371 | == Version(sources.Version).upstream_version: |
372 | if self._run_apt_source(package, sources.Version, target_dir): |
373 | return |
374 | break |
375 | - info("apt could not find the needed tarball.") |
376 | + note("apt could not find the needed tarball.") |
377 | raise PackageVersionNotPresent(package, upstream_version, self) |
378 | |
379 | def _get_command(self, package, version_str): |
380 | @@ -157,7 +157,7 @@ |
381 | self.upstream_branch.lock_read() |
382 | try: |
383 | revid = self._get_revision_id(version) |
384 | - info("Exporting upstream branch revision %s to create the tarball", |
385 | + note("Exporting upstream branch revision %s to create the tarball", |
386 | revid) |
387 | target_filename = self._tarball_path(package, version, target_dir) |
388 | tarball_base = "%s-%s" % (package, version) |
389 | @@ -176,16 +176,16 @@ |
390 | |
391 | def _get_orig_source(self, source_dir, desired_tarball_name, |
392 | target_dir): |
393 | - info("Trying to use get-orig-source to retrieve needed tarball.") |
394 | + note("Trying to use get-orig-source to retrieve needed tarball.") |
395 | command = ["/usr/bin/make", "-f", "debian/rules", "get-orig-source"] |
396 | proc = subprocess.Popen(command, cwd=source_dir) |
397 | ret = proc.wait() |
398 | if ret != 0: |
399 | - info("Trying to run get-orig-source rule failed") |
400 | + note("Trying to run get-orig-source rule failed") |
401 | return False |
402 | fetched_tarball = os.path.join(source_dir, desired_tarball_name) |
403 | if not os.path.exists(fetched_tarball): |
404 | - info("get-orig-source did not create %s", desired_tarball_name) |
405 | + note("get-orig-source did not create %s", desired_tarball_name) |
406 | return False |
407 | repack_tarball(fetched_tarball, desired_tarball_name, |
408 | target_dir=target_dir) |
409 | @@ -213,7 +213,7 @@ |
410 | return |
411 | finally: |
412 | shutil.rmtree(tmpdir) |
413 | - info("No debian/rules file to try and use for a get-orig-source rule") |
414 | + note("No debian/rules file to try and use for a get-orig-source rule") |
415 | raise PackageVersionNotPresent(package, version, self) |
416 | |
417 | |
418 | @@ -225,14 +225,14 @@ |
419 | self.larstiq = larstiq |
420 | |
421 | def _uscan(self, package, upstream_version, watch_file, target_dir): |
422 | - info("Using uscan to look for the upstream tarball.") |
423 | + note("Using uscan to look for the upstream tarball.") |
424 | r = os.system("uscan --upstream-version %s --force-download --rename " |
425 | "--package %s --watchfile %s --check-dirname-level 0 " |
426 | "--download --repack --destdir %s --download-version %s" % |
427 | (upstream_version, package, watch_file, target_dir, |
428 | upstream_version)) |
429 | if r != 0: |
430 | - info("uscan could not find the needed tarball.") |
431 | + note("uscan could not find the needed tarball.") |
432 | return False |
433 | return True |
434 | |
435 | @@ -243,7 +243,7 @@ |
436 | watchfile = 'debian/watch' |
437 | watch_id = self.tree.path2id(watchfile) |
438 | if watch_id is None: |
439 | - info("No watch file to use to retrieve upstream tarball.") |
440 | + note("No watch file to use to retrieve upstream tarball.") |
441 | return None |
442 | (tmp, tempfilename) = tempfile.mkstemp() |
443 | try: |
444 | @@ -287,7 +287,7 @@ |
445 | shutil.rmtree(tmpdir) |
446 | |
447 | def get_specific_version(self, package, version, target_dir): |
448 | - info("Using the current branch without the 'debian' directory " |
449 | + note("Using the current branch without the 'debian' directory " |
450 | "to create the tarball") |
451 | self._split(package, version, |
452 | self._tarball_path(package, version, target_dir)) |
453 | @@ -387,9 +387,9 @@ |
454 | :param target_dir: The directory to place the tarball in. |
455 | :return: The path to the tarball. |
456 | """ |
457 | - info("Looking for a way to retrieve the upstream tarball") |
458 | + note("Looking for a way to retrieve the upstream tarball") |
459 | if self.already_exists_in_target(target_dir): |
460 | - info("Upstream tarball already exists in build directory, " |
461 | + note("Upstream tarball already exists in build directory, " |
462 | "using that") |
463 | return os.path.join(target_dir, self._tarball_name()) |
464 | if not self.already_exists_in_store(): |
465 | @@ -401,7 +401,7 @@ |
466 | except PackageVersionNotPresent: |
467 | raise MissingUpstreamTarball(self._tarball_name()) |
468 | else: |
469 | - info("Using the upstream tarball that is present in " |
470 | + note("Using the upstream tarball that is present in " |
471 | "%s" % self.store_dir) |
472 | assert self.provide_from_store_dir(target_dir) |
473 | return os.path.join(target_dir, self._tarball_name()) |
Various bits.