mirror of
https://github.com/openwrt/packages.git
synced 2025-12-23 08:04:32 +04:00
selinux-python: Update to 3.5, reorganize package
* Added packages:
* python3-seobject
Contains the seobject.py library file which was previously included
in selinux-semanage
* selinux-sepolicy
Contains the sepolicy and sepolgen tools which were previously
included in python3-sepolicy
* selinux-sepolgen-ifgen
Contains the sepolgen-ifgen tool which was previously included in
selinux-audit2allow
* selinux-python
A meta-package to install all tools
* Change the python3-sepolgen data_dir from /usr/share/sepolgen to
/etc/sepolgen (updated 0001-sepolgen-adjust-data_dir.patch), and add
the directory to conffiles
By default, the sepolgen-ifgen tool writes to a file named
"interface_info" in the data directory, to be read by the audit2allow
tool. The header comment in the perm_map file also suggests that the
file is customizable.
The best place for these files would be in /var/lib, but /etc is more
appropriate than /usr.
* Remove gui files from python3-sepolicy (0003-sepolicy-no-gui.patch)
* Fix ModuleNotFoundError raised by sepolicy
(0004-sepolicy-fix-get_os_version-except.patch)
Patch has been submitted upstream:
https://lore.kernel.org/selinux/20230619063217.3165462-1-jeffery.to@gmail.com/
* Update package titles, descriptions, and dependencies
* Use Py3Package to build Python bytecode and source packages
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit 6bd71dac0c)
This commit is contained in:
@@ -4,6 +4,8 @@ Date: Wed, 2 Oct 2019 12:04:24 +0200
|
||||
Subject: [PATCH] sepolgen: adjust data_dir()
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
(changed data_dir prefix from /usr/share to /etc)
|
||||
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
|
||||
---
|
||||
sepolgen/src/sepolgen/defaults.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
@@ -15,7 +17,7 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
|
||||
def data_dir():
|
||||
- return "/var/lib/sepolgen"
|
||||
+ return "/usr/share/sepolgen"
|
||||
+ return "/etc/sepolgen"
|
||||
|
||||
def perm_map():
|
||||
return data_dir() + "/perm_map"
|
||||
|
||||
23
utils/selinux-python/patches/0003-sepolicy-no-gui.patch
Normal file
23
utils/selinux-python/patches/0003-sepolicy-no-gui.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
--- a/sepolicy/sepolicy.py
|
||||
+++ b/sepolicy/sepolicy.py
|
||||
@@ -685,7 +685,6 @@ if __name__ == '__main__':
|
||||
gen_booleans_args(subparsers)
|
||||
gen_communicate_args(subparsers)
|
||||
gen_generate_args(subparsers)
|
||||
- gen_gui_args(subparsers)
|
||||
gen_interface_args(subparsers)
|
||||
gen_manpage_args(subparsers)
|
||||
gen_network_args(subparsers)
|
||||
--- a/sepolicy/setup.py
|
||||
+++ b/sepolicy/setup.py
|
||||
@@ -13,10 +13,5 @@ setup(
|
||||
packages=[
|
||||
"sepolicy",
|
||||
"sepolicy.templates",
|
||||
- "sepolicy.help"
|
||||
],
|
||||
- package_data={
|
||||
- 'sepolicy': ['*.glade'],
|
||||
- 'sepolicy.help': ['*.txt', '*.png']
|
||||
- }
|
||||
)
|
||||
@@ -0,0 +1,39 @@
|
||||
commit 80ba6c49dec9c2c48775e70a4d4564ba5e59eea1
|
||||
Author: Jeffery To <jeffery.to@gmail.com>
|
||||
Date: Mon Jun 19 14:15:45 2023 +0800
|
||||
|
||||
python/sepolicy: Fix get_os_version except clause
|
||||
|
||||
This adds more exceptions to be handled by the except clause in
|
||||
`get_os_version()`:
|
||||
|
||||
* If the `distro` package is not installed, then `import distro` raises
|
||||
a `ModuleNotFoundError` exception.
|
||||
|
||||
* The distro documentation[1] lists `OSError` and `UnicodeError` as
|
||||
exceptions that can be raised.
|
||||
|
||||
* Older versions of distro (<= 1.6.0) may also raise
|
||||
`subprocessCalledProcessError`[2].
|
||||
|
||||
[1]: https://github.com/python-distro/distro/blob/v1.8.0/src/distro/distro.py#L749-L753
|
||||
[2]: https://github.com/python-distro/distro/blob/v1.6.0/distro.py#L726-L728
|
||||
|
||||
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
|
||||
|
||||
--- a/sepolicy/sepolicy/__init__.py
|
||||
+++ b/sepolicy/sepolicy/__init__.py
|
||||
@@ -1240,11 +1240,12 @@ def boolean_desc(boolean):
|
||||
|
||||
|
||||
def get_os_version():
|
||||
+ import subprocess
|
||||
system_release = ""
|
||||
try:
|
||||
import distro
|
||||
system_release = distro.name(pretty=True)
|
||||
- except IOError:
|
||||
+ except (ModuleNotFoundError, OSError, IOError, UnicodeError, subprocess.CalledProcessError):
|
||||
system_release = "Misc"
|
||||
|
||||
return system_release
|
||||
8
utils/selinux-python/patches/0005-no-translations.patch
Normal file
8
utils/selinux-python/patches/0005-no-translations.patch
Normal file
@@ -0,0 +1,8 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,4 +1,4 @@
|
||||
-SUBDIRS = sepolicy audit2allow semanage sepolgen chcat po
|
||||
+SUBDIRS = sepolicy audit2allow semanage sepolgen chcat
|
||||
|
||||
all install relabel clean indent test:
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
Reference in New Issue
Block a user