From 9f090f6397574e83198d6929b24561949aff8802 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 9 Dec 2011 16:47:52 -0800 Subject: [PATCH] Support FEATURES=xattr. --- man/make.conf.5 | 4 ++++ pym/portage/const.py | 2 +- pym/portage/util/movefile.py | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/man/make.conf.5 b/man/make.conf.5 index 9e517e52c..63c6581d7 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -531,6 +531,10 @@ operations. .TP .B webrsync-gpg Enable GPG verification when using \fIemerge\-webrsync\fR. +.TP +.B xattr +Preserve extended attributes (filesystem-stored metadata) when installing +files (see \fBattr\fR(1)). .RE .TP .B FETCHCOMMAND diff --git a/pym/portage/const.py b/pym/portage/const.py index 5eeebe130..5003b155c 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -103,7 +103,7 @@ SUPPORTED_FEATURES = frozenset([ "strict", "stricter", "suidctl", "test", "test-fail-continue", "unknown-features-filter", "unknown-features-warn", "unmerge-logs", "unmerge-orphans", "userfetch", "userpriv", - "usersandbox", "usersync", "webrsync-gpg"]) + "usersandbox", "usersync", "webrsync-gpg", "xattr"]) EAPI = 4 diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index c777b24ba..e1dfa429f 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -70,6 +70,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, mysettings = portage.settings src_bytes = _unicode_encode(src, encoding=encoding, errors='strict') + xattr_enabled = "xattr" in mysettings.features selinux_enabled = mysettings.selinux_enabled() if selinux_enabled: selinux = _unicode_module_wrapper(_selinux, encoding=encoding) @@ -208,12 +209,14 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, try: # For safety copy then move it over. if selinux_enabled: selinux.copyfile(src, dest_tmp) - _copyxattr(src_bytes, dest_tmp_bytes) + if xattr_enabled: + _copyxattr(src_bytes, dest_tmp_bytes) _apply_stat(sstat, dest_tmp_bytes) selinux.rename(dest_tmp, dest) else: shutil.copyfile(src, dest_tmp) - _copyxattr(src_bytes, dest_tmp_bytes) + if xattr_enabled: + _copyxattr(src_bytes, dest_tmp_bytes) _apply_stat(sstat, dest_tmp_bytes) os.rename(dest_tmp, dest) os.unlink(src) -- 2.26.2