Merge ~racb/git-ubuntu:source-builder-changelog-versions into git-ubuntu:master

Proposed by Robie Basak
Status: Merged
Merged at revision: 807840c436efc6719ac3aa5221c8bc3fdf612c10
Proposed branch: ~racb/git-ubuntu:source-builder-changelog-versions
Merge into: git-ubuntu:master
Diff against target: 55 lines (+18/-1)
2 files modified
gitubuntu/source_builder.py (+11/-1)
gitubuntu/source_builder_test.py (+7/-0)
Reviewer Review Type Date Requested Status
Nish Aravamudan Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+338415@code.launchpad.net

Commit message

Make Jenkins happy

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:807840c436efc6719ac3aa5221c8bc3fdf612c10
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/290/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    SUCCESS: Integration Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/290/rebuild

review: Approve (continuous-integration)
Revision history for this message
Nish Aravamudan (nacc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/gitubuntu/source_builder.py b/gitubuntu/source_builder.py
index 2cc0bd2..fad1fdb 100644
--- a/gitubuntu/source_builder.py
+++ b/gitubuntu/source_builder.py
@@ -65,6 +65,7 @@ class SourceSpec:
65 version = '1'65 version = '1'
66 native = True66 native = True
67 has_patches = False67 has_patches = False
68 changelog_versions = None
6869
69 def __init__(self, **kwargs):70 def __init__(self, **kwargs):
70 """Instantiate a new SourceSpec class instance71 """Instantiate a new SourceSpec class instance
@@ -72,6 +73,10 @@ class SourceSpec:
72 :param str version: the Debian package version string73 :param str version: the Debian package version string
73 :param bool native: True for a native package, False for non-native74 :param bool native: True for a native package, False for non-native
74 :param bool has_patches: if this package should have quilt patches75 :param bool has_patches: if this package should have quilt patches
76 :param list(str) changelog_versions: if specified, version is ignored,
77 and the changelog is generated with this list of versions instead.
78 changelog_versions[0] is taken to be the version string of the
79 package itself.
7580
76 Keyword arguments to the constructor map directly to class instances81 Keyword arguments to the constructor map directly to class instances
77 properties. Properties may be manipulated after construction.82 properties. Properties may be manipulated after construction.
@@ -120,7 +125,12 @@ class SourceFiles:
120125
121 :rtype: str126 :rtype: str
122 """127 """
123 return CHANGELOG_TEMPLATE.format(version=self.spec.version)128 versions = self.spec.changelog_versions or [self.spec.version]
129
130 return "\n".join(
131 CHANGELOG_TEMPLATE.format(version=version)
132 for version in versions
133 )
124134
125 @property135 @property
126 def source_format(self):136 def source_format(self):
diff --git a/gitubuntu/source_builder_test.py b/gitubuntu/source_builder_test.py
index b5eb896..cfe1e33 100644
--- a/gitubuntu/source_builder_test.py
+++ b/gitubuntu/source_builder_test.py
@@ -32,6 +32,13 @@ def test_source_create_with_version(repo):
32 assert changelog.version == '3'32 assert changelog.version == '3'
3333
3434
35def test_source_create_with_versions(repo):
36 with target.Source(target.SourceSpec(changelog_versions=[3, 4])) as f:
37 tree_hash = importer.dsc_to_tree_hash(repo.raw_repo, f)
38 changelog = repo.get_changelog_from_treeish(tree_hash)
39 assert changelog.all_versions == ['3', '4']
40
41
35@pytest.mark.parametrize('native,expected', [42@pytest.mark.parametrize('native,expected', [
36 (True, b"3.0 (native)\n"),43 (True, b"3.0 (native)\n"),
37 (False, b"3.0 (quilt)\n"),44 (False, b"3.0 (quilt)\n"),

Subscribers

People subscribed via source and target branches