Merge lp:~lifeless/bzr-builddeb/2.0 into lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old
- 2.0
- Merge into trunk-old
Status: | Rejected |
---|---|
Rejected by: | James Westby |
Proposed branch: | lp:~lifeless/bzr-builddeb/2.0 |
Merge into: | lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old |
Diff against target: |
442 lines (+52/-52) 7 files modified
builder.py (+5/-5) changes.py (+1/-1) cmds.py (+21/-21) directory.py (+5/-5) hooks.py (+2/-2) import_dsc.py (+2/-2) upstream.py (+16/-16) |
To merge this branch: | bzr merge lp:~lifeless/bzr-builddeb/2.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Disapprove | ||
Review via email:
|
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Robert Collins (lifeless) wrote : | # |
- 381. By Robert Collins
-
Import commands more safely.
- 382. By Robert Collins
-
Merge bug fixes from Aaron. Note that these are untested and show untested parts of bzr-builddeb.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
James Westby (james-w) wrote : | # |
Hi,
Thanks for working on this, but merging this gives an empty diff
from my current tree for a few reasons, so I reject.
The info->note changes were fixed by https:/
50 -import commands
51 import os
52
53 from debian_bundle import deb822
54
55 from bzrlib.trace import mutter
56
57 +from bzrlib.
58 from bzrlib.
There's no bzrlib.
commands module is what is being used, so I think this shouldn't
change.
167 - db.upstream_
168 + db.upstream_
That's not right, the API doesn't let us distinguish the two types of
version very well, but I had already fixed this properly (last_version.
in a recent revision.
170 - last_version)
171 + last_version.
That had also been fixed in a recent revision.
Thanks,
James
Unmerged revisions
Preview Diff
1 | === modified file 'builder.py' |
2 | --- builder.py 2009-07-15 20:48:37 +0000 |
3 | +++ builder.py 2009-11-22 03:20:24 +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-22 03:20:24 +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-09-16 12:47:18 +0000 |
64 | +++ cmds.py 2009-11-22 03:20:24 +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 | @@ -224,7 +224,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 | @@ -234,7 +234,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 | @@ -243,20 +243,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 | @@ -368,7 +368,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 | @@ -533,11 +533,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 | @@ -581,7 +581,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 | @@ -620,11 +620,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 | @@ -729,9 +729,9 @@ |
164 | raise BzrCommandError("Unable to find the tag for " |
165 | "the previous upstream version, %s, in the " |
166 | "branch: %s" % (last_version, |
167 | - db.upstream_tag_name(last_version))) |
168 | + db.upstream_tag_name(str(last_version)))) |
169 | upstream_tip = db.revid_of_upstream_version_from_branch( |
170 | - last_version) |
171 | + last_version.upstream_version) |
172 | db.extract_upstream_tree(upstream_tip, tempdir) |
173 | else: |
174 | db._create_empty_upstream_tree(tempdir) |
175 | @@ -808,16 +808,16 @@ |
176 | builder.prepare() |
177 | run_hook(t, 'pre-export', config) |
178 | builder.export() |
179 | - info('Running "%s" in the exported directory.' % (command)) |
180 | + note('Running "%s" in the exported directory.' % (command)) |
181 | if give_instruction: |
182 | - info('If you want to cancel your changes then exit with a non-zero ' |
183 | + note('If you want to cancel your changes then exit with a non-zero ' |
184 | 'exit code, e.g. run "exit 1".') |
185 | try: |
186 | builder.build() |
187 | except BuildFailedError: |
188 | raise BzrCommandError('Not updating the working tree as the ' |
189 | 'command failed.') |
190 | - info("Copying debian/ back") |
191 | + note("Copying debian/ back") |
192 | if larstiq: |
193 | destination = '' |
194 | else: |
195 | @@ -832,7 +832,7 @@ |
196 | if proc.returncode != 0: |
197 | raise BzrCommandError('Copying back debian/ failed') |
198 | builder.clean() |
199 | - info('If any files were added or removed you should run "bzr add" or ' |
200 | + note('If any files were added or removed you should run "bzr add" or ' |
201 | '"bzr rm" as appropriate.') |
202 | |
203 | |
204 | @@ -913,10 +913,10 @@ |
205 | # Merge source packaging branch in to the target packaging branch. |
206 | conflicts = tree.merge_from_branch(source_branch) |
207 | if conflicts > 0: |
208 | - info('The merge resulted in %s conflicts. Please resolve these ' |
209 | + note('The merge resulted in %s conflicts. Please resolve these ' |
210 | 'and commit the changes with "bzr commit".' % conflicts) |
211 | else: |
212 | - info('The merge resulted in no conflicts. You may commit the ' |
213 | + note('The merge resulted in no conflicts. You may commit the ' |
214 | 'changes by running "bzr commit".') |
215 | |
216 | |
217 | |
218 | === modified file 'directory.py' |
219 | --- directory.py 2009-04-16 10:42:12 +0000 |
220 | +++ directory.py 2009-11-22 03:20:24 +0000 |
221 | @@ -19,7 +19,7 @@ |
222 | # |
223 | |
224 | from bzrlib import errors |
225 | -from bzrlib.trace import info |
226 | +from bzrlib.trace import note |
227 | |
228 | import apt_pkg |
229 | |
230 | @@ -61,7 +61,7 @@ |
231 | raise errors.InvalidURL(path=url, |
232 | extra='version %s not found' % version) |
233 | |
234 | - info("Retrieving Vcs locating from %s Debian version %s", name, version) |
235 | + note("Retrieving Vcs locating from %s Debian version %s", name, version) |
236 | |
237 | if "Bzr" in urls[version]: |
238 | return urls[version]["Bzr"] |
239 | @@ -70,7 +70,7 @@ |
240 | try: |
241 | import bzrlib.plugins.svn |
242 | except ImportError: |
243 | - info("This package uses subversion. If you would like to " |
244 | + note("This package uses subversion. If you would like to " |
245 | "access it with bzr then please install bzr-svn " |
246 | "and re-run the command.") |
247 | else: |
248 | @@ -80,7 +80,7 @@ |
249 | try: |
250 | import bzrlib.plugins.git |
251 | except ImportError: |
252 | - info("This package uses git. If you would like to " |
253 | + note("This package uses git. If you would like to " |
254 | "access it with bzr then please install bzr-git " |
255 | "and re-run the command.") |
256 | else: |
257 | @@ -90,7 +90,7 @@ |
258 | try: |
259 | import bzrlib.plugins.hg |
260 | except ImportError: |
261 | - info("This package uses hg. If you would like to " |
262 | + note("This package uses hg. If you would like to " |
263 | "access it with bzr then please install bzr-hg" |
264 | "and re-run the command.") |
265 | else: |
266 | |
267 | === modified file 'hooks.py' |
268 | --- hooks.py 2008-05-18 00:04:21 +0000 |
269 | +++ hooks.py 2009-11-22 03:20:24 +0000 |
270 | @@ -20,7 +20,7 @@ |
271 | |
272 | import subprocess |
273 | |
274 | -from bzrlib.trace import info |
275 | +from bzrlib.trace import note |
276 | |
277 | from bzrlib.plugins.builddeb.errors import HookFailedError |
278 | |
279 | @@ -29,7 +29,7 @@ |
280 | hook = config.get_hook(hook_name) |
281 | if hook is None: |
282 | return |
283 | - info("Running %s as %s hook" % (hook, hook_name)) |
284 | + note("Running %s as %s hook" % (hook, hook_name)) |
285 | proc = subprocess.Popen(hook, shell=True, |
286 | cwd=tree.abspath(wd)) |
287 | proc.wait() |
288 | |
289 | === modified file 'import_dsc.py' |
290 | --- import_dsc.py 2009-09-16 14:52:14 +0000 |
291 | +++ import_dsc.py 2009-11-22 03:20:24 +0000 |
292 | @@ -59,7 +59,7 @@ |
293 | from bzrlib.osutils import file_iterator, isdir, basename, splitpath |
294 | from bzrlib.revisionspec import RevisionSpec |
295 | from bzrlib.revision import NULL_REVISION |
296 | -from bzrlib.trace import warning, info, mutter |
297 | +from bzrlib.trace import warning, note, mutter |
298 | from bzrlib.transform import TreeTransform, cook_conflicts, resolve_conflicts |
299 | from bzrlib.transport import ( |
300 | get_transport, |
301 | @@ -1728,7 +1728,7 @@ |
302 | finally: |
303 | tree.unlock() |
304 | command = ["/usr/bin/pristine-tar", "gendelta", tarball_path, "-"] |
305 | - info(" ".join(command)) |
306 | + note(" ".join(command)) |
307 | proc = Popen(command, stdout=PIPE, cwd=dest) |
308 | (stdout, stderr) = proc.communicate() |
309 | if proc.returncode != 0: |
310 | |
311 | === modified file 'upstream.py' |
312 | --- upstream.py 2009-09-14 15:38:18 +0000 |
313 | +++ upstream.py 2009-11-22 03:20:24 +0000 |
314 | @@ -28,7 +28,7 @@ |
315 | |
316 | from bzrlib.export import export |
317 | from bzrlib.revisionspec import RevisionSpec |
318 | -from bzrlib.trace import info |
319 | +from bzrlib.trace import note |
320 | |
321 | from bzrlib.plugins.builddeb.errors import ( |
322 | MissingUpstreamTarball, |
323 | @@ -83,7 +83,7 @@ |
324 | revid = db.revid_of_upstream_version_from_branch(version) |
325 | if not db.has_pristine_tar_delta(revid): |
326 | raise PackageVersionNotPresent(package, version, self) |
327 | - info("Using pristine-tar to reconstruct the needed tarball.") |
328 | + note("Using pristine-tar to reconstruct the needed tarball.") |
329 | try: |
330 | db.reconstruct_pristine_tar(revid, package, version, target_filename) |
331 | except PristineTarError: |
332 | @@ -109,14 +109,14 @@ |
333 | raise PackageVersionNotPresent(package, upstream_version, self) |
334 | |
335 | sources.Restart() |
336 | - info("Using apt to look for the upstream tarball.") |
337 | + note("Using apt to look for the upstream tarball.") |
338 | while sources.Lookup(package): |
339 | if upstream_version \ |
340 | == Version(sources.Version).upstream_version: |
341 | if self._run_apt_source(package, sources.Version, target_dir): |
342 | return |
343 | break |
344 | - info("apt could not find the needed tarball.") |
345 | + note("apt could not find the needed tarball.") |
346 | raise PackageVersionNotPresent(package, upstream_version, self) |
347 | |
348 | def _get_command(self, package, version_str): |
349 | @@ -157,7 +157,7 @@ |
350 | self.upstream_branch.lock_read() |
351 | try: |
352 | revid = self._get_revision_id(version) |
353 | - info("Exporting upstream branch revision %s to create the tarball", |
354 | + note("Exporting upstream branch revision %s to create the tarball", |
355 | revid) |
356 | target_filename = self._tarball_path(package, version, target_dir) |
357 | tarball_base = "%s-%s" % (package, version) |
358 | @@ -176,16 +176,16 @@ |
359 | |
360 | def _get_orig_source(self, source_dir, desired_tarball_name, |
361 | target_dir): |
362 | - info("Trying to use get-orig-source to retrieve needed tarball.") |
363 | + note("Trying to use get-orig-source to retrieve needed tarball.") |
364 | command = ["/usr/bin/make", "-f", "debian/rules", "get-orig-source"] |
365 | proc = subprocess.Popen(command, cwd=source_dir) |
366 | ret = proc.wait() |
367 | if ret != 0: |
368 | - info("Trying to run get-orig-source rule failed") |
369 | + note("Trying to run get-orig-source rule failed") |
370 | return False |
371 | fetched_tarball = os.path.join(source_dir, desired_tarball_name) |
372 | if not os.path.exists(fetched_tarball): |
373 | - info("get-orig-source did not create %s", desired_tarball_name) |
374 | + note("get-orig-source did not create %s", desired_tarball_name) |
375 | return False |
376 | repack_tarball(fetched_tarball, desired_tarball_name, |
377 | target_dir=target_dir) |
378 | @@ -213,7 +213,7 @@ |
379 | return |
380 | finally: |
381 | shutil.rmtree(tmpdir) |
382 | - info("No debian/rules file to try and use for a get-orig-source rule") |
383 | + note("No debian/rules file to try and use for a get-orig-source rule") |
384 | raise PackageVersionNotPresent(package, version, self) |
385 | |
386 | |
387 | @@ -225,14 +225,14 @@ |
388 | self.larstiq = larstiq |
389 | |
390 | def _uscan(self, package, upstream_version, watch_file, target_dir): |
391 | - info("Using uscan to look for the upstream tarball.") |
392 | + note("Using uscan to look for the upstream tarball.") |
393 | r = os.system("uscan --upstream-version %s --force-download --rename " |
394 | "--package %s --watchfile %s --check-dirname-level 0 " |
395 | "--download --repack --destdir %s --download-version %s" % |
396 | (upstream_version, package, watch_file, target_dir, |
397 | upstream_version)) |
398 | if r != 0: |
399 | - info("uscan could not find the needed tarball.") |
400 | + note("uscan could not find the needed tarball.") |
401 | return False |
402 | return True |
403 | |
404 | @@ -243,7 +243,7 @@ |
405 | watchfile = 'debian/watch' |
406 | watch_id = self.tree.path2id(watchfile) |
407 | if watch_id is None: |
408 | - info("No watch file to use to retrieve upstream tarball.") |
409 | + note("No watch file to use to retrieve upstream tarball.") |
410 | return None |
411 | (tmp, tempfilename) = tempfile.mkstemp() |
412 | try: |
413 | @@ -287,7 +287,7 @@ |
414 | shutil.rmtree(tmpdir) |
415 | |
416 | def get_specific_version(self, package, version, target_dir): |
417 | - info("Using the current branch without the 'debian' directory " |
418 | + note("Using the current branch without the 'debian' directory " |
419 | "to create the tarball") |
420 | self._split(package, version, |
421 | self._tarball_path(package, version, target_dir)) |
422 | @@ -387,9 +387,9 @@ |
423 | :param target_dir: The directory to place the tarball in. |
424 | :return: The path to the tarball. |
425 | """ |
426 | - info("Looking for a way to retrieve the upstream tarball") |
427 | + note("Looking for a way to retrieve the upstream tarball") |
428 | if self.already_exists_in_target(target_dir): |
429 | - info("Upstream tarball already exists in build directory, " |
430 | + note("Upstream tarball already exists in build directory, " |
431 | "using that") |
432 | return os.path.join(target_dir, self._tarball_name()) |
433 | if not self.already_exists_in_store(): |
434 | @@ -401,7 +401,7 @@ |
435 | except PackageVersionNotPresent: |
436 | raise MissingUpstreamTarball(self._tarball_name()) |
437 | else: |
438 | - info("Using the upstream tarball that is present in " |
439 | + note("Using the upstream tarball that is present in " |
440 | "%s" % self.store_dir) |
441 | assert self.provide_from_store_dir(target_dir) |
442 | return os.path.join(target_dir, self._tarball_name()) |
Fix up tests for bzr 2.1