public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] ebuild-helpers/xattr/install: use install-xattr
@ 2014-05-31 23:36 basile
  2014-06-02 16:13 ` Alec Warner
  0 siblings, 1 reply; 3+ messages in thread
From: basile @ 2014-05-31 23:36 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Anthony G. Basile

From: "Anthony G. Basile" <blueness@gentoo.org>

Currently bin/ebuild-helpers/xattr/install uses ${PORTAGE_BIN_PATH}/install.py
as a wrapper to coreutils' install to preserve a file's extended attributes when
installing, usually during src_install().  This is needed, for instance, when
preserving xattr based PaX flags, bug #465000.  However the python wrapper is
very slow, comment #42 of bug #465000.  A C wrapper was developed and tested,
bugs #501534 and #511984.  This patch checks for the existence of the C wrapper,
and uses it, falling back on the python wrapper only if not found, or if over-
ridden by ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION}.
---
 bin/ebuild-helpers/xattr/install | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index f51f621..9b5d346 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -4,9 +4,32 @@
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
+INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr
 # Use safe cwd, avoiding unsafe import for bug #469338.
 export __PORTAGE_HELPER_CWD=${PWD}
 cd "${PORTAGE_PYM_PATH}"
 export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
-PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-	exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/install.py" "$@"
+
+
+if [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == "c" ]]; then
+	implementation="c"
+elif [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == "python" ]]; then
+	implementation="python"
+else
+	# If PORTAGE_INSTALL_XATTR_IMPLEMENTATION is not set then we'll autodetect
+	if [[ -x "${INSTALL_XATTR}" ]]; then
+		implementation="c"
+	else
+		implementation="python"
+	fi
+fi
+
+if [[ "${implementation}" == "c" ]]; then
+	exec "${INSTALL_XATTR}" "$@"
+elif [[ "${implementation}" == "python" ]]; then
+	PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
+		exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/install.py" "$@"
+else
+	echo "Unknown implementation for PORTAGE_INSTALL_XATTR_IMPLEMENTATION"
+	exit -1
+fi
-- 
1.8.5.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-04 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-31 23:36 [gentoo-portage-dev] [PATCH] ebuild-helpers/xattr/install: use install-xattr basile
2014-06-02 16:13 ` Alec Warner
2014-06-04 16:55   ` Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox