Merge lp:~robru/cupstream2distro/fix-dual-diffing into lp:cupstream2distro

Proposed by Robert Bruce Park
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 1109
Merged at revision: 1109
Proposed branch: lp:~robru/cupstream2distro/fix-dual-diffing
Merge into: lp:cupstream2distro
Diff against target: 93 lines (+21/-11)
2 files modified
citrain/recipes/base.py (+4/-2)
tests/unit/test_recipe_base.py (+17/-9)
To merge this branch: bzr merge lp:~robru/cupstream2distro/fix-dual-diffing
Reviewer Review Type Date Requested Status
Robert Bruce Park (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+272036@code.launchpad.net

Commit message

When generating diffs, diff against the correct DSCs.

Description of the change

Some old diffing code would just glob over *dsc, that code worked great in the days before dual silos, but with dual silos what happens is that it diffs wily vs wily, then it diffs vivid vs wily, and the vivid diff overwrites the wily diff. Even this wasn't so bad until recently, because normally the only difference between wily and vivid was just the first line of the debian/changelog. But now some people are experimenting with source packages that do all kinds of voodoo differently depending on what release they're building for, so now diffing the vivid build against the package in wily is producing all kinds of noise.

This branch drops a glob to ensure that only the correct package is diffed against the version in the correct ubuntu release.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1109
http://jenkins.qa.ubuntu.com/job/cu2d-choo-choo-ci/800/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/cu2d-choo-choo-ci/800/rebuild

review: Approve (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

Looks great in staging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'citrain/recipes/base.py'
2--- citrain/recipes/base.py 2015-09-22 18:51:46 +0000
3+++ citrain/recipes/base.py 2015-09-22 21:33:32 +0000
4@@ -315,9 +315,11 @@
5 archive = self.dest if dest_version else self.main_archive
6 self.get_from_archive(path, archive=archive, status='Published')
7 dsc = '{}_*.dsc'.format(self.name)
8+ our_version = self.get_package_version().split(':')[-1] # No epoch
9+ new_dsc = dsc.replace('*', our_version)
10+ log_value_of.new_dsc('Diffing')
11 for old in glob(SILO_DIR('ubuntu', self.name, dsc)) or [None]:
12- for new in glob(SILO_DIR(dsc)):
13- self.generate_package_diffs(old, new)
14+ self.generate_package_diffs(old, SILO_DIR(new_dsc))
15
16 @staticmethod
17 def post_checkstatus_phase(silo_state):
18
19=== modified file 'tests/unit/test_recipe_base.py'
20--- tests/unit/test_recipe_base.py 2015-09-22 18:51:46 +0000
21+++ tests/unit/test_recipe_base.py 2015-09-22 21:33:32 +0000
22@@ -379,11 +379,13 @@
23
24 @patch('citrain.recipes.base.glob')
25 @patch('citrain.recipes.base.newest')
26+ @patch('citrain.recipes.base.BuildBase.get_from_archive', Mock())
27+ @patch('citrain.recipes.base.BuildBase.get_package_version', Mock())
28 def test_buildbase_diff_phase(self, new_mock, glob_mock):
29 """Generate a diff between our build & what's at dest."""
30- glob_results = [['new_dsc'], ['old_dsc']]
31- glob_mock.side_effect = lambda *i: glob_results.pop()
32+ glob_mock.return_value = ['old_dsc']
33 build = BuildBase('bar', self.series, self.dest, self.ppa)
34+ build.get_package_version.return_value = '5:1.0-0ubuntu1'
35 build.path = self.tempdir
36 build.get_from_archive = Mock()
37 build.generate_package_diffs = Mock()
38@@ -394,16 +396,18 @@
39 archive=build.dest,
40 status='Published')
41 build.generate_package_diffs.assert_called_once_with(
42- 'old_dsc', 'new_dsc')
43+ 'old_dsc', self.tempdir + '/bar_1.0-0ubuntu1.dsc')
44 new_mock.assert_called_once_with(build.dest, source_name='bar')
45
46 @patch('citrain.recipes.base.glob')
47 @patch('citrain.recipes.base.newest')
48+ @patch('citrain.recipes.base.BuildBase.get_from_archive', Mock())
49+ @patch('citrain.recipes.base.BuildBase.get_package_version', Mock())
50 def test_buildbase_diff_phase_new_source(self, new_mock, glob_mock):
51 """Indicate that this package was never released at dest."""
52- glob_results = [['new_dsc'], []]
53- glob_mock.side_effect = lambda *i: glob_results.pop()
54+ glob_mock.return_value = []
55 build = BuildBase('bar', self.series, self.dest, self.ppa)
56+ build.get_package_version.return_value = '5:1.0-0ubuntu1'
57 build.path = self.tempdir
58 build.get_from_archive = Mock()
59 build.generate_package_diffs = Mock()
60@@ -413,17 +417,20 @@
61 join(self.tempdir, 'ubuntu', 'bar'),
62 archive=build.dest,
63 status='Published')
64- build.generate_package_diffs.assert_called_once_with(None, 'new_dsc')
65+ build.generate_package_diffs.assert_called_once_with(
66+ None, self.tempdir + '/bar_1.0-0ubuntu1.dsc')
67 new_mock.assert_called_once_with(build.dest, source_name='bar')
68
69 @patch('citrain.recipes.base.glob')
70 @patch('citrain.recipes.base.newest')
71+ @patch('citrain.recipes.base.BuildBase.get_from_archive', Mock())
72+ @patch('citrain.recipes.base.BuildBase.get_package_version', Mock())
73 def test_buildbase_diff_phase_dest_ppa(self, new_mock, glob_mock):
74 """Generate diff from main archive when dest PPA missing source."""
75- glob_results = [['new_dsc'], []]
76- glob_mock.side_effect = lambda *i: glob_results.pop()
77+ glob_mock.return_value = []
78 new_mock.return_value = None
79 build = BuildBase('bar', self.series, self.dest, self.ppa)
80+ build.get_package_version.return_value = '6:2.0-0ubuntu1'
81 build.path = self.tempdir
82 build.get_from_archive = Mock()
83 build.generate_package_diffs = Mock()
84@@ -433,7 +440,8 @@
85 join(self.tempdir, 'ubuntu', 'bar'),
86 archive=build.main_archive,
87 status='Published')
88- build.generate_package_diffs.assert_called_once_with(None, 'new_dsc')
89+ build.generate_package_diffs.assert_called_once_with(
90+ None, self.tempdir + '/bar_2.0-0ubuntu1.dsc')
91
92 def test_buildbase_post_checkstatus_phase(self):
93 """Silently allow publication when no problems found."""

Subscribers

People subscribed via source and target branches