From d78e4b3b20c438adc53549ada31ec36c0126b19a Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Mon, 12 Jun 2023 18:29:10 +0200 Subject: [PATCH] sys-apps/policycoreutils: sync with Gentoo Commit-Ref: https://github.com/gentoo/gentoo/commit/ea4cd1f216e407735528c92434b83313e4b8a8db Signed-off-by: Mathieu Tortuyaux --- .../sys-apps/policycoreutils/Manifest | 3 +- .../sys-apps/policycoreutils/metadata.xml | 2 +- .../policycoreutils-3.1-r4.ebuild | 224 ------------------ ...2-r1.ebuild => policycoreutils-3.5.ebuild} | 32 ++- .../policycoreutils-9999.ebuild | 32 ++- 5 files changed, 40 insertions(+), 253 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.1-r4.ebuild rename sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/{policycoreutils-3.2-r1.ebuild => policycoreutils-3.5.ebuild} (87%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/Manifest index c58464335d..cfc08315c2 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/Manifest @@ -1,3 +1,2 @@ -DIST policycoreutils-3.1.tar.gz 2817914 BLAKE2B ef68bb5f9cf577164ead44803b6be2bd6401c9e923d2c775c7c8c47f0e803749feaec4247fec5cc1cb766314954402fd2506370bb397f746437ecfcf65b384f3 SHA512 0592f218563a99ba95d2cfd07fdc3761b61c1cc3c01a17ab89ad840169e1a7d4083521d5cacc72d1b76911d516bf592db7a3f90d9ef0cc11ceed007e4580e140 +DIST policycoreutils-3.5.tar.gz 775639 BLAKE2B 777b8564484e89385db7a184c4cad9a99aabf1fd1ac41abd5826c7e6ad29118ae9d6f0d0fd968b6ced87f2f04bc6d7cd207b67428151522915367f656fb8d3f8 SHA512 7978ef6b7a278c6384c9b397734d03c4932c8aefecceaa1e6a1345be27b253dbe276fdcd219ce83ad732c6ed55d53bbc3254e39bccadd67d2cd1152a14749444 DIST policycoreutils-extra-1.37.tar.bz2 8809 BLAKE2B a7f6122c2e27f54b018174e962bd7f4c14af04e09bbb5300bde6967ea7f2dc5cd03b5787919a4e7f5288bcbc6747922962b5bd3b588ab1e3a035fbff4910d8f5 SHA512 0a85cd7cf279256b5e1927f9dfdd89626a1c8b77b0aeb62b496e7e8d1dccbaa315e39f9308fb2df7270f0bc1c10787b19990e7365cad74b47b61e30394c8b23f -DIST policycoreutils-3.2.tar.gz 2817961 BLAKE2B 747cbd7b84ffa9153067340f8f1dc5a652eaf85b037a6e10e116d3d0b31c8e7c9794bc6a46ae212848bef4887478ac167e359a387bebac49e0acd08b727808ce SHA512 d16781d2d61b8b78d6fc242f2b5c3a03f47ea524fb61655823b6b0f0327ff376c65fe7bdf7a53f5863c01e599cf4a7050f21fda0fe6a8f2c2c16f89b156a4346 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/metadata.xml b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/metadata.xml index 16effc34b8..4d3c72d81d 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/metadata.xml +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/metadata.xml @@ -1,5 +1,5 @@ - + selinux@gentoo.org diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.1-r4.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.1-r4.ebuild deleted file mode 100644 index 9b71258245..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.1-r4.ebuild +++ /dev/null @@ -1,224 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -PYTHON_COMPAT=( python3_{6..11} ) -PYTHON_REQ_USE="xml(+)" - -inherit multilib python-r1 toolchain-funcs bash-completion-r1 - -MY_P="${P//_/-}" - -MY_RELEASEDATE="20200710" -EXTRAS_VER="1.37" -SEMNG_VER="${PV}" -SELNX_VER="${PV}" -SEPOL_VER="${PV}" - -# flatcar changes: nls, extra -IUSE="audit extra nls pam python split-usr" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - -DESCRIPTION="SELinux core utilities" -HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki" - -if [[ ${PV} == 9999 ]]; then - inherit git-r3 - EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git" - SRC_URI="https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - S1="${WORKDIR}/${MY_P}/${PN}" - S2="${WORKDIR}/policycoreutils-extra" - S="${S1}" -else - SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz - https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - KEYWORDS="amd64 ~arm64 ~mips x86" - S1="${WORKDIR}/${MY_P}" - S2="${WORKDIR}/policycoreutils-extra" - S="${S1}" -fi - -LICENSE="GPL-2" -SLOT="0" - -# flatcar changes: remove setools. Since 4.x setools is written in python -# so it's not shipped anymore with Flatcar OS -DEPEND=">=sys-libs/libselinux-${SELNX_VER}:=[python?,${PYTHON_USEDEP}] - >=sys-libs/libsemanage-${SEMNG_VER}:=[python?,${PYTHON_USEDEP}] - >=sys-libs/libsepol-${SEPOL_VER}:= - sys-libs/libcap-ng:= - audit? ( >=sys-process/audit-1.5.1[python?,${PYTHON_USEDEP}] ) - pam? ( sys-libs/pam:= ) - python? ( ${PYTHON_DEPS} )" - -# Avoid dependency loop in the cross-compile case, bug #755173 -# (Still exists in native) -BDEPEND="sys-devel/gettext" - -# pax-utils for scanelf used by rlpkg -RDEPEND="${DEPEND} - app-misc/pax-utils" - -PDEPEND="sys-apps/semodule-utils - python? ( sys-apps/selinux-python )" - -src_unpack() { - # Override default one because we need the SRC_URI ones even in case of 9999 ebuilds - default - if [[ ${PV} == 9999 ]] ; then - git-r3_src_unpack - fi -} - -src_prepare() { - S="${S1}" - cd "${S}" || die "Failed to switch to ${S}" - if [[ ${PV} != 9999 ]] ; then - # If needed for live ebuilds please use /etc/portage/patches - eapply "${FILESDIR}/policycoreutils-3.1-0001-newrole-not-suid.patch" - fi - - # rlpkg is more useful than fixfiles - sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \ - || die "fixfiles sed 1 failed" - sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \ - || die "fixfiles sed 2 failed" - - eapply_user - - sed -i 's/-Werror//g' "${S1}"/*/Makefile || die "Failed to remove Werror" - - # flatcar changes - if use python; then - python_copy_sources - # Our extra code is outside the regular directory, so set it to the extra - # directory. We really should optimize this as it is ugly, but the extra - # code is needed for Gentoo at the same time that policycoreutils is present - # (so we cannot use an additional package for now). - if use extra ; then - S="${S2}" - python_copy_sources - fi - fi - - # flatcar changes - # Skip building unneeded parts. - if ! use python ; then - for dir in audit2allow gui scripts semanage sepolicy sepolgen-ifgen; do - sed -e "s/ $dir / /" -i Makefile || die - done - fi - use nls || sed -e "s/ po / /" -i Makefile || die -} - -src_compile() { - building() { - emake -C "${BUILD_DIR}" \ - AUDIT_LOG_PRIVS="y" \ - AUDITH="$(usex audit y n)" \ - PAMH="$(usex pam y n)" \ - SESANDBOX="n" \ - CC="$(tc-getCC)" \ - LIBDIR="\$(PREFIX)/$(get_libdir)" - } - - # flatcar changes - if use python; then - S="${S1}" # Regular policycoreutils - python_foreach_impl building - if use extra ; then - S="${S2}" # Extra set - python_foreach_impl building - fi - else - BUILD_DIR="${S1}" - building - if use extra ; then - BUILD_DIR="${S2}" - building - fi - fi -} - -src_install() { - # Python scripts are present in many places. There are no extension modules. - installation-policycoreutils() { - einfo "Installing policycoreutils" - emake -C "${BUILD_DIR}" DESTDIR="${D}" \ - AUDIT_LOG_PRIVS="y" \ - AUDITH="$(usex audit y n)" \ - PAMH="$(usex pam y n)" \ - SESANDBOX="n" \ - CC="$(tc-getCC)" \ - LIBDIR="\$(PREFIX)/$(get_libdir)" \ - install - # flatcar changes - if use python; then - python_optimize - fi - } - - installation-extras() { - einfo "Installing policycoreutils-extra" - emake -C "${BUILD_DIR}" \ - DESTDIR="${D}" \ - SHLIBDIR="${D}$(get_libdir)/rc" \ - install - # flatcar changes - if use python; then - python_optimize - fi - } - - # flatcar changes - if use python; then - S="${S1}" # policycoreutils - python_foreach_impl installation-policycoreutils - if use extra ; then - S="${S2}" - installation-extras - S="${S1}" # back for later - fi - else - BUILD_DIR="${S1}" - installation-policycoreutils - if use extra ; then - BUILD_DIR="${S2}" - installation-extras - fi - fi - - # remove redhat-style init script - rm -fR "${D}/etc/rc.d" || die - - # compatibility symlinks - use split-usr && dosym ../../sbin/setfiles /usr/sbin/setfiles - - bashcomp_alias setsebool getsebool - - # location for policy definitions - # flatcar changes: - dodir /usr/lib/selinux/policy - dosym ../../usr/lib/selinux/policy /var/lib/selinux - keepdir /usr/lib/selinux/policy - - # Set version-specific scripts - # flatcar changes - if use python; then - # Set version-specific scripts - for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do - python_replicate_script "${ED}/usr/bin/${pyscript}" - done - python_replicate_script "${ED}/usr/sbin/semanage" - use extra && python_replicate_script "${ED}/usr/sbin/rlpkg" - fi -} - -pkg_postinst() { - for POLICY_TYPE in ${POLICY_TYPES} ; do - # There have been some changes to the policy store, rebuilding now. - # https://marc.info/?l=selinux&m=143757277819717&w=2 - einfo "Rebuilding store ${POLICY_TYPE} in '${ROOT:-/}' (without re-loading)." - semodule -p "${ROOT:-/}" -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}" - done -} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.2-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.5.ebuild similarity index 87% rename from sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.2-r1.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.5.ebuild index 8ef2854fbb..5d45077b38 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.2-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-3.5.ebuild @@ -1,17 +1,16 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" -PYTHON_COMPAT=( python3_{6..10} ) -PYTHON_REQ_USE="xml" +PYTHON_COMPAT=( python3_{9..11} ) +PYTHON_REQ_USE="xml(+)" inherit multilib python-r1 toolchain-funcs bash-completion-r1 +MY_PV="${PV//_/-}" +MY_P="${PN}-${MY_PV}" EXTRAS_VER="1.37" -IUSE="audit pam split-usr" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - DESCRIPTION="SELinux core utilities" HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki" @@ -19,20 +18,22 @@ if [[ ${PV} == 9999 ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git" SRC_URI="https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - S1="${WORKDIR}/${PN}" + S1="${WORKDIR}/${P}/${PN}" S2="${WORKDIR}/policycoreutils-extra" S="${S1}" else - SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${PV}/${P}.tar.gz + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_PV}/${MY_P}.tar.gz https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - KEYWORDS="~amd64 ~arm64 ~mips ~x86" - S1="${WORKDIR}/${P}" + KEYWORDS="amd64 arm arm64 ~mips x86" + S1="${WORKDIR}/${MY_P}" S2="${WORKDIR}/policycoreutils-extra" S="${S1}" fi LICENSE="GPL-2" SLOT="0" +IUSE="audit pam split-usr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" DEPEND=">=sys-libs/libselinux-${PV}:=[python,${PYTHON_USEDEP}] >=sys-libs/libsemanage-${PV}:=[python(+),${PYTHON_USEDEP}] @@ -138,7 +139,12 @@ src_install() { rm -fR "${D}/etc/rc.d" || die # compatibility symlinks - use split-usr && dosym ../../sbin/setfiles /usr/sbin/setfiles + if use split-usr; then + dosym ../../sbin/setfiles /usr/sbin/setfiles + else + # remove sestatus symlink + rm -f "${D}"/usr/sbin/sestatus || die + fi bashcomp_alias setsebool getsebool @@ -156,7 +162,7 @@ pkg_postinst() { for POLICY_TYPE in ${POLICY_TYPES} ; do # There have been some changes to the policy store, rebuilding now. # https://marc.info/?l=selinux&m=143757277819717&w=2 - einfo "Rebuilding store ${POLICY_TYPE} (without re-loading)." - semodule -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}" + einfo "Rebuilding store ${POLICY_TYPE} in '${ROOT:-/}' (without re-loading)." + semodule -p "${ROOT:-/}" -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}" done } diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-9999.ebuild index 8ef2854fbb..6df44f548c 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/policycoreutils/policycoreutils-9999.ebuild @@ -1,17 +1,16 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" -PYTHON_COMPAT=( python3_{6..10} ) -PYTHON_REQ_USE="xml" +PYTHON_COMPAT=( python3_{9..11} ) +PYTHON_REQ_USE="xml(+)" inherit multilib python-r1 toolchain-funcs bash-completion-r1 +MY_PV="${PV//_/-}" +MY_P="${PN}-${MY_PV}" EXTRAS_VER="1.37" -IUSE="audit pam split-usr" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - DESCRIPTION="SELinux core utilities" HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki" @@ -19,20 +18,22 @@ if [[ ${PV} == 9999 ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git" SRC_URI="https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - S1="${WORKDIR}/${PN}" + S1="${WORKDIR}/${P}/${PN}" S2="${WORKDIR}/policycoreutils-extra" S="${S1}" else - SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${PV}/${P}.tar.gz + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_PV}/${MY_P}.tar.gz https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" - KEYWORDS="~amd64 ~arm64 ~mips ~x86" - S1="${WORKDIR}/${P}" + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86" + S1="${WORKDIR}/${MY_P}" S2="${WORKDIR}/policycoreutils-extra" S="${S1}" fi LICENSE="GPL-2" SLOT="0" +IUSE="audit pam split-usr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" DEPEND=">=sys-libs/libselinux-${PV}:=[python,${PYTHON_USEDEP}] >=sys-libs/libsemanage-${PV}:=[python(+),${PYTHON_USEDEP}] @@ -138,7 +139,12 @@ src_install() { rm -fR "${D}/etc/rc.d" || die # compatibility symlinks - use split-usr && dosym ../../sbin/setfiles /usr/sbin/setfiles + if use split-usr; then + dosym ../../sbin/setfiles /usr/sbin/setfiles + else + # remove sestatus symlink + rm -f "${D}"/usr/sbin/sestatus || die + fi bashcomp_alias setsebool getsebool @@ -156,7 +162,7 @@ pkg_postinst() { for POLICY_TYPE in ${POLICY_TYPES} ; do # There have been some changes to the policy store, rebuilding now. # https://marc.info/?l=selinux&m=143757277819717&w=2 - einfo "Rebuilding store ${POLICY_TYPE} (without re-loading)." - semodule -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}" + einfo "Rebuilding store ${POLICY_TYPE} in '${ROOT:-/}' (without re-loading)." + semodule -p "${ROOT:-/}" -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}" done }