From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7F86715800A for ; Wed, 2 Aug 2023 06:40:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B8EDFE0B35; Wed, 2 Aug 2023 06:40:12 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A0461E0B35 for ; Wed, 2 Aug 2023 06:40:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D2E45340AC0 for ; Wed, 2 Aug 2023 06:40:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3A0FFEB2 for ; Wed, 2 Aug 2023 06:40:10 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1690958391.be37f979f5f838c8a4039aaba379a3e373af0b6f.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/portage/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/portage/portage-9999.ebuild X-VCS-Directories: sys-apps/portage/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: be37f979f5f838c8a4039aaba379a3e373af0b6f X-VCS-Branch: master Date: Wed, 2 Aug 2023 06:40:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 07c5a7ed-6877-4210-935e-9aea60cf66e3 X-Archives-Hash: 81cfe8b05ebe90c7bd4227da31b143a0 commit: be37f979f5f838c8a4039aaba379a3e373af0b6f Author: James Le Cuirot gentoo org> AuthorDate: Sat Jul 29 16:00:31 2023 +0000 Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:39:51 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be37f979 sys-apps/portage: Migrate 9999 to use Meson Bug: https://bugs.gentoo.org/910035 Signed-off-by: James Le Cuirot gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/32098 Signed-off-by: Sam James gentoo.org> sys-apps/portage/portage-9999.ebuild | 187 +++++++++++------------------------ 1 file changed, 58 insertions(+), 129 deletions(-) diff --git a/sys-apps/portage/portage-9999.ebuild b/sys-apps/portage/portage-9999.ebuild index a322e5529936..1db60a413dba 100644 --- a/sys-apps/portage/portage-9999.ebuild +++ b/sys-apps/portage/portage-9999.ebuild @@ -3,13 +3,11 @@ EAPI=7 -DISTUTILS_EXT=1 PYTHON_COMPAT=( pypy3 python3_{10..12} ) PYTHON_REQ_USE='bzip2(+),threads(+)' -SETUPTOOLS_USE_DISTUTILS=local TMPFILES_OPTIONAL=1 -inherit distutils-r1 linux-info toolchain-funcs tmpfiles prefix +inherit meson linux-info python-r1 tmpfiles DESCRIPTION="The package management and distribution system for Gentoo" HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage" @@ -28,13 +26,19 @@ fi LICENSE="GPL-2" SLOT="0" IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" RESTRICT="!test? ( test )" +# setuptools is still needed as a workaround for Python 3.12+ for now. +# https://github.com/mesonbuild/meson/issues/7702 + BDEPEND=" - dev-python/setuptools[${PYTHON_USEDEP}] + ${PYTHON_DEPS} + python_targets_python3_12? ( dev-python/setuptools[${PYTHON_USEDEP}] ) test? ( dev-vcs/git ) " DEPEND=" + ${PYTHON_DEPS} >=app-arch/tar-1.27 dev-lang/python-exec:2 >=sys-apps/sed-4.0.5 sys-devel/patch @@ -51,6 +55,7 @@ DEPEND=" # Require sandbox-2.2 for bug #288863. # For whirlpool hash, require python[ssl] (bug #425046). RDEPEND=" + ${PYTHON_DEPS} acct-user/portage app-arch/zstd >=app-arch/tar-1.27 @@ -90,154 +95,78 @@ PDEPEND=" ) " -distutils_enable_tests pytest - pkg_pretend() { local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS" - if use native-extensions && tc-is-cross-compiler; then - einfo "Disabling USE=native-extensions for cross-compilation (bug #612158)" - fi - check_extra_config } -python_prepare_all() { - distutils-r1_python_prepare_all - - if [[ ${PV} != 9999 ]] ; then - sed -e "s:^VERSION = \"HEAD\"$:VERSION = \"${PV}\":" -i lib/portage/__init__.py || die - fi - - if use gentoo-dev; then - einfo "Disabling --dynamic-deps by default for gentoo-dev..." - sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \ - -i lib/_emerge/create_depgraph_params.py || \ - die "failed to patch create_depgraph_params.py" - - einfo "Enabling additional FEATURES for gentoo-dev..." - echo 'FEATURES="${FEATURES} ipc-sandbox network-sandbox strict-keepdir warn-on-large-env"' \ - >> cnf/make.globals || die - fi +src_prepare() { + default - if use native-extensions && ! tc-is-cross-compiler; then - printf "[build_ext]\nportage_ext_modules=true\n" >> \ - setup.cfg || die - fi - - if ! use ipc ; then - einfo "Disabling ipc..." - sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ - -i lib/_emerge/AbstractEbuildProcess.py || \ - die "failed to patch AbstractEbuildProcess.py" - fi - - if use xattr && use kernel_linux ; then - einfo "Adding FEATURES=xattr to make.globals ..." - echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ - || die "failed to append to make.globals" - fi - - if use build || ! use rsync-verify; then - sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \ - -e '/^sync-webrsync-verify-signature/s|yes|no|' \ + if use prefix-guest; then + sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ + -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ + -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \ -i cnf/repos.conf || die "sed failed" fi +} - if [[ -n ${EPREFIX} ]] ; then - einfo "Setting portage.const.EPREFIX ..." - hprefixify -e "s|^(EPREFIX[[:space:]]*=[[:space:]]*\").*|\1${EPREFIX}\"|" \ - -w "/_BINARY/" lib/portage/const.py - - einfo "Prefixing shebangs ..." - > "${T}/shebangs" || die - while read -r -d $'\0' ; do - local shebang=$(head -n1 "$REPLY") - if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then - echo "${REPLY}" >> "${T}/shebangs" || die - fi - done < <(find . -type f -executable ! -name etc-update -print0) - - if [[ -s ${T}/shebangs ]]; then - xargs sed -i -e "1s:^#!:#!${EPREFIX}:" < "${T}/shebangs" || die "sed failed" - fi - - einfo "Adjusting make.globals, repos.conf and etc-update ..." - hprefixify cnf/{make.globals,repos.conf} bin/etc-update +src_configure() { + local code_only=false + python_foreach_impl my_src_configure +} - if use prefix-guest ; then - sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ - -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ - -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \ - -i cnf/repos.conf || die "sed failed" - fi - fi +my_src_configure() { + local emesonargs=( + -Dcode-only=${code_only} + -Deprefix="${EPREFIX}" + -Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}" + $(meson_use doc) + $(meson_use apidoc) + $(meson_use native-extensions) + $(meson_use gentoo-dev) + $(meson_use ipc) + $(meson_use xattr) + ) - cd "${S}/cnf" || die - if [[ -f "make.conf.example.${ARCH}".diff ]] ; then - patch make.conf.example "make.conf.example.${ARCH}".diff || \ - die "Failed to patch make.conf.example" + if use build; then + emesonargs+=( -Drsync-verify=false ) else - eerror "" - eerror "Portage does not have an arch-specific configuration for this arch." - eerror "Please notify the arch maintainer about this issue. Using generic." - eerror "" + emesonargs+=( $(meson_use rsync-verify) ) fi -} -python_compile_all() { - local targets=() - use doc && targets+=( docbook ) - use apidoc && targets+=( apidoc ) - - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi + meson_src_configure + code_only=true } -python_install() { - # Install sbin scripts to bindir for python-exec linking - # they will be relocated in pkg_preinst() - distutils-r1_python_install \ - --system-prefix="${EPREFIX}/usr" \ - --bindir="$(python_get_scriptdir)" \ - --docdir="${EPREFIX}/usr/share/doc/${PF}" \ - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ - --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \ - --sbindir="$(python_get_scriptdir)" \ - --sysconfdir="${EPREFIX}/etc" \ - "${@}" +src_compile() { + python_foreach_impl meson_src_compile } -python_install_all() { - distutils-r1_python_install_all +src_install() { + python_foreach_impl my_src_install + dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf - local targets=() - use doc && targets+=( - install_docbook - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) - use apidoc && targets+=( - install_apidoc - --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" - ) + local scripts + mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die) + python_replicate_script "${scripts[@]}" +} - # install docs - if [[ ${targets[@]} ]]; then - esetup.py "${targets[@]}" - fi +my_src_install() { + local pydirs=( + "${D}$(python_get_sitedir)" + "${D}/usr/lib/portage/${EPYTHON}" + ) - dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf + meson_src_install + python_optimize "${pydirs[@]}" + python_fix_shebang "${pydirs[@]}" +} - # Due to distutils/python-exec limitations - # these must be installed to /usr/bin. - local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld' - einfo "Moving admin scripts to the correct directory" - dodir /usr/sbin - for target in ${sbin_relocations}; do - einfo "Moving /usr/bin/${target} to /usr/sbin/${target}" - mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!" - done +src_test() { + python_foreach_impl meson_src_test --no-rebuild --verbose } pkg_preinst() {