Diff selinux-python-3.7-r1 with a selinux-python-9999

/usr/portage/sys-apps/selinux-python/selinux-python-9999.ebuild 2025-12-26 10:18:09.616174660 +0300
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI="8"
5
PYTHON_COMPAT=( python3_{10..12} )
5

  
6
DISTUTILS_USE_PEP517=setuptools
7
PYTHON_COMPAT=( python3_{11..13} )
6 8
PYTHON_REQ_USE="xml(+)"
7 9

  
8
inherit python-r1 toolchain-funcs
10
inherit distutils-r1 toolchain-funcs
9 11

  
10 12
MY_PV="${PV//_/-}"
11 13
MY_P="${PN}-${MY_PV}"
......
19 21
	S="${WORKDIR}/${P}/${PN#selinux-}"
20 22
else
21 23
	SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_PV}/${MY_P}.tar.gz"
22
	KEYWORDS="amd64 arm arm64 ~riscv x86"
24
	KEYWORDS="~amd64 ~arm ~arm64 ~x86"
23 25
	S="${WORKDIR}/${MY_P}"
24 26
fi
25 27

  
......
27 29
SLOT="0"
28 30
IUSE="test"
29 31
RESTRICT="!test? ( test )"
30
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
31 32

  
32 33
RDEPEND=">=sys-libs/libselinux-${PV}:=[python]
33 34
	>=sys-libs/libsemanage-${PV}:=[python(+)]
34 35
	>=sys-libs/libsepol-${PV}:=[static-libs(+)]
35 36
	>=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
36
	>=sys-process/audit-1.5.1[python,${PYTHON_USEDEP}]
37
	${PYTHON_DEPS}"
37
	>=sys-process/audit-1.5.1[python,${PYTHON_USEDEP}]"
38 38
DEPEND="${RDEPEND}"
39 39
BDEPEND="
40 40
	test? (
......
43 43
		>=sys-apps/secilc-${PV}
44 44
	)"
45 45

  
46
PATCHES=(
47
	"${FILESDIR}"/selinux-python-3.8.1-no-pip.patch
48
)
49

  
46 50
src_prepare() {
47 51
	default
48
	sed -i 's/-Werror//g' "${S}"/*/Makefile || die "Failed to remove Werror"
49 52

  
50
	python_copy_sources
53
	sed -e 's/-Werror//g' -i "${S}"/*/Makefile || die "Failed to remove Werror"
54

  
55
	pushd sepolicy >/dev/null || die
56
	# To avoid default
57
	DISTUTILS_OPTIONAL=1 distutils-r1_src_prepare
58
	popd >/dev/null || die
59
}
60

  
61
python_compile() {
62
	distutils-r1_python_compile
63
	emake -C "${S}" \
64
		CC="$(tc-getCC)" \
65
		LIBDIR="\$(PREFIX)/$(get_libdir)"
51 66
}
52 67

  
53 68
src_compile() {
54
	building() {
55
		emake -C "${BUILD_DIR}" \
56
			CC="$(tc-getCC)" \
57
			LIBDIR="\$(PREFIX)/$(get_libdir)"
58
	}
59
	python_foreach_impl building
69
	pushd sepolicy >/dev/null || die
70
	distutils-r1_src_compile
71
	popd >/dev/null || die
72
}
73

  
74
python_test() {
75
	# The different subprojects have some interproject dependencies:
76
	# - audit2allow depens on sepolgen
77
	# - chcat depends on semanage
78
	# and maybe others.
79
	# Add all the modules of the individual subprojects to the
80
	# PYTHONPATH, so they get actually found and used. In
81
	# particular, already installed versions on the system are not
82
	# used.
83
	for dir in audit2allow chcat semanage sepolgen/src sepolicy ; do
84
		PYTHONPATH="${S}/${dir}:${PYTHONPATH}"
85
	done
86
	PYTHONPATH=${PYTHONPATH} emake -C "${S}" test
60 87
}
61 88

  
62 89
src_test() {
63
	testing() {
64
		# The different subprojects have some interproject dependencies:
65
		# - audit2allow depens on sepolgen
66
		# - chcat depends on semanage
67
		# and maybe others.
68
		# Add all the modules of the individual subprojects to the
69
		# PYTHONPATH, so they get actually found and used. In
70
		# particular, already installed versions on the system are not
71
		# used.
72
		for dir in audit2allow chcat semanage sepolgen/src sepolicy ; do
73
			PYTHONPATH="${BUILD_DIR}/${dir}:${PYTHONPATH}"
74
		done
75
		PYTHONPATH=${PYTHONPATH} \
76
			emake -C "${BUILD_DIR}" \
77
				test
78
	}
79
	python_foreach_impl testing
90
	pushd sepolicy >/dev/null || die
91
	distutils-r1_src_test
92
	popd >/dev/null || die
80 93
}
81 94

  
82
src_install() {
83
	installation() {
84
		emake -C "${BUILD_DIR}" \
85
			DESTDIR="${D}" \
86
			LIBDIR="\$(PREFIX)/$(get_libdir)" \
87
			install
88
		python_optimize
89
	}
90
	python_foreach_impl installation
91

  
92
	# Set version-specific scripts
93
	for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do
94
		python_replicate_script "${ED}/usr/bin/${pyscript}"
95
	done
96
	for pyscript in semanage; do
97
		python_replicate_script "${ED}/usr/sbin/${pyscript}"
98
	done
95
python_install() {
96
	distutils-r1_python_install
97
	emake -C "${S}" \
98
		DESTDIR="${D}" \
99
		LIBDIR="\$(PREFIX)/$(get_libdir)" \
100
		install
101

  
102
	# Install over previously installed scripts to ensure proper python support
103
	python_doscript "${S}"/audit2allow/audit2allow
104
	python_doscript "${S}"/audit2allow/sepolgen-ifgen
105
	python_doscript "${S}"/chcat/chcat
106
	python_newscript "${S}"/sepolicy/sepolicy.py sepolicy
107

  
108
	python_scriptinto /usr/sbin
109
	python_doscript "${S}"/semanage/semanage
99 110

  
111
	# set _PYTHON_SCRIPTROOT to the implicit default for the next python target, bug #967869
112
	python_scriptinto /usr/bin
113

  
114
	python_optimize
115
}
116

  
117
python_install_all() {
100 118
	# Create sepolgen.conf with different devel location definition
101 119
	mkdir -p "${D}"/etc/selinux || die "Failed to create selinux directory";
102 120
	if [[ -f /etc/selinux/config ]];
......
116 134
		fi
117 135
	fi
118 136
}
137

  
138
src_install() {
139
	pushd sepolicy >/dev/null || die
140
	distutils-r1_src_install
141
	popd >/dev/null || die
142
}
Thank you!