Merge lp:~ricardokirkner/click-reviewers-tools/click-check-overrides into lp:click-reviewers-tools

Proposed by Ricardo Kirkner on 2015-03-18
Status: Merged
Merged at revision: 413
Proposed branch: lp:~ricardokirkner/click-reviewers-tools/click-check-overrides
Merge into: lp:click-reviewers-tools
Diff against target: 868 lines (+98/-219)
28 files modified
bin/click-check-bin-path (+2/-9)
bin/click-check-content-hub (+2/-9)
bin/click-check-desktop (+2/-9)
bin/click-check-framework (+2/-9)
bin/click-check-functional (+2/-9)
bin/click-check-lint (+1/-16)
bin/click-check-online-accounts (+2/-9)
bin/click-check-push-helper (+2/-9)
bin/click-check-scope (+2/-9)
bin/click-check-security (+1/-16)
bin/click-check-skeleton (+2/-9)
bin/click-check-systemd (+1/-8)
bin/click-check-url-dispatcher (+2/-9)
bin/click-run-checks (+11/-48)
clickreviews/cr_bin_path.py (+3/-2)
clickreviews/cr_common.py (+19/-1)
clickreviews/cr_content_hub.py (+4/-3)
clickreviews/cr_desktop.py (+4/-3)
clickreviews/cr_framework.py (+4/-3)
clickreviews/cr_functional.py (+3/-3)
clickreviews/cr_lint.py (+1/-5)
clickreviews/cr_online_accounts.py (+4/-3)
clickreviews/cr_push_helper.py (+4/-3)
clickreviews/cr_scope.py (+4/-3)
clickreviews/cr_security.py (+3/-4)
clickreviews/cr_skeleton.py (+4/-3)
clickreviews/cr_systemd.py (+3/-2)
clickreviews/cr_url_dispatcher.py (+4/-3)
To merge this branch: bzr merge lp:~ricardokirkner/click-reviewers-tools/click-check-overrides
Reviewer Review Type Date Requested Status
Jamie Strandboge 2015-03-18 Approve on 2015-03-18
Review via email: mp+253430@code.launchpad.net

Commit Message

support overrides in all click-check scripts

To post a comment you must log in.
Jamie Strandboge (jdstrand) wrote :

Thanks!

This looks mostly good, but the change to click-run-checks isn't quite right. See comments inline.

review: Needs Fixing
413. By Ricardo Kirkner on 2015-03-18

handle checks from branch as well as installed system-wide when running all checks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/click-check-bin-path'
2--- bin/click-check-bin-path 2014-11-20 15:23:28 +0000
3+++ bin/click-check-bin-path 2015-03-18 20:49:53 +0000
4@@ -1,7 +1,7 @@
5 #!/usr/bin/python3
6 '''click-check-bin-path: perform click bin-path checks'''
7 #
8-# Copyright (C) 2014 Canonical Ltd.
9+# Copyright (C) 2014-2015 Canonical Ltd.
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13@@ -16,16 +16,9 @@
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 from __future__ import print_function
17-import sys
18
19 import clickreviews.cr_common as cr_common
20 import clickreviews.cr_bin_path as cr_bin_path
21
22 if __name__ == "__main__":
23- if len(sys.argv) < 2:
24- cr_common.error("Must give path to click package")
25-
26- review = cr_bin_path.ClickReviewBinPath(sys.argv[1])
27- review.do_checks()
28- rc = review.do_report()
29- sys.exit(rc)
30+ cr_common.run_click_check(cr_bin_path.ClickReviewBinPath)
31
32=== modified file 'bin/click-check-content-hub'
33--- bin/click-check-content-hub 2014-07-14 18:48:37 +0000
34+++ bin/click-check-content-hub 2015-03-18 20:49:53 +0000
35@@ -1,7 +1,7 @@
36 #!/usr/bin/python3
37 '''click-check-content-hub: perform click content-hub checks'''
38 #
39-# Copyright (C) 2014 Canonical Ltd.
40+# Copyright (C) 2014-2015 Canonical Ltd.
41 #
42 # This program is free software: you can redistribute it and/or modify
43 # it under the terms of the GNU General Public License as published by
44@@ -16,16 +16,9 @@
45 # along with this program. If not, see <http://www.gnu.org/licenses/>.
46
47 from __future__ import print_function
48-import sys
49
50 import clickreviews.cr_common as cr_common
51 import clickreviews.cr_content_hub as cr_content_hub
52
53 if __name__ == "__main__":
54- if len(sys.argv) < 2:
55- cr_common.error("Must give path to click package")
56-
57- review = cr_content_hub.ClickReviewContentHub(sys.argv[1])
58- review.do_checks()
59- rc = review.do_report()
60- sys.exit(rc)
61+ cr_common.run_click_check(cr_content_hub.ClickReviewContentHub)
62
63=== modified file 'bin/click-check-desktop'
64--- bin/click-check-desktop 2013-10-01 13:20:41 +0000
65+++ bin/click-check-desktop 2015-03-18 20:49:53 +0000
66@@ -1,7 +1,7 @@
67 #!/usr/bin/python3
68 '''click-check-desktop: perform click desktop checks'''
69 #
70-# Copyright (C) 2013 Canonical Ltd.
71+# Copyright (C) 2013-2015 Canonical Ltd.
72 #
73 # This program is free software: you can redistribute it and/or modify
74 # it under the terms of the GNU General Public License as published by
75@@ -16,16 +16,9 @@
76 # along with this program. If not, see <http://www.gnu.org/licenses/>.
77
78 from __future__ import print_function
79-import sys
80
81 from clickreviews import cr_common
82 from clickreviews import cr_desktop
83
84 if __name__ == "__main__":
85- if len(sys.argv) < 2:
86- cr_common.error("Must give path to click package")
87-
88- review = cr_desktop.ClickReviewDesktop(sys.argv[1])
89- review.do_checks()
90- rc = review.do_report()
91- sys.exit(rc)
92+ cr_common.run_click_check(cr_desktop.ClickReviewDesktop)
93
94=== modified file 'bin/click-check-framework'
95--- bin/click-check-framework 2014-11-20 23:22:15 +0000
96+++ bin/click-check-framework 2015-03-18 20:49:53 +0000
97@@ -1,7 +1,7 @@
98 #!/usr/bin/python3
99 '''click-check-framework: perform click framework checks'''
100 #
101-# Copyright (C) 2014 Canonical Ltd.
102+# Copyright (C) 2014-2015 Canonical Ltd.
103 #
104 # This program is free software: you can redistribute it and/or modify
105 # it under the terms of the GNU General Public License as published by
106@@ -16,16 +16,9 @@
107 # along with this program. If not, see <http://www.gnu.org/licenses/>.
108
109 from __future__ import print_function
110-import sys
111
112 import clickreviews.cr_common as cr_common
113 import clickreviews.cr_framework as cr_framework
114
115 if __name__ == "__main__":
116- if len(sys.argv) < 2:
117- cr_common.error("Must give path to click package")
118-
119- review = cr_framework.ClickReviewFramework(sys.argv[1])
120- review.do_checks()
121- rc = review.do_report()
122- sys.exit(rc)
123+ cr_common.run_click_check(cr_framework.ClickReviewFramework)
124
125=== modified file 'bin/click-check-functional'
126--- bin/click-check-functional 2013-09-27 20:20:25 +0000
127+++ bin/click-check-functional 2015-03-18 20:49:53 +0000
128@@ -1,7 +1,7 @@
129 #!/usr/bin/python3
130 '''click-check-functional: perform functional checks on click packages'''
131 #
132-# Copyright (C) 2013 Canonical Ltd.
133+# Copyright (C) 2013-2015 Canonical Ltd.
134 #
135 # This program is free software: you can redistribute it and/or modify
136 # it under the terms of the GNU General Public License as published by
137@@ -16,16 +16,9 @@
138 # along with this program. If not, see <http://www.gnu.org/licenses/>.
139
140 from __future__ import print_function
141-import sys
142
143 import clickreviews.cr_common as cr_common
144 import clickreviews.cr_functional as cr_functional
145
146 if __name__ == "__main__":
147- if len(sys.argv) < 2:
148- cr_common.error("Must give path to click package")
149-
150- review = cr_functional.ClickReviewFunctional(sys.argv[1])
151- review.do_checks()
152- rc = review.do_report()
153- sys.exit(rc)
154+ cr_common.run_click_check(cr_functional.ClickReviewFunctional)
155
156=== modified file 'bin/click-check-lint'
157--- bin/click-check-lint 2014-11-14 14:32:39 +0000
158+++ bin/click-check-lint 2015-03-18 20:49:53 +0000
159@@ -16,24 +16,9 @@
160 # along with this program. If not, see <http://www.gnu.org/licenses/>.
161
162 from __future__ import print_function
163-import json
164-import sys
165
166 import clickreviews.cr_common as cr_common
167 import clickreviews.cr_lint as cr_lint
168
169 if __name__ == "__main__":
170- if len(sys.argv) < 2:
171- cr_common.error("Must give path to click package")
172-
173- # extract args
174- fn = sys.argv[1]
175- if len(sys.argv) > 2:
176- overrides = json.loads(sys.argv[2])
177- else:
178- overrides = None
179-
180- review = cr_lint.ClickReviewLint(fn, overrides=overrides)
181- review.do_checks()
182- rc = review.do_report()
183- sys.exit(rc)
184+ cr_common.run_click_check(cr_lint.ClickReviewLint)
185
186=== modified file 'bin/click-check-online-accounts'
187--- bin/click-check-online-accounts 2014-07-15 23:25:01 +0000
188+++ bin/click-check-online-accounts 2015-03-18 20:49:53 +0000
189@@ -1,7 +1,7 @@
190 #!/usr/bin/python3
191 '''click-check-online-accounts: perform click online accounts checks'''
192 #
193-# Copyright (C) 2014 Canonical Ltd.
194+# Copyright (C) 2014-2015 Canonical Ltd.
195 #
196 # This program is free software: you can redistribute it and/or modify
197 # it under the terms of the GNU General Public License as published by
198@@ -16,16 +16,9 @@
199 # along with this program. If not, see <http://www.gnu.org/licenses/>.
200
201 from __future__ import print_function
202-import sys
203
204 import clickreviews.cr_common as cr_common
205 import clickreviews.cr_online_accounts as cr_online_accounts
206
207 if __name__ == "__main__":
208- if len(sys.argv) < 2:
209- cr_common.error("Must give path to click package")
210-
211- review = cr_online_accounts.ClickReviewAccounts(sys.argv[1])
212- review.do_checks()
213- rc = review.do_report()
214- sys.exit(rc)
215+ cr_common.run_click_check(cr_online_accounts.ClickReviewAccounts)
216
217=== modified file 'bin/click-check-push-helper'
218--- bin/click-check-push-helper 2014-07-21 21:52:48 +0000
219+++ bin/click-check-push-helper 2015-03-18 20:49:53 +0000
220@@ -1,7 +1,7 @@
221 #!/usr/bin/python3
222 '''click-check-push-helper: perform click push-helper checks'''
223 #
224-# Copyright (C) 2014 Canonical Ltd.
225+# Copyright (C) 2014-2015 Canonical Ltd.
226 #
227 # This program is free software: you can redistribute it and/or modify
228 # it under the terms of the GNU General Public License as published by
229@@ -16,16 +16,9 @@
230 # along with this program. If not, see <http://www.gnu.org/licenses/>.
231
232 from __future__ import print_function
233-import sys
234
235 import clickreviews.cr_common as cr_common
236 import clickreviews.cr_push_helper as cr_push_helper
237
238 if __name__ == "__main__":
239- if len(sys.argv) < 2:
240- cr_common.error("Must give path to click package")
241-
242- review = cr_push_helper.ClickReviewPushHelper(sys.argv[1])
243- review.do_checks()
244- rc = review.do_report()
245- sys.exit(rc)
246+ cr_common.run_click_check(cr_push_helper.ClickReviewPushHelper)
247
248=== modified file 'bin/click-check-scope'
249--- bin/click-check-scope 2014-07-14 18:48:37 +0000
250+++ bin/click-check-scope 2015-03-18 20:49:53 +0000
251@@ -1,7 +1,7 @@
252 #!/usr/bin/python3
253 '''click-check-scope: perform click scope checks'''
254 #
255-# Copyright (C) 2014 Canonical Ltd.
256+# Copyright (C) 2014-2015 Canonical Ltd.
257 #
258 # This program is free software: you can redistribute it and/or modify
259 # it under the terms of the GNU General Public License as published by
260@@ -16,16 +16,9 @@
261 # along with this program. If not, see <http://www.gnu.org/licenses/>.
262
263 from __future__ import print_function
264-import sys
265
266 import clickreviews.cr_common as cr_common
267 import clickreviews.cr_scope as cr_scope
268
269 if __name__ == "__main__":
270- if len(sys.argv) < 2:
271- cr_common.error("Must give path to click package")
272-
273- review = cr_scope.ClickReviewScope(sys.argv[1])
274- review.do_checks()
275- rc = review.do_report()
276- sys.exit(rc)
277+ cr_common.run_click_check(cr_scope.ClickReviewScope)
278
279=== modified file 'bin/click-check-security'
280--- bin/click-check-security 2014-11-14 14:32:39 +0000
281+++ bin/click-check-security 2015-03-18 20:49:53 +0000
282@@ -16,24 +16,9 @@
283 # along with this program. If not, see <http://www.gnu.org/licenses/>.
284
285 from __future__ import print_function
286-import json
287-import sys
288
289 import clickreviews.cr_common as cr_common
290 import clickreviews.cr_security as cr_security
291
292 if __name__ == "__main__":
293- if len(sys.argv) < 2:
294- cr_common.error("Must give path to click package")
295-
296- # extract args
297- fn = sys.argv[1]
298- if len(sys.argv) > 2:
299- overrides = json.loads(sys.argv[2])
300- else:
301- overrides = None
302-
303- review = cr_security.ClickReviewSecurity(fn, overrides=overrides)
304- review.do_checks()
305- rc = review.do_report()
306- sys.exit(rc)
307+ cr_common.run_click_check(cr_security.ClickReviewSecurity)
308
309=== modified file 'bin/click-check-skeleton'
310--- bin/click-check-skeleton 2013-09-26 12:24:10 +0000
311+++ bin/click-check-skeleton 2015-03-18 20:49:53 +0000
312@@ -1,7 +1,7 @@
313 #!/usr/bin/python3
314 '''click-check-skeleton: perform click skeleton checks'''
315 #
316-# Copyright (C) 2013 Canonical Ltd.
317+# Copyright (C) 2013-2015 Canonical Ltd.
318 #
319 # This program is free software: you can redistribute it and/or modify
320 # it under the terms of the GNU General Public License as published by
321@@ -16,16 +16,9 @@
322 # along with this program. If not, see <http://www.gnu.org/licenses/>.
323
324 from __future__ import print_function
325-import sys
326
327 import clickreviews.cr_common as cr_common
328 import clickreviews.cr_skeleton as cr_skeleton
329
330 if __name__ == "__main__":
331- if len(sys.argv) < 2:
332- cr_common.error("Must give path to click package")
333-
334- review = cr_skeleton.ClickReviewSkeleton(sys.argv[1])
335- review.do_checks()
336- rc = review.do_report()
337- sys.exit(rc)
338+ cr_common.run_click_check(cr_skeleton.ClickReviewSkeleton)
339
340=== modified file 'bin/click-check-systemd'
341--- bin/click-check-systemd 2015-03-18 19:29:09 +0000
342+++ bin/click-check-systemd 2015-03-18 20:49:53 +0000
343@@ -16,16 +16,9 @@
344 # along with this program. If not, see <http://www.gnu.org/licenses/>.
345
346 from __future__ import print_function
347-import sys
348
349 import clickreviews.cr_common as cr_common
350 import clickreviews.cr_systemd as cr_systemd
351
352 if __name__ == "__main__":
353- if len(sys.argv) < 2:
354- cr_common.error("Must give path to click package")
355-
356- review = cr_systemd.ClickReviewSystemd(sys.argv[1])
357- review.do_checks()
358- rc = review.do_report()
359- sys.exit(rc)
360+ cr_common.run_click_check(cr_systemd.ClickReviewSystemd)
361
362=== modified file 'bin/click-check-url-dispatcher'
363--- bin/click-check-url-dispatcher 2014-07-14 18:48:37 +0000
364+++ bin/click-check-url-dispatcher 2015-03-18 20:49:53 +0000
365@@ -1,7 +1,7 @@
366 #!/usr/bin/python3
367 '''click-check-url_dispatcher: perform click url dispatcher checks'''
368 #
369-# Copyright (C) 2014 Canonical Ltd.
370+# Copyright (C) 2014-2015 Canonical Ltd.
371 #
372 # This program is free software: you can redistribute it and/or modify
373 # it under the terms of the GNU General Public License as published by
374@@ -16,16 +16,9 @@
375 # along with this program. If not, see <http://www.gnu.org/licenses/>.
376
377 from __future__ import print_function
378-import sys
379
380 import clickreviews.cr_common as cr_common
381 import clickreviews.cr_url_dispatcher as cr_url_dispatcher
382
383 if __name__ == "__main__":
384- if len(sys.argv) < 2:
385- cr_common.error("Must give path to click package")
386-
387- review = cr_url_dispatcher.ClickReviewUrlDispatcher(sys.argv[1])
388- review.do_checks()
389- rc = review.do_report()
390- sys.exit(rc)
391+ cr_common.run_click_check(cr_url_dispatcher.ClickReviewUrlDispatcher)
392
393=== modified file 'bin/click-run-checks'
394--- bin/click-run-checks 2015-03-18 19:29:09 +0000
395+++ bin/click-run-checks 2015-03-18 20:49:53 +0000
396@@ -11,8 +11,10 @@
397 fi
398
399 # prefer local script for testing, otherwise use system location
400+CLICK_CHECKS_BIN_PATH="$(dirname $(readlink -f "$0"))"
401+
402 prefer_local() {
403- path="$(dirname $(readlink -f "$0"))/$1"
404+ path="${CLICK_CHECKS_BIN_PATH}/$1"
405 if [ -x $path ]; then
406 "$path" "$2" || set_rc "$?"
407 return
408@@ -35,53 +37,14 @@
409
410 prefer_local click-show-files "$c"
411
412-echo ""
413-echo "= click-check-lint ="
414-prefer_local click-check-lint "$c"
415-
416-echo ""
417-echo "= click-check-bin-path ="
418-prefer_local click-check-bin-path "$c"
419-
420-echo ""
421-echo "= click-check-content-hub ="
422-prefer_local click-check-content-hub "$c"
423-
424-echo ""
425-echo "= click-check-desktop ="
426-prefer_local click-check-desktop "$c"
427-
428-echo ""
429-echo "= click-check-framework ="
430-prefer_local click-check-framework "$c"
431-
432-echo ""
433-echo "= click-check-functional ="
434-prefer_local click-check-functional "$c"
435-
436-echo ""
437-echo "= click-check-online-accounts ="
438-prefer_local click-check-online-accounts "$c"
439-
440-echo ""
441-echo "= click-check-push-helper ="
442-prefer_local click-check-push-helper "$c"
443-
444-echo ""
445-echo "= click-check-scope ="
446-prefer_local click-check-scope "$c"
447-
448-echo ""
449-echo "= click-check-security ="
450-prefer_local click-check-security "$c"
451-
452-echo ""
453-echo "= click-check-systemd ="
454-prefer_local click-check-systemd "$c"
455-
456-echo ""
457-echo "= click-check-url-dispatcher ="
458-prefer_local click-check-url-dispatcher "$c"
459+CLICK_CHECKS=$(ls ${CLICK_CHECKS_BIN_PATH}/click-check-* | grep -v click-check-skeleton | grep -v click-check-lint)
460+CLICK_CHECKS="click-check-lint ${CLICK_CHECKS}"
461+for check_path in ${CLICK_CHECKS}; do
462+ check=$(basename ${check_path} ${CLICK_CHECKS_BIN_PATH})
463+ echo ""
464+ echo "=" $check "="
465+ prefer_local $check "$c"
466+done
467
468 echo ""
469 echo ""
470
471=== modified file 'clickreviews/cr_bin_path.py'
472--- clickreviews/cr_bin_path.py 2015-03-09 18:29:49 +0000
473+++ clickreviews/cr_bin_path.py 2015-03-18 20:49:53 +0000
474@@ -22,14 +22,15 @@
475
476 class ClickReviewBinPath(ClickReview):
477 '''This class represents click lint reviews'''
478- def __init__(self, fn):
479+ def __init__(self, fn, overrides=None):
480 peer_hooks = dict()
481 my_hook = 'bin-path'
482 peer_hooks[my_hook] = dict()
483 peer_hooks[my_hook]['required'] = ["apparmor"]
484 peer_hooks[my_hook]['allowed'] = peer_hooks[my_hook]['required']
485
486- ClickReview.__init__(self, fn, "bin-path", peer_hooks=peer_hooks)
487+ ClickReview.__init__(self, fn, "bin-path", peer_hooks=peer_hooks,
488+ overrides=overrides)
489
490 self.bin_paths = dict()
491 for app in self.manifest['hooks']:
492
493=== modified file 'clickreviews/cr_common.py'
494--- clickreviews/cr_common.py 2015-03-09 15:09:31 +0000
495+++ clickreviews/cr_common.py 2015-03-18 20:49:53 +0000
496@@ -95,7 +95,7 @@
497 "vendor", # replaces maintainer
498 ]
499
500- def __init__(self, fn, review_type, peer_hooks=None):
501+ def __init__(self, fn, review_type, peer_hooks=None, overrides=None):
502 self.click_package = fn
503 self._check_path_exists()
504 if not self.click_package.endswith(".click") and \
505@@ -164,6 +164,7 @@
506 self.valid_frameworks = self._extract_click_frameworks()
507
508 self.peer_hooks = peer_hooks
509+ self.overrides = overrides if overrides is not None else {}
510
511 def _extract_click_frameworks(self):
512 '''Extract installed click frameworks'''
513@@ -609,3 +610,20 @@
514 recursive_rm(path)
515 if contents_only is False:
516 os.rmdir(dirPath)
517+
518+
519+def run_click_check(cls):
520+ if len(sys.argv) < 2:
521+ error("Must give path to click package")
522+
523+ # extract args
524+ fn = sys.argv[1]
525+ if len(sys.argv) > 2:
526+ overrides = json.loads(sys.argv[2])
527+ else:
528+ overrides = None
529+
530+ review = cls(fn, overrides=overrides)
531+ review.do_checks()
532+ rc = review.do_report()
533+ sys.exit(rc)
534
535=== modified file 'clickreviews/cr_content_hub.py'
536--- clickreviews/cr_content_hub.py 2014-11-21 18:23:51 +0000
537+++ clickreviews/cr_content_hub.py 2015-03-18 20:49:53 +0000
538@@ -1,6 +1,6 @@
539 '''cr_content_hub.py: click content-hub checks'''
540 #
541-# Copyright (C) 2014 Canonical Ltd.
542+# Copyright (C) 2014-2015 Canonical Ltd.
543 #
544 # This program is free software: you can redistribute it and/or modify
545 # it under the terms of the GNU General Public License as published by
546@@ -23,14 +23,15 @@
547
548 class ClickReviewContentHub(ClickReview):
549 '''This class represents click lint reviews'''
550- def __init__(self, fn):
551+ def __init__(self, fn, overrides=None):
552 peer_hooks = dict()
553 my_hook = 'content-hub'
554 peer_hooks[my_hook] = dict()
555 peer_hooks[my_hook]['allowed'] = ClickReview.app_allowed_peer_hooks
556 peer_hooks[my_hook]['required'] = []
557
558- ClickReview.__init__(self, fn, "content_hub", peer_hooks=peer_hooks)
559+ ClickReview.__init__(self, fn, "content_hub", peer_hooks=peer_hooks,
560+ overrides=overrides)
561
562 self.valid_keys = ['destination', 'share', 'source']
563
564
565=== modified file 'clickreviews/cr_desktop.py'
566--- clickreviews/cr_desktop.py 2015-02-02 16:00:04 +0000
567+++ clickreviews/cr_desktop.py 2015-03-18 20:49:53 +0000
568@@ -1,6 +1,6 @@
569 '''cr_desktop.py: click desktop checks'''
570 #
571-# Copyright (C) 2013-2014 Canonical Ltd.
572+# Copyright (C) 2013-2015 Canonical Ltd.
573 #
574 # This program is free software: you can redistribute it and/or modify
575 # it under the terms of the GNU General Public License as published by
576@@ -28,14 +28,15 @@
577
578 class ClickReviewDesktop(ClickReview):
579 '''This class represents click lint reviews'''
580- def __init__(self, fn):
581+ def __init__(self, fn, overrides=None):
582 peer_hooks = dict()
583 my_hook = 'desktop'
584 peer_hooks[my_hook] = dict()
585 peer_hooks[my_hook]['allowed'] = ClickReview.app_allowed_peer_hooks
586 peer_hooks[my_hook]['required'] = ["apparmor"]
587
588- ClickReview.__init__(self, fn, "desktop", peer_hooks=peer_hooks)
589+ ClickReview.__init__(self, fn, "desktop", peer_hooks=peer_hooks,
590+ overrides=overrides)
591
592 self.desktop_files = dict() # click-show-files and a couple tests
593 self.desktop_entries = dict()
594
595=== modified file 'clickreviews/cr_framework.py'
596--- clickreviews/cr_framework.py 2014-11-21 18:22:56 +0000
597+++ clickreviews/cr_framework.py 2015-03-18 20:49:53 +0000
598@@ -1,6 +1,6 @@
599 '''cr_framework.py: click framework'''
600 #
601-# Copyright (C) 2014 Canonical Ltd.
602+# Copyright (C) 2014-2015 Canonical Ltd.
603 #
604 # This program is free software: you can redistribute it and/or modify
605 # it under the terms of the GNU General Public License as published by
606@@ -22,13 +22,14 @@
607
608 class ClickReviewFramework(ClickReview):
609 '''This class represents click lint reviews'''
610- def __init__(self, fn):
611+ def __init__(self, fn, overrides=None):
612 peer_hooks = dict()
613 my_hook = 'framework'
614 peer_hooks[my_hook] = dict()
615 peer_hooks[my_hook]['allowed'] = ClickReview.framework_allowed_peer_hooks
616 peer_hooks[my_hook]['required'] = peer_hooks[my_hook]['allowed']
617- ClickReview.__init__(self, fn, "framework", peer_hooks=peer_hooks)
618+ ClickReview.__init__(self, fn, "framework", peer_hooks=peer_hooks,
619+ overrides=overrides)
620
621 self.frameworks_file = dict()
622 self.frameworks = dict()
623
624=== modified file 'clickreviews/cr_functional.py'
625--- clickreviews/cr_functional.py 2014-07-14 16:00:54 +0000
626+++ clickreviews/cr_functional.py 2015-03-18 20:49:53 +0000
627@@ -1,6 +1,6 @@
628 '''cr_functional.py: click functional'''
629 #
630-# Copyright (C) 2013-2014 Canonical Ltd.
631+# Copyright (C) 2013-2015 Canonical Ltd.
632 #
633 # This program is free software: you can redistribute it and/or modify
634 # it under the terms of the GNU General Public License as published by
635@@ -27,8 +27,8 @@
636
637 class ClickReviewFunctional(ClickReview):
638 '''This class represents click lint reviews'''
639- def __init__(self, fn):
640- ClickReview.__init__(self, fn, "functional")
641+ def __init__(self, fn, overrides=None):
642+ ClickReview.__init__(self, fn, "functional", overrides=overrides)
643
644 self.qml_files = []
645 for i in self.pkg_files:
646
647=== modified file 'clickreviews/cr_lint.py'
648--- clickreviews/cr_lint.py 2015-03-18 16:26:11 +0000
649+++ clickreviews/cr_lint.py 2015-03-18 20:49:53 +0000
650@@ -33,7 +33,7 @@
651
652 def __init__(self, fn, overrides=None):
653 '''Set up the class.'''
654- ClickReview.__init__(self, fn, "lint")
655+ ClickReview.__init__(self, fn, "lint", overrides=overrides)
656 self.control_files = dict()
657 self._list_control_files()
658 # Valid values for Architecture in DEBIAN/control. Note:
659@@ -118,10 +118,6 @@
660 # 'oem', # TBI
661 ]
662
663- if overrides is None:
664- overrides = {}
665- self.overrides = overrides
666-
667 def _list_control_files(self):
668 '''List all control files with their full path.'''
669 for i in CONTROL_FILE_NAMES:
670
671=== modified file 'clickreviews/cr_online_accounts.py'
672--- clickreviews/cr_online_accounts.py 2014-11-24 23:03:00 +0000
673+++ clickreviews/cr_online_accounts.py 2015-03-18 20:49:53 +0000
674@@ -1,6 +1,6 @@
675 '''cr_online_accounts.py: click online accounts'''
676 #
677-# Copyright (C) 2013 Canonical Ltd.
678+# Copyright (C) 2013-2015 Canonical Ltd.
679 #
680 # This program is free software: you can redistribute it and/or modify
681 # it under the terms of the GNU General Public License as published by
682@@ -24,7 +24,7 @@
683
684 class ClickReviewAccounts(ClickReview):
685 '''This class represents click lint reviews'''
686- def __init__(self, fn):
687+ def __init__(self, fn, overrides=None):
688 peer_hooks = dict()
689 peer_hooks['account-application'] = dict()
690 peer_hooks['account-application']['allowed'] = \
691@@ -54,7 +54,8 @@
692 peer_hooks['account-qml-plugin']['allowed'] = \
693 peer_hooks['account-qml-plugin']['required']
694
695- ClickReview.__init__(self, fn, "online_accounts", peer_hooks)
696+ ClickReview.__init__(self, fn, "online_accounts", peer_hooks=peer_hooks,
697+ overrides=overrides)
698
699 self.accounts_files = dict()
700 self.accounts = dict()
701
702=== modified file 'clickreviews/cr_push_helper.py'
703--- clickreviews/cr_push_helper.py 2014-11-21 18:47:07 +0000
704+++ clickreviews/cr_push_helper.py 2015-03-18 20:49:53 +0000
705@@ -1,6 +1,6 @@
706 '''cr_push_helper.py: click push-helper checks'''
707 #
708-# Copyright (C) 2014 Canonical Ltd.
709+# Copyright (C) 2014-2015 Canonical Ltd.
710 #
711 # This program is free software: you can redistribute it and/or modify
712 # it under the terms of the GNU General Public License as published by
713@@ -23,14 +23,15 @@
714
715 class ClickReviewPushHelper(ClickReview):
716 '''This class represents click lint reviews'''
717- def __init__(self, fn):
718+ def __init__(self, fn, overrides=None):
719 peer_hooks = dict()
720 my_hook = 'push-helper'
721 peer_hooks[my_hook] = dict()
722 peer_hooks[my_hook]['allowed'] = ['apparmor']
723 peer_hooks[my_hook]['required'] = ['apparmor']
724
725- ClickReview.__init__(self, fn, "push_helper", peer_hooks=peer_hooks)
726+ ClickReview.__init__(self, fn, "push_helper", peer_hooks=peer_hooks,
727+ overrides=overrides)
728
729 self.required_keys = ['exec']
730 self.optional_keys = ['app_id']
731
732=== modified file 'clickreviews/cr_scope.py'
733--- clickreviews/cr_scope.py 2015-01-20 13:35:35 +0000
734+++ clickreviews/cr_scope.py 2015-03-18 20:49:53 +0000
735@@ -1,6 +1,6 @@
736 '''cr_scope.py: click scope'''
737 #
738-# Copyright (C) 2014 Canonical Ltd.
739+# Copyright (C) 2014-2015 Canonical Ltd.
740 #
741 # This program is free software: you can redistribute it and/or modify
742 # it under the terms of the GNU General Public License as published by
743@@ -30,14 +30,15 @@
744
745 class ClickReviewScope(ClickReview):
746 '''This class represents click lint reviews'''
747- def __init__(self, fn):
748+ def __init__(self, fn, overrides=None):
749 peer_hooks = dict()
750 my_hook = 'scope'
751 peer_hooks[my_hook] = dict()
752 peer_hooks[my_hook]['allowed'] = ClickReview.scope_allowed_peer_hooks
753 peer_hooks[my_hook]['required'] = ['apparmor']
754
755- ClickReview.__init__(self, fn, "scope", peer_hooks=peer_hooks)
756+ ClickReview.__init__(self, fn, "scope", peer_hooks=peer_hooks,
757+ overrides=overrides)
758
759 self.scopes = dict()
760 for app in self.manifest['hooks']:
761
762=== modified file 'clickreviews/cr_security.py'
763--- clickreviews/cr_security.py 2015-03-03 22:28:38 +0000
764+++ clickreviews/cr_security.py 2015-03-18 20:49:53 +0000
765@@ -43,7 +43,8 @@
766 ClickReview.service_allowed_peer_hooks
767 peer_hooks[my_hook2]['required'] = []
768
769- ClickReview.__init__(self, fn, "security", peer_hooks=peer_hooks)
770+ ClickReview.__init__(self, fn, "security", peer_hooks=peer_hooks,
771+ overrides=overrides)
772
773 local_copy = os.path.join(os.path.dirname(__file__),
774 '../data/apparmor-easyprof-ubuntu.json')
775@@ -111,9 +112,7 @@
776 'policy_version': 1.3,
777 },
778 }
779- if overrides is None:
780- overrides = {}
781- framework_overrides = overrides.get('framework', {})
782+ framework_overrides = self.overrides.get('framework', {})
783 self._override_framework_policies(framework_overrides)
784
785 self.security_manifests = dict()
786
787=== modified file 'clickreviews/cr_skeleton.py'
788--- clickreviews/cr_skeleton.py 2014-11-21 16:55:50 +0000
789+++ clickreviews/cr_skeleton.py 2015-03-18 20:49:53 +0000
790@@ -1,6 +1,6 @@
791 '''cr_skeleton.py: click skeleton'''
792 #
793-# Copyright (C) 2014 Canonical Ltd.
794+# Copyright (C) 2014-2015 Canonical Ltd.
795 #
796 # This program is free software: you can redistribute it and/or modify
797 # it under the terms of the GNU General Public License as published by
798@@ -21,7 +21,7 @@
799
800 class ClickReviewSkeleton(ClickReview):
801 '''This class represents click lint reviews'''
802- def __init__(self, fn):
803+ def __init__(self, fn, overrides=None):
804 # Many test classes are for verify click hooks. 'peer_hooks' is used
805 # to declare what hooks may be use with my_hook. When using this
806 # mechanism, ClickReview.check_peer_hooks() is run for you.
807@@ -31,7 +31,8 @@
808 peer_hooks[my_hook]['allowed'] = ["desktop", "apparmor", "urls"]
809 peer_hooks[my_hook]['required'] = ["desktop", "apparmor"]
810
811- ClickReview.__init__(self, fn, "skeleton", peer_hooks)
812+ ClickReview.__init__(self, fn, "skeleton", peer_hooks=peer_hooks,
813+ overrides=overrides)
814
815 # If not a hooks test, skip the above and omit peer_hooks like so:
816 # ClickReview.__init__(self, fn, "skeleton")
817
818=== modified file 'clickreviews/cr_systemd.py'
819--- clickreviews/cr_systemd.py 2015-03-09 19:53:11 +0000
820+++ clickreviews/cr_systemd.py 2015-03-18 20:49:53 +0000
821@@ -23,14 +23,15 @@
822
823 class ClickReviewSystemd(ClickReview):
824 '''This class represents click lint reviews'''
825- def __init__(self, fn):
826+ def __init__(self, fn, overrides=None):
827 peer_hooks = dict()
828 my_hook = 'snappy-systemd'
829 peer_hooks[my_hook] = dict()
830 peer_hooks[my_hook]['required'] = ["apparmor"]
831 peer_hooks[my_hook]['allowed'] = peer_hooks[my_hook]['required']
832
833- ClickReview.__init__(self, fn, "snappy-systemd", peer_hooks=peer_hooks)
834+ ClickReview.__init__(self, fn, "snappy-systemd", peer_hooks=peer_hooks,
835+ overrides=overrides)
836
837 # snappy-systemd currently only allows specifying:
838 # - start (required)
839
840=== modified file 'clickreviews/cr_url_dispatcher.py'
841--- clickreviews/cr_url_dispatcher.py 2014-11-21 19:18:55 +0000
842+++ clickreviews/cr_url_dispatcher.py 2015-03-18 20:49:53 +0000
843@@ -1,6 +1,6 @@
844 '''cr_url dispatcher.py: click url_dispatcher'''
845 #
846-# Copyright (C) 2014 Canonical Ltd.
847+# Copyright (C) 2014-2015 Canonical Ltd.
848 #
849 # This program is free software: you can redistribute it and/or modify
850 # it under the terms of the GNU General Public License as published by
851@@ -25,14 +25,15 @@
852
853 class ClickReviewUrlDispatcher(ClickReview):
854 '''This class represents click lint reviews'''
855- def __init__(self, fn):
856+ def __init__(self, fn, overrides=None):
857 peer_hooks = dict()
858 my_hook = 'urls'
859 peer_hooks[my_hook] = dict()
860 peer_hooks[my_hook]['allowed'] = ClickReview.app_allowed_peer_hooks
861 peer_hooks[my_hook]['required'] = []
862
863- ClickReview.__init__(self, fn, "url_dispatcher", peer_hooks=peer_hooks)
864+ ClickReview.__init__(self, fn, "url_dispatcher", peer_hooks=peer_hooks,
865+ overrides=overrides)
866
867 self.required_keys = ['protocol']
868 self.optional_keys = ['domain-suffix']

Subscribers

People subscribed via source and target branches