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
1diff --git a/gitubuntu/source_builder.py b/gitubuntu/source_builder.py
2index 2cc0bd2..fad1fdb 100644
3--- a/gitubuntu/source_builder.py
4+++ b/gitubuntu/source_builder.py
5@@ -65,6 +65,7 @@ class SourceSpec:
6 version = '1'
7 native = True
8 has_patches = False
9+ changelog_versions = None
10
11 def __init__(self, **kwargs):
12 """Instantiate a new SourceSpec class instance
13@@ -72,6 +73,10 @@ class SourceSpec:
14 :param str version: the Debian package version string
15 :param bool native: True for a native package, False for non-native
16 :param bool has_patches: if this package should have quilt patches
17+ :param list(str) changelog_versions: if specified, version is ignored,
18+ and the changelog is generated with this list of versions instead.
19+ changelog_versions[0] is taken to be the version string of the
20+ package itself.
21
22 Keyword arguments to the constructor map directly to class instances
23 properties. Properties may be manipulated after construction.
24@@ -120,7 +125,12 @@ class SourceFiles:
25
26 :rtype: str
27 """
28- return CHANGELOG_TEMPLATE.format(version=self.spec.version)
29+ versions = self.spec.changelog_versions or [self.spec.version]
30+
31+ return "\n".join(
32+ CHANGELOG_TEMPLATE.format(version=version)
33+ for version in versions
34+ )
35
36 @property
37 def source_format(self):
38diff --git a/gitubuntu/source_builder_test.py b/gitubuntu/source_builder_test.py
39index b5eb896..cfe1e33 100644
40--- a/gitubuntu/source_builder_test.py
41+++ b/gitubuntu/source_builder_test.py
42@@ -32,6 +32,13 @@ def test_source_create_with_version(repo):
43 assert changelog.version == '3'
44
45
46+def test_source_create_with_versions(repo):
47+ with target.Source(target.SourceSpec(changelog_versions=[3, 4])) as f:
48+ tree_hash = importer.dsc_to_tree_hash(repo.raw_repo, f)
49+ changelog = repo.get_changelog_from_treeish(tree_hash)
50+ assert changelog.all_versions == ['3', '4']
51+
52+
53 @pytest.mark.parametrize('native,expected', [
54 (True, b"3.0 (native)\n"),
55 (False, b"3.0 (quilt)\n"),

Subscribers

People subscribed via source and target branches