From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RZAPn-0005Tl-3J for garchives@archives.gentoo.org; Sat, 10 Dec 2011 00:03:43 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 537EC21C08A; Sat, 10 Dec 2011 00:03:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0B1EE21C08A for ; Sat, 10 Dec 2011 00:03:34 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5530C1B4009 for ; Sat, 10 Dec 2011 00:03:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 8289C80042 for ; Sat, 10 Dec 2011 00:03:33 +0000 (UTC) From: "Arfrever Frehtes Taifersar Arahesis" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arfrever Frehtes Taifersar Arahesis" Message-ID: <4df21a13440d36a94e34ba421d1fb8bc77d35be0.arfrever@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/movefile.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: arfrever X-VCS-Committer-Name: Arfrever Frehtes Taifersar Arahesis X-VCS-Revision: 4df21a13440d36a94e34ba421d1fb8bc77d35be0 Date: Sat, 10 Dec 2011 00:03:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 205dc509-5d64-4bc7-aa1a-d9820bc90d35 X-Archives-Hash: 83b2d6c59417bc0b522414772209fc45 commit: 4df21a13440d36a94e34ba421d1fb8bc77d35be0 Author: Arfrever Frehtes Taifersar Arahesis Gentoo Org> AuthorDate: Sat Dec 10 00:01:46 2011 +0000 Commit: Arfrever Frehtes Taifersar Arahesis gentoo org> CommitDate: Sat Dec 10 00:01:46 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D4df21a13 portage.util.movefile._copyxattr(): Support usage of xattr module from dev-python/pyxattr. --- pym/portage/util/movefile.py | 45 +++++++++++++++++++++++++-----------= ----- 1 files changed, 27 insertions(+), 18 deletions(-) diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index 9507d83..c777b24 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -28,27 +28,36 @@ if hasattr(_os, "getxattr"): for attr in _os.listxattr(src): _os.setxattr(dest, attr, _os.getxattr(src, attr)) else: - _devnull =3D open("/dev/null", "w") try: - subprocess.call(["getfattr", "--version"], stdout=3D_devnull) - subprocess.call(["setfattr", "--version"], stdout=3D_devnull) - _has_getfattr_and_setfattr =3D True - except OSError: - _has_getfattr_and_setfattr =3D False - _devnull.close() - if _has_getfattr_and_setfattr: + import xattr + except ImportError: + xattr =3D None + if xattr is not None: def _copyxattr(src, dest): - getfattr_process =3D subprocess.Popen(["getfattr", "-d", "--absolute-= names", src], stdout=3Dsubprocess.PIPE) - getfattr_process.wait() - extended_attributes =3D getfattr_process.stdout.readlines() - getfattr_process.stdout.close() - if extended_attributes: - extended_attributes[0] =3D b"# file: " + _unicode_encode(dest) + b"\= n" - setfattr_process =3D subprocess.Popen(["setfattr", "--restore=3D-"],= stdin=3Dsubprocess.PIPE) - setfattr_process.communicate(input=3Db"".join(extended_attributes)) + for attr in xattr.list(src): + xattr.set(dest, attr, xattr.get(src, attr)) else: - def _copyxattr(src, dest): - pass + _devnull =3D open("/dev/null", "w") + try: + subprocess.call(["getfattr", "--version"], stdout=3D_devnull) + subprocess.call(["setfattr", "--version"], stdout=3D_devnull) + _has_getfattr_and_setfattr =3D True + except OSError: + _has_getfattr_and_setfattr =3D False + _devnull.close() + if _has_getfattr_and_setfattr: + def _copyxattr(src, dest): + getfattr_process =3D subprocess.Popen(["getfattr", "-d", "--absolute= -names", src], stdout=3Dsubprocess.PIPE) + getfattr_process.wait() + extended_attributes =3D getfattr_process.stdout.readlines() + getfattr_process.stdout.close() + if extended_attributes: + extended_attributes[0] =3D b"# file: " + _unicode_encode(dest) + b"= \n" + setfattr_process =3D subprocess.Popen(["setfattr", "--restore=3D-"]= , stdin=3Dsubprocess.PIPE) + setfattr_process.communicate(input=3Db"".join(extended_attributes)) + else: + def _copyxattr(src, dest): + pass =20 def movefile(src, dest, newmtime=3DNone, sstat=3DNone, mysettings=3DNone= , hardlink_candidates=3DNone, encoding=3D_encodings['fs']):