Merge lp:~snappy-dev/click/binapparmor into lp:~snappy-dev/click/snappy
- binapparmor
- Merge into snappy
Proposed by
Barry Warsaw
Status: | Merged |
---|---|
Merged at revision: | 583 |
Proposed branch: | lp:~snappy-dev/click/binapparmor |
Merge into: | lp:~snappy-dev/click/snappy |
Diff against target: |
372 lines (+202/-16) 4 files modified
click/build.py (+18/-4) click/tests/test_build.py (+175/-11) click/tests/test_database.py (+2/-1) debian/changelog (+7/-0) |
To merge this branch: | bzr merge lp:~snappy-dev/click/binapparmor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Hunt | Pending | ||
Jamie Strandboge | Pending | ||
Michael Vogt | Pending | ||
Review via email: mp+243875@code.launchpad.net |
Commit message
Description of the change
click (0.4.35+ppa27) vivid; urgency=medium
* Give binaries default apparmor and apparmor-profile keys in their
manifest when explicit profiles are not present in packages.yaml
-- Barry Warsaw <email address hidden> Fri, 05 Dec 2014 16:53:51 -0500
With test cases! :)
I also repaired the test suite for Python 2.7 (tox) as bonus.
To post a comment you must log in.
Revision history for this message
Jamie Strandboge (jdstrand) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'click/build.py' | |||
2 | --- click/build.py 2014-12-04 14:12:41 +0000 | |||
3 | +++ click/build.py 2014-12-05 21:56:27 +0000 | |||
4 | @@ -62,7 +62,7 @@ | |||
5 | 62 | ) | 62 | ) |
6 | 63 | 63 | ||
7 | 64 | 64 | ||
9 | 65 | SNAPPY_APPARMOR_DEFAULT_TEMPLATE = """\ | 65 | SNAPPY_SERVICE_APPARMOR_DEFAULT_TEMPLATE = u"""\ |
10 | 66 | { | 66 | { |
11 | 67 | "template": "default", | 67 | "template": "default", |
12 | 68 | "policy_groups": [ | 68 | "policy_groups": [ |
13 | @@ -73,6 +73,10 @@ | |||
14 | 73 | } | 73 | } |
15 | 74 | """ | 74 | """ |
16 | 75 | 75 | ||
17 | 76 | # XXX For now, these are the same templates. | ||
18 | 77 | SNAPPY_BINARY_APPARMOR_DEFAULT_TEMPLATE = \ | ||
19 | 78 | SNAPPY_SERVICE_APPARMOR_DEFAULT_TEMPLATE | ||
20 | 79 | |||
21 | 76 | 80 | ||
22 | 77 | @contextlib.contextmanager | 81 | @contextlib.contextmanager |
23 | 78 | def make_temp_dir(): | 82 | def make_temp_dir(): |
24 | @@ -170,7 +174,8 @@ | |||
25 | 170 | template_path = os.path.join( | 174 | template_path = os.path.join( |
26 | 171 | 'meta', '{}.apparmor'.format(name)) | 175 | 'meta', '{}.apparmor'.format(name)) |
27 | 172 | current_hook['apparmor'] = template_path | 176 | current_hook['apparmor'] = template_path |
29 | 173 | self.autogen_apparmor.append(template_path) | 177 | self.autogen_apparmor.append( |
30 | 178 | (SNAPPY_SERVICE_APPARMOR_DEFAULT_TEMPLATE, template_path)) | ||
31 | 174 | self.manifest["hooks"] = hooks | 179 | self.manifest["hooks"] = hooks |
32 | 175 | # cleanup | 180 | # cleanup |
33 | 176 | if "services" in self.manifest: | 181 | if "services" in self.manifest: |
34 | @@ -183,6 +188,15 @@ | |||
35 | 183 | current_hook = hooks.get(base_name, {}) | 188 | current_hook = hooks.get(base_name, {}) |
36 | 184 | current_hook["bin-path"] = binary["name"] | 189 | current_hook["bin-path"] = binary["name"] |
37 | 185 | hooks[base_name] = current_hook | 190 | hooks[base_name] = current_hook |
38 | 191 | # Is there an explicit apparmor hook? If so, use it otherwise | ||
39 | 192 | # generate a default one. | ||
40 | 193 | if ( 'apparmor' not in current_hook and | ||
41 | 194 | 'apparmor-profile' not in current_hook): | ||
42 | 195 | template_path = os.path.join( | ||
43 | 196 | 'meta', '{}.apparmor'.format(base_name)) | ||
44 | 197 | current_hook['apparmor'] = template_path | ||
45 | 198 | self.autogen_apparmor.append( | ||
46 | 199 | (SNAPPY_BINARY_APPARMOR_DEFAULT_TEMPLATE, template_path)) | ||
47 | 186 | self.manifest["hooks"] = hooks | 200 | self.manifest["hooks"] = hooks |
48 | 187 | # cleanup | 201 | # cleanup |
49 | 188 | if "binaries" in self.manifest: | 202 | if "binaries" in self.manifest: |
50 | @@ -342,10 +356,10 @@ | |||
51 | 342 | if "framework" in self.manifest: | 356 | if "framework" in self.manifest: |
52 | 343 | self._validate_framework(self.manifest["framework"]) | 357 | self._validate_framework(self.manifest["framework"]) |
53 | 344 | 358 | ||
55 | 345 | for template_path in self.autogen_apparmor: | 359 | for template, template_path in self.autogen_apparmor: |
56 | 346 | path = os.path.join(root_path, template_path) | 360 | path = os.path.join(root_path, template_path) |
57 | 347 | with io.open(path, 'w', encoding='utf-8') as fp: | 361 | with io.open(path, 'w', encoding='utf-8') as fp: |
59 | 348 | fp.write(SNAPPY_APPARMOR_DEFAULT_TEMPLATE) | 362 | fp.write(template) |
60 | 349 | 363 | ||
61 | 350 | du_output = subprocess.check_output( | 364 | du_output = subprocess.check_output( |
62 | 351 | ["du", "-k", "-s", "--apparent-size", "."], | 365 | ["du", "-k", "-s", "--apparent-size", "."], |
63 | 352 | 366 | ||
64 | === modified file 'click/tests/test_build.py' | |||
65 | --- click/tests/test_build.py 2014-12-04 14:08:55 +0000 | |||
66 | +++ click/tests/test_build.py 2014-12-05 21:56:27 +0000 | |||
67 | @@ -24,6 +24,7 @@ | |||
68 | 24 | ] | 24 | ] |
69 | 25 | 25 | ||
70 | 26 | 26 | ||
71 | 27 | import io | ||
72 | 27 | import json | 28 | import json |
73 | 28 | import os | 29 | import os |
74 | 29 | import stat | 30 | import stat |
75 | @@ -409,6 +410,38 @@ | |||
76 | 409 | - name: path/to/cli1 | 410 | - name: path/to/cli1 |
77 | 410 | """ | 411 | """ |
78 | 411 | 412 | ||
79 | 413 | APPARMOR_3_TEMPLATE = """\ | ||
80 | 414 | name: test-yaml | ||
81 | 415 | icon: data/icon.svg | ||
82 | 416 | version: 1.0 | ||
83 | 417 | maintainer: Foo Bar <foo@example.org> | ||
84 | 418 | architecture: all | ||
85 | 419 | framework: ubuntu-core-15.04 | ||
86 | 420 | integration: | ||
87 | 421 | cli1: | ||
88 | 422 | hookname: hook-file-name | ||
89 | 423 | apparmor: path/to/cli1.apparmor-profile | ||
90 | 424 | binaries: | ||
91 | 425 | - name: path/to/cli1 | ||
92 | 426 | - name: path/to/cli2 | ||
93 | 427 | """ | ||
94 | 428 | |||
95 | 429 | APPARMOR_4_TEMPLATE = """\ | ||
96 | 430 | name: test-yaml | ||
97 | 431 | icon: data/icon.svg | ||
98 | 432 | version: 1.0 | ||
99 | 433 | maintainer: Foo Bar <foo@example.org> | ||
100 | 434 | architecture: all | ||
101 | 435 | framework: ubuntu-core-15.04 | ||
102 | 436 | integration: | ||
103 | 437 | cli1: | ||
104 | 438 | hookname: hook-file-name | ||
105 | 439 | apparmor-profile: path/to/cli1.apparmor-profile | ||
106 | 440 | binaries: | ||
107 | 441 | - name: path/to/cli1 | ||
108 | 442 | - name: path/to/cli2 | ||
109 | 443 | """ | ||
110 | 444 | |||
111 | 412 | 445 | ||
112 | 413 | class TestClickBuildYaml(TestCase): | 446 | class TestClickBuildYaml(TestCase): |
113 | 414 | def setUp(self): | 447 | def setUp(self): |
114 | @@ -453,7 +486,7 @@ | |||
115 | 453 | ["dpkg-deb", "-c", actual_path], universal_newlines=True) | 486 | ["dpkg-deb", "-c", actual_path], universal_newlines=True) |
116 | 454 | for file_path in ("./data/icon.svg", "./meta/package.yaml", | 487 | for file_path in ("./data/icon.svg", "./meta/package.yaml", |
117 | 455 | "./meta/readme.md", "./bin/foo", | 488 | "./meta/readme.md", "./bin/foo", |
119 | 456 | "./meta/app1.apparmor"): | 489 | "./meta/app1.apparmor", "./meta/cli1.apparmor"): |
120 | 457 | self.assertIn(file_path, click_contents) | 490 | self.assertIn(file_path, click_contents) |
121 | 458 | 491 | ||
122 | 459 | def test_read_manifest(self): | 492 | def test_read_manifest(self): |
123 | @@ -475,6 +508,9 @@ | |||
124 | 475 | "path/to/cli1", | 508 | "path/to/cli1", |
125 | 476 | self.builder.manifest["hooks"]["cli1"]["bin-path"]) | 509 | self.builder.manifest["hooks"]["cli1"]["bin-path"]) |
126 | 477 | self.assertEqual( | 510 | self.assertEqual( |
127 | 511 | "meta/cli1.apparmor", | ||
128 | 512 | self.builder.manifest["hooks"]["cli1"]["apparmor"]) | ||
129 | 513 | self.assertEqual( | ||
130 | 478 | "meta/app1.apparmor", | 514 | "meta/app1.apparmor", |
131 | 479 | self.builder.manifest["hooks"]["app1"]["apparmor"]) | 515 | self.builder.manifest["hooks"]["app1"]["apparmor"]) |
132 | 480 | 516 | ||
133 | @@ -488,6 +524,9 @@ | |||
134 | 488 | self.assertEqual( | 524 | self.assertEqual( |
135 | 489 | "meta/app2.apparmor", | 525 | "meta/app2.apparmor", |
136 | 490 | self.builder.manifest["hooks"]["app2"]["apparmor"]) | 526 | self.builder.manifest["hooks"]["app2"]["apparmor"]) |
137 | 527 | self.assertEqual( | ||
138 | 528 | "meta/cli1.apparmor", | ||
139 | 529 | self.builder.manifest["hooks"]["cli1"]["apparmor"]) | ||
140 | 491 | 530 | ||
141 | 492 | def test_one_explicit_apparmor_profile(self): | 531 | def test_one_explicit_apparmor_profile(self): |
142 | 493 | self.use_temp_dir() | 532 | self.use_temp_dir() |
143 | @@ -501,6 +540,9 @@ | |||
144 | 501 | self.assertEqual( | 540 | self.assertEqual( |
145 | 502 | "meta/app2.apparmor", | 541 | "meta/app2.apparmor", |
146 | 503 | self.builder.manifest["hooks"]["app2"]["apparmor"]) | 542 | self.builder.manifest["hooks"]["app2"]["apparmor"]) |
147 | 543 | self.assertEqual( | ||
148 | 544 | "meta/cli1.apparmor", | ||
149 | 545 | self.builder.manifest["hooks"]["cli1"]["apparmor"]) | ||
150 | 504 | 546 | ||
151 | 505 | def test_one_explicit_apparmor_file(self): | 547 | def test_one_explicit_apparmor_file(self): |
152 | 506 | self.use_temp_dir() | 548 | self.use_temp_dir() |
153 | @@ -509,8 +551,8 @@ | |||
154 | 509 | touch(os.path.join(scratch, "data", "icon.svg")) | 551 | touch(os.path.join(scratch, "data", "icon.svg")) |
155 | 510 | apparmor_path = os.path.join(scratch, 'path', 'to', 'app1.apparmor') | 552 | apparmor_path = os.path.join(scratch, 'path', 'to', 'app1.apparmor') |
156 | 511 | os.makedirs(os.path.dirname(apparmor_path)) | 553 | os.makedirs(os.path.dirname(apparmor_path)) |
159 | 512 | with open(apparmor_path, 'w', encoding='utf-8') as fp: | 554 | with io.open(apparmor_path, 'w', encoding='utf-8') as fp: |
160 | 513 | fp.write(dedent("""\ | 555 | fp.write(dedent(u"""\ |
161 | 514 | { | 556 | { |
162 | 515 | "template": "default", | 557 | "template": "default", |
163 | 516 | "policy_groups": [ | 558 | "policy_groups": [ |
164 | @@ -535,8 +577,8 @@ | |||
165 | 535 | self.assertEqual( | 577 | self.assertEqual( |
166 | 536 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), | 578 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), |
167 | 537 | ['app1.apparmor']) | 579 | ['app1.apparmor']) |
170 | 538 | with open(os.path.join(contents, 'path', 'to', 'app1.apparmor'), | 580 | with io.open(os.path.join(contents, 'path', 'to', 'app1.apparmor'), |
171 | 539 | encoding='utf-8') as fp: | 581 | encoding='utf-8') as fp: |
172 | 540 | data = fp.read() | 582 | data = fp.read() |
173 | 541 | self.assertEqual(data, dedent("""\ | 583 | self.assertEqual(data, dedent("""\ |
174 | 542 | { | 584 | { |
175 | @@ -548,8 +590,8 @@ | |||
176 | 548 | "policy_version": 99.99 | 590 | "policy_version": 99.99 |
177 | 549 | } | 591 | } |
178 | 550 | """)) | 592 | """)) |
181 | 551 | with open(os.path.join(contents, 'meta', 'app2.apparmor'), | 593 | with io.open(os.path.join(contents, 'meta', 'app2.apparmor'), |
182 | 552 | encoding='utf-8') as fp: | 594 | encoding='utf-8') as fp: |
183 | 553 | data = fp.read() | 595 | data = fp.read() |
184 | 554 | self.assertEqual(data, dedent("""\ | 596 | self.assertEqual(data, dedent("""\ |
185 | 555 | { | 597 | { |
186 | @@ -570,8 +612,8 @@ | |||
187 | 570 | apparmor_path = os.path.join( | 612 | apparmor_path = os.path.join( |
188 | 571 | scratch, 'path', 'to', 'app1.apparmor-profile') | 613 | scratch, 'path', 'to', 'app1.apparmor-profile') |
189 | 572 | os.makedirs(os.path.dirname(apparmor_path)) | 614 | os.makedirs(os.path.dirname(apparmor_path)) |
192 | 573 | with open(apparmor_path, 'w', encoding='utf-8') as fp: | 615 | with io.open(apparmor_path, 'w', encoding='utf-8') as fp: |
193 | 574 | fp.write(dedent("""\ | 616 | fp.write(dedent(u"""\ |
194 | 575 | { | 617 | { |
195 | 576 | "template": "default", | 618 | "template": "default", |
196 | 577 | "policy_groups": [ | 619 | "policy_groups": [ |
197 | @@ -596,7 +638,7 @@ | |||
198 | 596 | self.assertEqual( | 638 | self.assertEqual( |
199 | 597 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), | 639 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), |
200 | 598 | ['app1.apparmor-profile']) | 640 | ['app1.apparmor-profile']) |
202 | 599 | with open( | 641 | with io.open( |
203 | 600 | os.path.join(contents, 'path', 'to', 'app1.apparmor-profile'), | 642 | os.path.join(contents, 'path', 'to', 'app1.apparmor-profile'), |
204 | 601 | encoding='utf-8') as fp: | 643 | encoding='utf-8') as fp: |
205 | 602 | data = fp.read() | 644 | data = fp.read() |
206 | @@ -610,7 +652,129 @@ | |||
207 | 610 | "policy_version": 88.88 | 652 | "policy_version": 88.88 |
208 | 611 | } | 653 | } |
209 | 612 | """)) | 654 | """)) |
211 | 613 | with open(os.path.join(contents, 'meta', 'app2.apparmor'), | 655 | with io.open(os.path.join(contents, 'meta', 'app2.apparmor'), |
212 | 656 | encoding='utf-8') as fp: | ||
213 | 657 | data = fp.read() | ||
214 | 658 | self.assertEqual(data, dedent("""\ | ||
215 | 659 | { | ||
216 | 660 | "template": "default", | ||
217 | 661 | "policy_groups": [ | ||
218 | 662 | "networking" | ||
219 | 663 | ], | ||
220 | 664 | "policy_vendor": "ubuntu-snappy", | ||
221 | 665 | "policy_version": 1.3 | ||
222 | 666 | } | ||
223 | 667 | """)) | ||
224 | 668 | |||
225 | 669 | def test_one_explicit_binary_apparmor_file(self): | ||
226 | 670 | self.use_temp_dir() | ||
227 | 671 | scratch = os.path.join(self.temp_dir, "scratch") | ||
228 | 672 | touch(os.path.join(scratch, "bin", "foo")) | ||
229 | 673 | touch(os.path.join(scratch, "data", "icon.svg")) | ||
230 | 674 | apparmor_path = os.path.join(scratch, 'path', 'to', 'cli1.apparmor') | ||
231 | 675 | os.makedirs(os.path.dirname(apparmor_path)) | ||
232 | 676 | with io.open(apparmor_path, 'w', encoding='utf-8') as fp: | ||
233 | 677 | fp.write(dedent(u"""\ | ||
234 | 678 | { | ||
235 | 679 | "template": "default", | ||
236 | 680 | "policy_groups": [ | ||
237 | 681 | "networking" | ||
238 | 682 | ], | ||
239 | 683 | "policy_vendor": "ubuntu-snappy", | ||
240 | 684 | "policy_version": 99.99 | ||
241 | 685 | } | ||
242 | 686 | """)) | ||
243 | 687 | self._make_metadata(scratch, APPARMOR_3_TEMPLATE) | ||
244 | 688 | self.builder.add_file(scratch, "./") | ||
245 | 689 | # FIXME: make it a .snap | ||
246 | 690 | expected_path = os.path.join(self.temp_dir, "test-yaml_1.0_all.click") | ||
247 | 691 | actual_path = self.builder.build(self.temp_dir, "meta/package.yaml") | ||
248 | 692 | self.assertEqual(expected_path, actual_path) | ||
249 | 693 | self.assertTrue(os.path.exists(actual_path)) | ||
250 | 694 | contents = os.path.join(self.temp_dir, 'contents') | ||
251 | 695 | subprocess.check_output( | ||
252 | 696 | ["dpkg-deb", "-R", actual_path, contents], universal_newlines=True) | ||
253 | 697 | self.assertEqual(sorted(os.listdir(contents)), | ||
254 | 698 | ['DEBIAN', 'bin', 'data', 'meta', 'path']) | ||
255 | 699 | self.assertEqual( | ||
256 | 700 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), | ||
257 | 701 | ['cli1.apparmor']) | ||
258 | 702 | with io.open(os.path.join(contents, 'path', 'to', 'cli1.apparmor'), | ||
259 | 703 | encoding='utf-8') as fp: | ||
260 | 704 | data = fp.read() | ||
261 | 705 | self.assertEqual(data, dedent("""\ | ||
262 | 706 | { | ||
263 | 707 | "template": "default", | ||
264 | 708 | "policy_groups": [ | ||
265 | 709 | "networking" | ||
266 | 710 | ], | ||
267 | 711 | "policy_vendor": "ubuntu-snappy", | ||
268 | 712 | "policy_version": 99.99 | ||
269 | 713 | } | ||
270 | 714 | """)) | ||
271 | 715 | with io.open(os.path.join(contents, 'meta', 'cli2.apparmor'), | ||
272 | 716 | encoding='utf-8') as fp: | ||
273 | 717 | data = fp.read() | ||
274 | 718 | self.assertEqual(data, dedent("""\ | ||
275 | 719 | { | ||
276 | 720 | "template": "default", | ||
277 | 721 | "policy_groups": [ | ||
278 | 722 | "networking" | ||
279 | 723 | ], | ||
280 | 724 | "policy_vendor": "ubuntu-snappy", | ||
281 | 725 | "policy_version": 1.3 | ||
282 | 726 | } | ||
283 | 727 | """)) | ||
284 | 728 | |||
285 | 729 | def test_one_explicit_binary_apparmor_profile_file(self): | ||
286 | 730 | self.use_temp_dir() | ||
287 | 731 | scratch = os.path.join(self.temp_dir, "scratch") | ||
288 | 732 | touch(os.path.join(scratch, "bin", "foo")) | ||
289 | 733 | touch(os.path.join(scratch, "data", "icon.svg")) | ||
290 | 734 | apparmor_path = os.path.join( | ||
291 | 735 | scratch, 'path', 'to', 'cli1.apparmor-profile') | ||
292 | 736 | os.makedirs(os.path.dirname(apparmor_path)) | ||
293 | 737 | with io.open(apparmor_path, 'w', encoding='utf-8') as fp: | ||
294 | 738 | fp.write(dedent(u"""\ | ||
295 | 739 | { | ||
296 | 740 | "template": "default", | ||
297 | 741 | "policy_groups": [ | ||
298 | 742 | "networking" | ||
299 | 743 | ], | ||
300 | 744 | "policy_vendor": "ubuntu-snappy", | ||
301 | 745 | "policy_version": 88.88 | ||
302 | 746 | } | ||
303 | 747 | """)) | ||
304 | 748 | self._make_metadata(scratch, APPARMOR_4_TEMPLATE) | ||
305 | 749 | self.builder.add_file(scratch, "./") | ||
306 | 750 | # FIXME: make it a .snap | ||
307 | 751 | expected_path = os.path.join(self.temp_dir, "test-yaml_1.0_all.click") | ||
308 | 752 | actual_path = self.builder.build(self.temp_dir, "meta/package.yaml") | ||
309 | 753 | self.assertEqual(expected_path, actual_path) | ||
310 | 754 | self.assertTrue(os.path.exists(actual_path)) | ||
311 | 755 | contents = os.path.join(self.temp_dir, 'contents') | ||
312 | 756 | subprocess.check_output( | ||
313 | 757 | ["dpkg-deb", "-R", actual_path, contents], universal_newlines=True) | ||
314 | 758 | self.assertEqual(sorted(os.listdir(contents)), | ||
315 | 759 | ['DEBIAN', 'bin', 'data', 'meta', 'path']) | ||
316 | 760 | self.assertEqual( | ||
317 | 761 | sorted(os.listdir(os.path.join(contents, 'path', 'to'))), | ||
318 | 762 | ['cli1.apparmor-profile']) | ||
319 | 763 | with io.open( | ||
320 | 764 | os.path.join(contents, 'path', 'to', 'cli1.apparmor-profile'), | ||
321 | 765 | encoding='utf-8') as fp: | ||
322 | 766 | data = fp.read() | ||
323 | 767 | self.assertEqual(data, dedent("""\ | ||
324 | 768 | { | ||
325 | 769 | "template": "default", | ||
326 | 770 | "policy_groups": [ | ||
327 | 771 | "networking" | ||
328 | 772 | ], | ||
329 | 773 | "policy_vendor": "ubuntu-snappy", | ||
330 | 774 | "policy_version": 88.88 | ||
331 | 775 | } | ||
332 | 776 | """)) | ||
333 | 777 | with io.open(os.path.join(contents, 'meta', 'cli2.apparmor'), | ||
334 | 614 | encoding='utf-8') as fp: | 778 | encoding='utf-8') as fp: |
335 | 615 | data = fp.read() | 779 | data = fp.read() |
336 | 616 | self.assertEqual(data, dedent("""\ | 780 | self.assertEqual(data, dedent("""\ |
337 | 617 | 781 | ||
338 | === modified file 'click/tests/test_database.py' | |||
339 | --- click/tests/test_database.py 2014-09-10 11:54:14 +0000 | |||
340 | +++ click/tests/test_database.py 2014-12-05 21:56:27 +0000 | |||
341 | @@ -29,6 +29,7 @@ | |||
342 | 29 | from itertools import takewhile | 29 | from itertools import takewhile |
343 | 30 | import json | 30 | import json |
344 | 31 | import os | 31 | import os |
345 | 32 | import six | ||
346 | 32 | import unittest | 33 | import unittest |
347 | 33 | 34 | ||
348 | 34 | from gi.repository import Click, GLib | 35 | from gi.repository import Click, GLib |
349 | @@ -55,7 +56,7 @@ | |||
350 | 55 | "bar", "1.0", "/path/to/foo/1.0", False) | 56 | "bar", "1.0", "/path/to/foo/1.0", False) |
351 | 56 | 57 | ||
352 | 57 | def test_hash(self): | 58 | def test_hash(self): |
354 | 58 | self.assertIsInstance(self.foo.hash(), int) | 59 | self.assertIsInstance(self.foo.hash(), six.integer_types) |
355 | 59 | self.assertEqual(self.foo.hash(), self.foo_clone.hash()) | 60 | self.assertEqual(self.foo.hash(), self.foo_clone.hash()) |
356 | 60 | self.assertNotEqual(self.foo.hash(), self.foo_different_version.hash()) | 61 | self.assertNotEqual(self.foo.hash(), self.foo_different_version.hash()) |
357 | 61 | self.assertNotEqual(self.foo.hash(), self.foo_different_path.hash()) | 62 | self.assertNotEqual(self.foo.hash(), self.foo_different_path.hash()) |
358 | 62 | 63 | ||
359 | === modified file 'debian/changelog' | |||
360 | --- debian/changelog 2014-12-05 15:17:16 +0000 | |||
361 | +++ debian/changelog 2014-12-05 21:56:27 +0000 | |||
362 | @@ -1,3 +1,10 @@ | |||
363 | 1 | click (0.4.35+ppa27) vivid; urgency=medium | ||
364 | 2 | |||
365 | 3 | * Give binaries default apparmor and apparmor-profile keys in their | ||
366 | 4 | manifest when explicit profiles are not present in packages.yaml | ||
367 | 5 | |||
368 | 6 | -- Barry Warsaw <barry@ubuntu.com> Fri, 05 Dec 2014 16:53:51 -0500 | ||
369 | 7 | |||
370 | 1 | click (0.4.35+ppa26) vivid; urgency=low | 8 | click (0.4.35+ppa26) vivid; urgency=low |
371 | 2 | 9 | ||
372 | 3 | * lp:~mvo/click/lp1394256-run-user-hooks-on-remove-too: | 10 | * lp:~mvo/click/lp1394256-run-user-hooks-on-remove-too: |
The changelog entry is confusing, but it looks like the code DTRT. We should not be autogenerating the apparmor-profile key, only apparmor when apparmor and apparmor-profile aren't already present.