From: Zac Medico <zmedico@gentoo.org>
Date: Sat, 22 Jun 2013 01:15:36 +0000 (-0700)
Subject: FEATURES=xattr: wrap install binary, bug #465000
X-Git-Tag: v2.2.0_alpha184~2
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8a78f4d99606a2aa15ee0c049449d98ec27a2c41;p=portage.git

FEATURES=xattr: wrap install binary, bug #465000

The install wrapper is added to PATH only when FEATURES=xattr is
enabled, and the wrapper respects PORTAGE_XATTR_EXCLUDE.
---

diff --git a/bin/install.py b/bin/install.py
index 4925564c3..cce68c34e 100755
--- a/bin/install.py
+++ b/bin/install.py
@@ -184,13 +184,15 @@ def copy_xattrs(opts, files):
 		source, target = files, opts.target_directory
 		target_is_directory = True
 
+	exclude = os.environ.get("PORTAGE_XATTR_EXCLUDE", "security.*")
+
 	try:
 		if target_is_directory:
 			for s in source:
 				abs_path = os.path.join(target, os.path.basename(s))
-				_copyxattr(s, abs_path)
+				_copyxattr(s, abs_path, exclude=exclude)
 		else:
-			_copyxattr(source[0], target)
+			_copyxattr(source[0], target, exclude=exclude)
 		return os.EX_OK
 
 	except OperationNotSupported:
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 6d75ef10f..6433c545e 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -28,7 +28,8 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
 	PORTAGE_REPO_NAME PORTAGE_RESTRICT \
 	PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
 	PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
-	PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \
+	PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
+	PORTDIR PORTDIR_OVERLAY \
 	PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
 	__PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS"
 
diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
index 8b9cac12b..d34d60333 100644
--- a/pym/portage/package/ebuild/_config/special_env_vars.py
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py
@@ -72,7 +72,7 @@ environ_whitelist += [
 	"PORTAGE_REPO_NAME", "PORTAGE_RESTRICT",
 	"PORTAGE_SIGPIPE_STATUS",
 	"PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV", "PORTAGE_USERNAME",
-	"PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE",
+	"PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE", "PORTAGE_XATTR_EXCLUDE",
 	"PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", "PROFILE_PATHS",
 	"REPLACING_VERSIONS", "REPLACED_BY_VERSION",
 	"ROOT", "ROOTPATH", "T", "TMP", "TMPDIR",
@@ -172,7 +172,7 @@ environ_filter += [
 	"PORTAGE_RO_DISTDIRS",
 	"PORTAGE_RSYNC_EXTRA_OPTS", "PORTAGE_RSYNC_OPTS",
 	"PORTAGE_RSYNC_RETRIES", "PORTAGE_SSH_OPTS", "PORTAGE_SYNC_STALE",
-	"PORTAGE_USE", "PORTAGE_XATTR_EXCLUDE",
+	"PORTAGE_USE",
 	"PORT_LOGDIR", "PORT_LOGDIR_CLEAN",
 	"QUICKPKG_DEFAULT_OPTS", "REPOMAN_DEFAULT_OPTS",
 	"RESUMECOMMAND", "RESUMECOMMAND_FTP",
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 69463d2e8..690171968 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -172,6 +172,9 @@ def _doebuild_path(settings, eapi=None):
 
 	path = overrides
 
+	if "xattr" in settings.features:
+		path.append(os.path.join(portage_bin_path, "ebuild-helpers", "xattr"))
+
 	if eprefix and uid != 0 and "fakeroot" not in settings.features:
 		path.append(os.path.join(portage_bin_path,
 			"ebuild-helpers", "unprivileged"))