diff options
-rw-r--r-- | recipes-mac/AppArmor/apparmor_4.0.3.bb (renamed from recipes-mac/AppArmor/apparmor_3.1.3.bb) | 8 | ||||
-rw-r--r-- | recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch | 74 |
2 files changed, 78 insertions, 4 deletions
diff --git a/recipes-mac/AppArmor/apparmor_3.1.3.bb b/recipes-mac/AppArmor/apparmor_4.0.3.bb index 49ab7a7..06a5010 100644 --- a/recipes-mac/AppArmor/apparmor_3.1.3.bb +++ b/recipes-mac/AppArmor/apparmor_4.0.3.bb | |||
@@ -11,17 +11,18 @@ SECTION = "admin" | |||
11 | LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & LGPL-2.1-or-later" | 11 | LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & LGPL-2.1-or-later" |
12 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0" | 12 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0" |
13 | 13 | ||
14 | DEPENDS = "bison-native apr gettext-native coreutils-native swig-native" | 14 | DEPENDS = "bison-native apr autoconf-archive-native gettext-native coreutils-native swig-native" |
15 | 15 | ||
16 | SRC_URI = " \ | 16 | SRC_URI = " \ |
17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-3.1 \ | 17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-4.0 \ |
18 | file://run-ptest \ | 18 | file://run-ptest \ |
19 | file://crosscompile_perl_bindings.patch \ | 19 | file://crosscompile_perl_bindings.patch \ |
20 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ | 20 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ |
21 | file://0001-Makefile-fix-hardcoded-installation-directories.patch \ | 21 | file://0001-Makefile-fix-hardcoded-installation-directories.patch \ |
22 | file://0001-fail.py-handle-missing-cgitb.patch \ | ||
22 | " | 23 | " |
23 | 24 | ||
24 | SRCREV = "e69cb5047946818e6a9df326851483bb075a5cfe" | 25 | SRCREV = "b4dfdf50f50ed1d64161424d036a2453645f0cfe" |
25 | S = "${UNPACKDIR}/git" | 26 | S = "${UNPACKDIR}/git" |
26 | 27 | ||
27 | PARALLEL_MAKE = "" | 28 | PARALLEL_MAKE = "" |
@@ -106,7 +107,6 @@ do_install () { | |||
106 | chown root:root -R ${D}/${datadir}/apparmor | 107 | chown root:root -R ${D}/${datadir}/apparmor |
107 | 108 | ||
108 | find ${D}${libdir}/perl5/ -type f -name ".packlist" -delete | 109 | find ${D}${libdir}/perl5/ -type f -name ".packlist" -delete |
109 | find ${D}${PYTHON_SITEPACKAGES_DIR}/LibAppArmor/ -type f -name "_LibAppArmor*.so" -delete | ||
110 | } | 110 | } |
111 | 111 | ||
112 | #Building ptest on arm fails. | 112 | #Building ptest on arm fails. |
diff --git a/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch b/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch new file mode 100644 index 0000000..28c1d9e --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch | |||
@@ -0,0 +1,74 @@ | |||
1 | From 434e34bb510b4cab04e64cd5b21d635c6be8c8ea Mon Sep 17 00:00:00 2001 | ||
2 | From: Mikko Rapeli <mikko.rapeli@linaro.org> | ||
3 | Date: Fri, 29 Nov 2024 13:46:32 +0000 | ||
4 | Subject: [PATCH] fail.py: handle missing cgitb | ||
5 | |||
6 | It's no longer in python standard library starting | ||
7 | at version 3.13. Fixes: | ||
8 | |||
9 | root@qemuarm64:~# aa-complain /etc/apparmor.d/* | ||
10 | Traceback (most recent call last): | ||
11 | File "/usr/sbin/aa-complain", line 18, in <module> | ||
12 | from apparmor.fail import enable_aa_exception_handler | ||
13 | File "/usr/lib/python3.13/site-packages/apparmor/fail.py", line 12, in <module> | ||
14 | import cgitb | ||
15 | ModuleNotFoundError: No module named 'cgitb' | ||
16 | |||
17 | Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> | ||
18 | --- | ||
19 | utils/apparmor/fail.py | 25 +++++++++++++++---------- | ||
20 | 1 file changed, 15 insertions(+), 10 deletions(-) | ||
21 | |||
22 | Upstream-Status: Backport | ||
23 | |||
24 | diff --git a/utils/apparmor/fail.py b/utils/apparmor/fail.py | ||
25 | index ece6efc4..a71ceb66 100644 | ||
26 | --- a/utils/apparmor/fail.py | ||
27 | +++ b/utils/apparmor/fail.py | ||
28 | @@ -8,7 +8,11 @@ | ||
29 | # | ||
30 | # ------------------------------------------------------------------ | ||
31 | |||
32 | -import cgitb | ||
33 | +try: | ||
34 | + import cgitb | ||
35 | +except ImportError: | ||
36 | + cgitb = None | ||
37 | + pass | ||
38 | import sys | ||
39 | import traceback | ||
40 | from tempfile import NamedTemporaryFile | ||
41 | @@ -32,20 +36,21 @@ def handle_exception(*exc_info): | ||
42 | print('', file=sys.stderr) | ||
43 | error(ex.value) | ||
44 | else: | ||
45 | - with NamedTemporaryFile('w', prefix='apparmor-bugreport-', suffix='.txt', delete=False) as file: | ||
46 | - cgitb_hook = cgitb.Hook(display=1, file=file, format='text', context=10) | ||
47 | - cgitb_hook.handle(exc_info) | ||
48 | - | ||
49 | - file.write('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues\n') | ||
50 | - file.write('and attach this file.\n') | ||
51 | + if cgitb: | ||
52 | + with NamedTemporaryFile('w', prefix='apparmor-bugreport-', suffix='.txt', delete=False) as file: | ||
53 | + cgitb_hook = cgitb.Hook(display=1, file=file, format='text', context=10) | ||
54 | + cgitb_hook.handle(exc_info) | ||
55 | + file.write('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues\n') | ||
56 | + file.write('and attach this file.\n') | ||
57 | |||
58 | print(''.join(traceback.format_exception(*exc_info)), file=sys.stderr) | ||
59 | - print('', file=sys.stderr) | ||
60 | print('An unexpected error occurred!', file=sys.stderr) | ||
61 | print('', file=sys.stderr) | ||
62 | - print('For details, see %s' % file.name, file=sys.stderr) | ||
63 | + if cgitb: | ||
64 | + print('For details, see %s' % file.name, file=sys.stderr) | ||
65 | print('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues', file=sys.stderr) | ||
66 | - print('and attach this file.', file=sys.stderr) | ||
67 | + if cgitb: | ||
68 | + print('and attach this file.', file=sys.stderr) | ||
69 | |||
70 | |||
71 | def enable_aa_exception_handler(): | ||
72 | -- | ||
73 | 2.43.0 | ||
74 | |||