Merge lp:~fginther/cupstream2distro-config/use-stack-ppa-option into lp:cupstream2distro-config

Proposed by Francis Ginther
Status: Merged
Approved by: Chris Gagnon
Approved revision: 565
Merged at revision: 573
Proposed branch: lp:~fginther/cupstream2distro-config/use-stack-ppa-option
Merge into: lp:cupstream2distro-config
Diff against target: 139 lines (+54/-8)
4 files modified
c2dconfigutils/cu2dUpdateCi.py (+7/-5)
ci/config/defaults.conf (+1/-0)
stacks/head/unity8.cfg (+1/-0)
tests/test_cu2dUpdateCi.py (+45/-3)
To merge this branch: bzr merge lp:~fginther/cupstream2distro-config/use-stack-ppa-option
Reviewer Review Type Date Requested Status
Chris Gagnon (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+177283@code.launchpad.net

Commit message

Add 'use_stack_ppa' option (default True) to indicate that the stack's ppa value should be automatically added to the hook list.

Description of the change

Add 'use_stack_ppa' option (default True) to indicate that the stack's ppa value should be automatically added to the hook list.

Tested by dumping results to file with and without the change. Projects that continue to use the default were unchanged. Projects (like unity8) had the appropriate change made to the hooks.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
564. By Francis Ginther

Fix and add tests for use_stack_ppa.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

 'use_stack_ppa': False needs to be in a test.

review: Needs Fixing
565. By Francis Ginther

Add a test case for use_stack_ppa == False.

Revision history for this message
Francis Ginther (fginther) wrote :

> 'use_stack_ppa': False needs to be in a test.

Good catch, tests are update.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

thanks lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'c2dconfigutils/cu2dUpdateCi.py'
2--- c2dconfigutils/cu2dUpdateCi.py 2013-06-11 21:23:10 +0000
3+++ c2dconfigutils/cu2dUpdateCi.py 2013-07-30 17:07:24 +0000
4@@ -85,6 +85,7 @@
5 'rebuild',
6 'team',
7 'use_description_for_commit',
8+ 'use_stack_ppa',
9 ]
10
11 DEFAULT_HOOK_LOCATION = '/tmp/$JOB_NAME-hooks'
12@@ -191,11 +192,12 @@
13 if job_data.get('stack_ppa', False):
14 stack_ppa_hook = self.GENERATED_HOOK_TEMPLATE.format(
15 job_data['stack_ppa'].replace('/', '~'))
16- if project_config.get('hooks', False):
17- project_config['hooks'] = ' '.join([stack_ppa_hook,
18- project_config['hooks']])
19- else:
20- project_config['hooks'] = stack_ppa_hook
21+ if project_config.get('use_stack_ppa', False):
22+ if project_config.get('hooks', False):
23+ project_config['hooks'] = ' '.join(
24+ [stack_ppa_hook, project_config['hooks']])
25+ else:
26+ project_config['hooks'] = stack_ppa_hook
27
28 # Rename hooks parameter for builder jobs
29 if builder_job and 'hooks' in project_config:
30
31=== modified file 'ci/config/defaults.conf'
32--- ci/config/defaults.conf 2013-05-03 05:44:25 +0000
33+++ ci/config/defaults.conf 2013-07-30 17:07:24 +0000
34@@ -4,6 +4,7 @@
35 autolanding_template: autolanding-config.xml.tmpl
36 build_template: pbuilder-config.xml.tmpl
37 hooks: ''
38+ use_stack_ppa: True
39 packaging_branch: ''
40 use_description_for_commit: False
41 ci:
42
43=== modified file 'stacks/head/unity8.cfg'
44--- stacks/head/unity8.cfg 2013-07-24 10:17:45 +0000
45+++ stacks/head/unity8.cfg 2013-07-30 17:07:24 +0000
46@@ -38,6 +38,7 @@
47 projects:
48 unity8:
49 hooks: H05set_package_version D00mbs_archive A10checklicenseheaders
50+ use_stack_ppa: False
51 test_suite: unity8
52 aggregate_tests: generic-mediumtests-saucy unity-phablet-qmluitests-saucy
53 archive_artifacts: '**/*test*.xml, **/coverage*.xml'
54
55=== modified file 'tests/test_cu2dUpdateCi.py'
56--- tests/test_cu2dUpdateCi.py 2013-06-11 21:23:10 +0000
57+++ tests/test_cu2dUpdateCi.py 2013-07-30 17:07:24 +0000
58@@ -191,11 +191,13 @@
59 self.assertEqual(expected, actual)
60
61 def test_project_config_stack_ppa(self):
62- config = {'hooks': 'my_hook'}
63+ config = {'hooks': 'my_hook',
64+ 'use_stack_ppa': True}
65 job_data = {'stack_ppa': 'ppa_team/ppa_name'}
66 expected = {'target_branch': 'lp:project',
67 'project_name': 'project',
68 'hooks': 'D09add_ppa~ppa_team~ppa_name my_hook',
69+ 'use_stack_ppa': True,
70 'parameter_list': [
71 JobParameter('hooks',
72 'D09add_ppa~ppa_team~ppa_name my_hook'),
73@@ -207,12 +209,50 @@
74 job_data)
75 self.assertEqual(expected, actual)
76
77+ def test_project_config_stack_false_use_stack_ppa(self):
78+ config = {'hooks': 'my_hook',
79+ 'use_stack_ppa': False}
80+ job_data = {'stack_ppa': 'ppa_team/ppa_name'}
81+ expected = {'target_branch': 'lp:project',
82+ 'project_name': 'project',
83+ 'hooks': 'my_hook',
84+ 'use_stack_ppa': False,
85+ 'parameter_list': [
86+ JobParameter('hooks',
87+ 'my_hook'),
88+ JobParameter('target_branch',
89+ 'lp:project'),
90+ JobParameter('project_name',
91+ 'project')]}
92+ actual = self.update_ci.process_project_config('project', config,
93+ job_data)
94+ self.assertEqual(expected, actual)
95+
96+ def test_project_config_stack_no_use_stack_ppa(self):
97+ config = {'hooks': 'my_hook'}
98+ job_data = {'stack_ppa': 'ppa_team/ppa_name'}
99+ expected = {'target_branch': 'lp:project',
100+ 'project_name': 'project',
101+ 'hooks': 'my_hook',
102+ 'parameter_list': [
103+ JobParameter('hooks',
104+ 'my_hook'),
105+ JobParameter('target_branch',
106+ 'lp:project'),
107+ JobParameter('project_name',
108+ 'project')]}
109+ actual = self.update_ci.process_project_config('project', config,
110+ job_data)
111+ self.assertEqual(expected, actual)
112+
113 def test_project_config_stack_ppa_with_no_hooks(self):
114- config = {'hooks': ''}
115+ config = {'hooks': '',
116+ 'use_stack_ppa': True}
117 job_data = {'stack_ppa': 'ppa_team/ppa_name'}
118 expected = {'target_branch': 'lp:project',
119 'project_name': 'project',
120 'hooks': 'D09add_ppa~ppa_team~ppa_name',
121+ 'use_stack_ppa': True,
122 'parameter_list': [
123 JobParameter('hooks',
124 'D09add_ppa~ppa_team~ppa_name'),
125@@ -225,11 +265,13 @@
126 self.assertEqual(expected, actual)
127
128 def test_project_config_stack_ppa_with_false_hooks(self):
129- config = {'hooks': False}
130+ config = {'hooks': False,
131+ 'use_stack_ppa': True}
132 job_data = {'stack_ppa': 'ppa_team/ppa_name'}
133 expected = {'target_branch': 'lp:project',
134 'project_name': 'project',
135 'hooks': 'D09add_ppa~ppa_team~ppa_name',
136+ 'use_stack_ppa': True,
137 'parameter_list': [
138 JobParameter('hooks',
139 'D09add_ppa~ppa_team~ppa_name'),

Subscribers

People subscribed via source and target branches

to all changes: