Merge lp:~dholbach/click-reviewers-tools/1395204 into lp:click-reviewers-tools

Proposed by Daniel Holbach
Status: Merged
Merged at revision: 356
Proposed branch: lp:~dholbach/click-reviewers-tools/1395204
Merge into: lp:click-reviewers-tools
Diff against target: 67 lines (+32/-5)
2 files modified
clickreviews/cr_lint.py (+18/-5)
clickreviews/tests/test_cr_lint.py (+14/-0)
To merge this branch: bzr merge lp:~dholbach/click-reviewers-tools/1395204
Reviewer Review Type Date Requested Status
Martin Albisetti (community) Approve
Review via email: mp+247042@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Albisetti (beuno) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clickreviews/cr_lint.py'
2--- clickreviews/cr_lint.py 2015-01-13 18:08:32 +0000
3+++ clickreviews/cr_lint.py 2015-01-20 16:50:25 +0000
4@@ -45,12 +45,13 @@
5 # arm64 - compiled, single arch (not available yet)
6 # ppc64el - compiled, single arch (not available yet)
7 # powerpc - compiled, single arch (not available yet)
8+ self.valid_compiled_architectures = ['armhf',
9+ 'i386',
10+ 'amd64',
11+ ]
12 self.valid_control_architectures = ['all',
13 'multi',
14- 'armhf',
15- 'i386',
16- 'amd64',
17- ]
18+ ] + self.valid_compiled_architectures
19 self.vcs_dirs = ['.bzr*', '.git*', '.svn*', '.hg', 'CVS*', 'RCS*']
20
21 if 'maintainer' in self.manifest:
22@@ -200,7 +201,19 @@
23 n = 'control_architecture_match'
24 s = 'OK'
25 if 'architecture' in self.manifest:
26- if control['Architecture'] != self.manifest['architecture']:
27+ if control['Architecture'] == "multi":
28+ if not isinstance(self.manifest['architecture'],
29+ (list, tuple)):
30+ t = 'error'
31+ s = 'If arch=multi, manifest architecture needs to ' + \
32+ 'list all the individual architectures.'
33+ elif list(filter(lambda a:
34+ a not in self.valid_compiled_architectures,
35+ self.manifest['architecture'])):
36+ t = 'error'
37+ s = 'If arch=multi, manifest architecture needs to ' + \
38+ 'comprise of only compiled architectures.'
39+ elif control['Architecture'] != self.manifest['architecture']:
40 t = 'error'
41 s = "Architecture=%s " % control['Architecture'] + \
42 "does not match manifest architecture=%s" % \
43
44=== modified file 'clickreviews/tests/test_cr_lint.py'
45--- clickreviews/tests/test_cr_lint.py 2015-01-13 18:08:32 +0000
46+++ clickreviews/tests/test_cr_lint.py 2015-01-20 16:50:25 +0000
47@@ -367,6 +367,20 @@
48 expected_counts = {'info': 1, 'warn': 0, 'error': 0}
49 self.check_results(r, expected_counts)
50
51+ def test_check_manifest_valid_arch_multi2(self):
52+ '''Test check_manifest_architecture() (valid multi2)'''
53+ arch = "multi"
54+ self.set_test_manifest("architecture", ["armhf", "i386"])
55+ self.set_test_control("Architecture", arch)
56+ test_name = "%s_%s_%s.click" % (self.test_control['Package'],
57+ self.test_control['Version'],
58+ arch)
59+ c = ClickReviewLint(test_name)
60+ c.check_manifest_architecture()
61+ r = c.click_report
62+ expected_counts = {'info': 1, 'warn': 0, 'error': 0}
63+ self.check_results(r, expected_counts)
64+
65 def test_check_manifest_invalid_arch_multi_nonexistent(self):
66 '''Test check_manifest_architecture() (invalid multi)'''
67 arch = "multi"

Subscribers

People subscribed via source and target branches