sys-apps/portage-mgorny: New package
authorMichał Górny <mgorny@gentoo.org>
Wed, 21 Mar 2018 16:20:19 +0000 (17:20 +0100)
committerMichał Górny <mgorny@gentoo.org>
Wed, 21 Mar 2018 18:12:19 +0000 (19:12 +0100)
Introduce a new fork of Portage focused on cleaning up stale code
and adding useful features, with less emphasis on infinite backwards
compatibility.

profiles/base/package.use.force
profiles/default/bsd/fbsd/package.use.mask
profiles/features/hardened/package.use.force
profiles/features/selinux/package.use.mask
profiles/hardened/linux/package.use.force
profiles/prefix/package.use.mask
sys-apps/portage-mgorny/metadata.xml [new file with mode: 0644]
sys-apps/portage-mgorny/portage-mgorny-9999.ebuild [new file with mode: 0644]

index 62ac82a8a1910e2363ff8f4b2e25ab253bf05e11..8f8cd8ba059c90bfafce6ede0b85fd3a00e43338 100644 (file)
@@ -67,6 +67,7 @@ dev-lang/python-exec python_targets_pypy3
 # bug #315615, and makes subshell die support more robust
 # (so that repoman's ebuild.nesteddie check is irrelevant).
 sys-apps/portage ipc
+sys-apps/portage-mgorny ipc
 
 # Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
 # Python should use wide Unicode implementation by default.
index 3678a3e048a332559735b2abdbac7820eb3efdba..847178b8aacd5fe13553d1f16bcdeae2c238ffc4 100644 (file)
@@ -114,3 +114,4 @@ media-libs/mesa openmax
 # Naohiro Aota <naota@gentoo.org> (07 Jul 2014)
 # xattr support is not available on BSD #501534
 sys-apps/portage xattr
+sys-apps/portage-mgorny xattr
index 697af381d682edbf14439b55b5499e201baa56f5..9b56509d22fcec75ef669632e9d91f6b16a1271a 100644 (file)
@@ -1,7 +1,8 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Needed for XATTR_PAX flags
 app-arch/tar xattr
 sys-apps/coreutils xattr
 sys-apps/portage xattr
+sys-apps/portage-mgorny xattr
index ed4720c885abcdd449cdaf2c83238189dc2ab5e5..27aa02ac3c9c18ff0d076845f06b2d1ffb4f891d 100644 (file)
@@ -1,9 +1,10 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Brian Dolbec <dolsen@gentoo.org> (17 Sep 2014)
 # mask pypy for several utilities due to incompatibility with libselinux
 sys-apps/portage python_targets_pypy python_targets_pypy3
+sys-apps/portage-mgorny python_targets_pypy python_targets_pypy3
 app-portage/gentoolkit python_targets_pypy python_targets_pypy3
 app-portage/layman python_targets_pypy python_targets_pypy3
 app-admin/webapp-config python_targets_pypy python_targets_pypy3
index 697af381d682edbf14439b55b5499e201baa56f5..9b56509d22fcec75ef669632e9d91f6b16a1271a 100644 (file)
@@ -1,7 +1,8 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Needed for XATTR_PAX flags
 app-arch/tar xattr
 sys-apps/coreutils xattr
 sys-apps/portage xattr
+sys-apps/portage-mgorny xattr
index 18eaf346e1d7bb830fc84691fea09508a8781253..b97a4bb717899c5be249bad8a8749c4ca56c7784 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Fabian Groffen <grobian@gentoo.org> (27 Jun 2016)
@@ -15,6 +15,7 @@ dev-vcs/git mediawiki mediawiki-experimental
 # very bad with, that really causes way more issues than it is worth to
 # have some boundary bugs solved and more robust subshell die support
 sys-apps/portage ipc
+sys-apps/portage-mgorny ipc
 
 # Michael Haubenwallner <haubi@gentoo.org> (17 Sep 2010)
 # sys-apps/keyutils is a linux only package
diff --git a/sys-apps/portage-mgorny/metadata.xml b/sys-apps/portage-mgorny/metadata.xml
new file mode 100644 (file)
index 0000000..1d50aed
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>mgorny@gentoo.org</email>
+               <name>Michał Górny</name>
+       </maintainer>
+       <use>
+               <flag name="ipc">
+                       Use inter-process communication between Portage and running
+                       ebuilds.
+               </flag>
+               <flag name="native-extensions">
+                       Compiles native "C" extensions (speedups, instead of using
+                       Python backup code).  Currently includes libc-locales.  This
+                       should only be temporarily disabled for some bootstrapping
+                       operations.  Cross-compilation is not supported.
+               </flag>
+               <flag name="xattr">
+                       Preserve extended attributes (filesystem-stored metadata)
+                       when installing files. Usually only required for hardened
+                       systems.
+               </flag>
+       </use>
+</pkgmetadata>
diff --git a/sys-apps/portage-mgorny/portage-mgorny-9999.ebuild b/sys-apps/portage-mgorny/portage-mgorny-9999.ebuild
new file mode 100644 (file)
index 0000000..87caced
--- /dev/null
@@ -0,0 +1,153 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_{4,5,6}} pypy )
+PYTHON_REQ_USE='bzip2(+),threads(+)'
+
+inherit distutils-r1 git-r3
+
+DESCRIPTION="Fork of Portage focused on cleaning up and useful features"
+HOMEPAGE="https://github.com/mgorny/portage"
+SRC_URI=""
+EGIT_REPO_URI="https://github.com/mgorny/portage.git"
+
+LICENSE="GPL-2"
+KEYWORDS=""
+SLOT="0"
+IUSE="build +ipc +native-extensions selinux xattr kernel_linux"
+
+DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
+       >=app-arch/tar-1.27
+       >=sys-apps/sed-4.0.5
+       sys-devel/patch"
+RDEPEND="
+       >=app-arch/tar-1.27
+       !build? (
+               >=app-admin/eselect-1.2
+               app-crypt/gentoo-keys
+               >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
+               >=app-portage/gemato-10
+               app-shells/bash:0[readline]
+               $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
+                       python{2_7,3_4,3_5} pypy)
+               >=dev-python/lxml-3.6.0[${PYTHON_USEDEP}]
+               >=sys-apps/sed-4.0.5
+       )
+       elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
+       elibc_glibc? ( >=sys-apps/sandbox-2.2 )
+       elibc_musl? ( >=sys-apps/sandbox-2.2 )
+       elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
+       >=app-misc/pax-utils-0.1.17
+       selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
+       xattr? ( kernel_linux? (
+               >=sys-apps/install-xattr-0.3
+               $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
+                       python2_7 pypy)
+       ) )
+       !app-portage/repoman
+       !sys-apps/portage"
+PDEPEND="
+       !build? (
+               >=net-misc/rsync-2.6.4
+       )"
+# NOTE: FEATURES=installsources requires debugedit and rsync
+
+python_prepare_all() {
+       distutils-r1_python_prepare_all
+
+       if ! use ipc ; then
+               einfo "Disabling ipc..."
+               sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
+                       -i pym/_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 [[ -n ${EPREFIX} ]] ; then
+               einfo "Setting portage.const.EPREFIX ..."
+               sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
+                       -i pym/portage/const.py ||
+                       die "Failed to patch portage.const.EPREFIX"
+
+               einfo "Prefixing shebangs ..."
+               while read -r -d $'\0' ; do
+                       local shebang=$(head -n1 "${REPLY}")
+                       if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
+                               sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${REPLY}" ||
+                                       die "sed failed"
+                       fi
+               done < <(find . -type f -print0)
+
+               einfo "Adjusting make.globals ..."
+               sed -e "s|\(/usr/portage\)|${EPREFIX}\\1|" \
+                       -e "s|^\(PORTAGE_TMPDIR=\"\)\(/var/tmp\"\)|\\1${EPREFIX}\\2|" \
+                       -i cnf/make.globals || die "sed failed"
+
+               einfo "Adjusting repos.conf ..."
+               sed -e "s|^\(location = \)\(/usr/portage\)|\\1${EPREFIX}\\2|" \
+                       -e "s|^\(sync-openpgp-key-path = \)\(.*\)|\\1${EPREFIX}\\2|" \
+                       -i cnf/repos.conf || die "sed failed"
+               if 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
+
+               einfo "Adding FEATURES=force-prefix to make.globals ..."
+               echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
+                       || die "failed to append to make.globals"
+       fi
+
+       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"
+       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 ""
+       fi
+}
+
+python_configure_all() {
+       cat >> setup.cfg <<-EOF || die
+               [build_ext]
+               portage-ext-modules=$(usex native-extensions true false)
+       EOF
+}
+
+python_test() {
+       esetup.py test
+}
+
+python_install() {
+       distutils-r1_python_install \
+               --system-prefix="${EPREFIX}/usr" \
+               --bindir="$(python_get_scriptdir)" \
+               --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
+               --sysconfdir="${EPREFIX}/etc" \
+               "${@}"
+
+       keepdir /var/log/portage/elog
+}
+
+pkg_preinst() {
+       # This is allowed to fail if the user/group are invalid for prefix users.
+       if chown portage:portage "${ED%/}"/var/log/portage{,/elog} 2>/dev/null ; then
+               chmod g+s,ug+rwx "${ED%/}"/var/log/portage{,/elog}
+       fi
+}