Merge lp:~jelmer/bzr-builddeb/first-release into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 596
Merged at revision: 592
Proposed branch: lp:~jelmer/bzr-builddeb/first-release
Merge into: lp:bzr-builddeb
Diff against target: 171 lines (+61/-15)
7 files modified
cmds.py (+5/-4)
debian/changelog (+7/-0)
merge_upstream.py (+6/-2)
tests/blackbox/test_merge_upstream.py (+8/-0)
tests/test_merge_upstream.py (+23/-3)
tests/test_util.py (+7/-0)
util.py (+5/-6)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/first-release
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+68591@code.launchpad.net

Description of the change

When merging an upstream tarball into an empty branch, default to normal mode.
(#776528)

When creating a changelog file, version it.

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-07-19 16:02:34 +0000
+++ cmds.py 2011-07-20 19:31:15 +0000
@@ -650,13 +650,14 @@
650 changelog, larstiq) = self._get_changelog_info(tree, last_version,650 changelog, larstiq) = self._get_changelog_info(tree, last_version,
651 package, distribution)651 package, distribution)
652 contains_upstream_source = tree_contains_upstream_source(tree)652 contains_upstream_source = tree_contains_upstream_source(tree)
653 build_type = config.build_type653 if changelog is None:
654 if build_type is None:
655 changelog_version = None654 changelog_version = None
656 else:655 else:
657 changelog_version = changelog.version656 changelog_version = changelog.version
658 build_type = guess_build_type(tree, changelog_version,657 build_type = config.build_type
659 contains_upstream_source)658 if build_type is None:
659 build_type = guess_build_type(tree, changelog_version,
660 contains_upstream_source)
660 need_upstream_tarball = (build_type != BUILD_TYPE_MERGE)661 need_upstream_tarball = (build_type != BUILD_TYPE_MERGE)
661 if build_type == BUILD_TYPE_NATIVE:662 if build_type == BUILD_TYPE_NATIVE:
662 raise BzrCommandError("Merge upstream in native mode is not "663 raise BzrCommandError("Merge upstream in native mode is not "
663664
=== modified file 'debian/changelog'
--- debian/changelog 2011-07-19 19:24:09 +0000
+++ debian/changelog 2011-07-20 19:31:15 +0000
@@ -1,3 +1,10 @@
1bzr-builddeb (2.7.7) UNRELEASED; urgency=low
2
3 * Build type now defaults to normal mode when used in an empty tree.
4 LP: #776528
5
6 -- Jelmer Vernooij <jelmer@debian.org> Wed, 20 Jul 2011 21:27:48 +0200
7
1bzr-builddeb (2.7.6) unstable; urgency=low8bzr-builddeb (2.7.6) unstable; urgency=low
29
3 * Bump standards version to 3.9.2 (no changes).10 * Bump standards version to 3.9.2 (no changes).
411
=== modified file 'merge_upstream.py'
--- merge_upstream.py 2011-05-15 17:21:54 +0000
+++ merge_upstream.py 2011-07-20 19:31:15 +0000
@@ -101,9 +101,13 @@
101 str(package_version(upstream_version, distribution_name, epoch)),101 str(package_version(upstream_version, distribution_name, epoch)),
102 "-D", "UNRELEASED", "--release-heuristic", "changelog",102 "-D", "UNRELEASED", "--release-heuristic", "changelog",
103 "--package", package, entry_description]103 "--package", package, entry_description]
104 if not tree.has_filename("debian/changelog"):104 create = (not tree.has_filename("debian/changelog"))
105 if create:
105 argv.append("--create")106 argv.append("--create")
106 proc = subprocess.Popen(argv, cwd=tree.basedir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)107 proc = subprocess.Popen(argv, cwd=tree.basedir, stdout=subprocess.PIPE,
108 stderr=subprocess.PIPE)
107 (stdout, stderr) = proc.communicate()109 (stdout, stderr) = proc.communicate()
108 if proc.returncode != 0:110 if proc.returncode != 0:
109 raise DchError("Adding changelog entry failed: %s" % stderr)111 raise DchError("Adding changelog entry failed: %s" % stderr)
112 if create:
113 tree.add(["debian/changelog"])
110114
=== modified file 'tests/blackbox/test_merge_upstream.py'
--- tests/blackbox/test_merge_upstream.py 2011-06-23 10:29:54 +0000
+++ tests/blackbox/test_merge_upstream.py 2011-07-20 19:31:15 +0000
@@ -212,4 +212,12 @@
212 "--package", "bar", os.path.abspath(rel1.tarball)],212 "--package", "bar", os.path.abspath(rel1.tarball)],
213 working_dir=tree.basedir)213 working_dir=tree.basedir)
214214
215 def test_new_package_from_empty_branch(self):
216 upstream = self.make_upstream()
217 tree = self.make_branch_and_tree("package")
218 rel1 = self.release_upstream(upstream)
219 self.run_bzr(['merge-upstream', '--version', str(rel1.version),
220 "--package", "bar", os.path.abspath(rel1.tarball)],
221 working_dir=tree.basedir)
222
215# vim: ts=4 sts=4 sw=4223# vim: ts=4 sts=4 sw=4
216224
=== modified file 'tests/test_merge_upstream.py'
--- tests/test_merge_upstream.py 2011-06-04 08:52:53 +0000
+++ tests/test_merge_upstream.py 2011-07-20 19:31:15 +0000
@@ -19,14 +19,18 @@
19#19#
2020
21try:21try:
22 from debian.changelog import Version22 from debian.changelog import Changelog, Version
23except ImportError:23except ImportError:
24 # Prior to 0.1.15 the debian module was called debian_bundle24 # Prior to 0.1.15 the debian module was called debian_bundle
25 from debian_bundle.changelog import Version25 from debian_bundle.changelog import Changelog, Version
2626
27from bzrlib.tests import TestCase27from bzrlib.tests import (
28 TestCase,
29 TestCaseWithTransport,
30 )
2831
29from bzrlib.plugins.builddeb.merge_upstream import (32from bzrlib.plugins.builddeb.merge_upstream import (
33 changelog_add_new_version,
30 upstream_merge_changelog_line,34 upstream_merge_changelog_line,
31 package_version,35 package_version,
32 )36 )
@@ -71,3 +75,19 @@
71 def test_plus(self):75 def test_plus(self):
72 self.assertEquals("New upstream release.",76 self.assertEquals("New upstream release.",
73 upstream_merge_changelog_line("1.0+dfsg1"))77 upstream_merge_changelog_line("1.0+dfsg1"))
78
79
80class ChangelogAddNewVersionTests(TestCaseWithTransport):
81
82 def test_add_new(self):
83 tree = self.make_branch_and_tree(".")
84 tree.lock_write()
85 self.addCleanup(tree.unlock)
86 tree.mkdir("debian")
87 changelog_add_new_version(tree, "1.0", "sid", None, "somepkg")
88 # changelog_add_new_version will version the changelog if it was created
89 cl = Changelog(open('debian/changelog'))
90 self.assertEquals(cl._blocks[0].package, "somepkg")
91 self.assertEquals(cl._blocks[0].distributions, "UNRELEASED")
92 self.assertEquals(cl._blocks[0].version, "1.0-1")
93 self.assertEquals([], list(tree.filter_unversioned_files(["debian/changelog"])))
7494
=== modified file 'tests/test_util.py'
--- tests/test_util.py 2011-07-15 14:16:52 +0000
+++ tests/test_util.py 2011-07-20 19:31:15 +0000
@@ -829,9 +829,16 @@
829 self.assertEquals(BUILD_TYPE_NATIVE,829 self.assertEquals(BUILD_TYPE_NATIVE,
830 guess_build_type(tree, Version("1.0"), True))830 guess_build_type(tree, Version("1.0"), True))
831831
832 def test_empty(self):
833 # Empty tree and a non-native package -> NORMAL
834 tree = self.make_branch_and_tree('.')
835 self.assertEquals(BUILD_TYPE_NORMAL,
836 guess_build_type(tree, Version("1.0-1"), None))
837
832 def test_no_upstream_source(self):838 def test_no_upstream_source(self):
833 # No upstream source code and a non-native package -> MERGE839 # No upstream source code and a non-native package -> MERGE
834 tree = self.make_branch_and_tree('.')840 tree = self.make_branch_and_tree('.')
841 tree.mkdir("debian")
835 self.assertEquals(BUILD_TYPE_MERGE,842 self.assertEquals(BUILD_TYPE_MERGE,
836 guess_build_type(tree, Version("1.0-1"), False))843 guess_build_type(tree, Version("1.0-1"), False))
837844
838845
=== modified file 'util.py'
--- util.py 2011-07-16 21:53:16 +0000
+++ util.py 2011-07-20 19:31:15 +0000
@@ -623,12 +623,11 @@
623623
624 :param tree: A RevisionTree.624 :param tree: A RevisionTree.
625 :return: Boolean indicating whether or not the tree contains the upstream625 :return: Boolean indicating whether or not the tree contains the upstream
626 source626 source. None if the tree is empty
627 """627 """
628 root = tree.inventory.root628 present_files = set([f[0] for f in tree.list_files(recursive=False)])
629 if root is None:629 if len(present_files) == 0:
630 return False # Empty tree630 return None
631 present_files = set(root.children.keys())
632 packaging_files = frozenset(["debian", ".bzr-builddeb", ".bzrignore"])631 packaging_files = frozenset(["debian", ".bzr-builddeb", ".bzrignore"])
633 return (len(present_files - packaging_files) > 0)632 return (len(present_files - packaging_files) > 0)
634633
@@ -682,7 +681,7 @@
682681
683 if version_native or format_native:682 if version_native or format_native:
684 return BUILD_TYPE_NATIVE683 return BUILD_TYPE_NATIVE
685 if not contains_upstream_source:684 if contains_upstream_source == False:
686 # Default to merge mode if there's only a debian/ directory685 # Default to merge mode if there's only a debian/ directory
687 return BUILD_TYPE_MERGE686 return BUILD_TYPE_MERGE
688 else:687 else:

Subscribers

People subscribed via source and target branches