Support FEATURES=xattr.
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 00:47:52 +0000 (16:47 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 00:47:52 +0000 (16:47 -0800)
man/make.conf.5
pym/portage/const.py
pym/portage/util/movefile.py

index 9e517e52caa47921b221774bb8ddbc01c7ecff34..63c6581d7a99157e71af1adaa9e7da1891c1449e 100644 (file)
@@ -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
index 5eeebe1308c2715aeb7537d5e22d027a5463aac8..5003b155c98ed2676207ef2acbe51e3edf67db73 100644 (file)
@@ -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
 
index c777b24ba1aadf6775b5112524bb7abc5743778f..e1dfa429facb21d081a7278cef05599a2bd5da69 100644 (file)
@@ -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)