Merge lp:~jelmer/bzr-builddeb/get-orig-source-options into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 651
Merged at revision: 652
Proposed branch: lp:~jelmer/bzr-builddeb/get-orig-source-options
Merge into: lp:bzr-builddeb
Diff against target: 97 lines (+38/-12)
2 files modified
cmds.py (+13/-3)
tests/blackbox/test_get_tar.py (+25/-9)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/get-orig-source-options
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+83975@code.launchpad.net

Description of the change

Support -d argument to get-orig-source, and add an optional version argument.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmds.py'
--- cmds.py 2011-11-26 15:01:25 +0000
+++ cmds.py 2011-11-30 16:45:28 +0000
@@ -466,8 +466,15 @@
466class cmd_get_orig_source(Command):466class cmd_get_orig_source(Command):
467 """Gets the upstream tar file for the packaging branch."""467 """Gets the upstream tar file for the packaging branch."""
468468
469 def run(self):469 directory_opt = Option('directory',
470 tree = WorkingTree.open_containing('.')[0]470 help='Directory from which to retrieve the packaging data',
471 short_name='d', type=unicode)
472
473 takes_options = [directory_opt]
474 takes_args = ["version?"]
475
476 def run(self, directory='.', version=None):
477 tree = WorkingTree.open_containing(directory)[0]
471 config = debuild_config(tree, tree)478 config = debuild_config(tree, tree)
472479
473 (changelog, larstiq) = find_changelog(tree, True)480 (changelog, larstiq) = find_changelog(tree, True)
@@ -475,8 +482,11 @@
475 if orig_dir is None:482 if orig_dir is None:
476 orig_dir = default_orig_dir483 orig_dir = default_orig_dir
477484
485 if version is None:
486 version = changelog.version.upstream_version
487
478 upstream_provider = UpstreamProvider(changelog.package,488 upstream_provider = UpstreamProvider(changelog.package,
479 changelog.version.upstream_version, orig_dir,489 str(version), orig_dir,
480 [PristineTarSource(tree, tree.branch),490 [PristineTarSource(tree, tree.branch),
481 AptSource(),491 AptSource(),
482 GetOrigSourceSource(tree, larstiq),492 GetOrigSourceSource(tree, larstiq),
483493
=== modified file 'tests/blackbox/test_get_tar.py'
--- tests/blackbox/test_get_tar.py 2011-10-03 10:49:13 +0000
+++ tests/blackbox/test_get_tar.py 2011-11-30 16:45:28 +0000
@@ -19,7 +19,6 @@
19#19#
2020
21import os21import os
22import tarfile
2322
24try:23try:
25 from debian.changelog import (Changelog,24 from debian.changelog import (Changelog,
@@ -67,21 +66,19 @@
67 tree.add(source_files)66 tree.add(source_files)
68 return tree67 return tree
6968
70 def make_source_with_upstream(self):69 def make_source_with_upstream(self, path="."):
71 """Create a source tree in a branch with an upstream tag."""70 """Create a source tree in a branch with an upstream tag."""
72 tree = self.make_branch_and_tree('.')71 tree = self.make_branch_and_tree(path)
73 source_files = ['README']72 source_files = ['README']
74 self.build_tree(source_files)73 self.build_tree([os.path.join(path, f) for f in source_files])
75 tree.add(source_files)74 tree.add(source_files)
76 tree.commit("one", rev_id='revid1')75 tree.commit("one", rev_id='revid1')
77 tree.branch.tags.set_tag("upstream-0.1", tree.branch.last_revision())76 tree.branch.tags.set_tag("upstream-0.1", tree.branch.last_revision())
7877
79 cl_file = 'debian/changelog'78 os.mkdir(os.path.join(path, 'debian'))
80 source_files = ['debian/'] + [cl_file]
81 self.build_tree(source_files)
82 c = self.make_changelog()79 c = self.make_changelog()
83 self.write_changelog(c, cl_file)80 self.write_changelog(c, os.path.join(path, 'debian/changelog'))
84 tree.add(source_files)81 tree.add(['debian', 'debian/changelog'])
85 tree.commit("two", rev_id='revid2')82 tree.commit("two", rev_id='revid2')
86 return tree83 return tree
8784
@@ -104,3 +101,22 @@
104 tree = self.make_source_with_upstream()101 tree = self.make_source_with_upstream()
105 self.run_bzr(['get-orig-source'])102 self.run_bzr(['get-orig-source'])
106 self.assertPathExists('../test_0.1.orig.tar.gz')103 self.assertPathExists('../test_0.1.orig.tar.gz')
104
105 def test_get_orig_source_directory(self):
106 tree = self.make_source_with_upstream("somedir")
107 self.run_bzr(['get-orig-source', '-d', 'somedir'])
108 self.assertPathExists('../test_0.1.orig.tar.gz')
109
110 def test_get_orig_source_explicit_version(self):
111 tree = self.make_source_with_upstream()
112 c = self.make_changelog("0.3-1")
113 self.write_changelog(c, 'debian/changelog')
114 tree.commit("package 0.3")
115 self.run_bzr(['get-orig-source', '0.1'])
116 self.assertPathExists('../test_0.1.orig.tar.gz')
117
118 def test_get_orig_source_explicit_version_not_found(self):
119 tree = self.make_source_with_upstream()
120 self.run_bzr_error([
121 'bzr: ERROR: Unable to find the needed upstream tarball for package test, version 0.3.'],
122 'get-orig-source 0.3')

Subscribers

People subscribed via source and target branches