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 1RZFUV-0006Ww-3d for garchives@archives.gentoo.org; Sat, 10 Dec 2011 05:28:55 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AACB421C095; Sat, 10 Dec 2011 05:28:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6529721C095 for ; Sat, 10 Dec 2011 05:28:47 +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 D757A1B400C for ; Sat, 10 Dec 2011 05:28:46 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4219B8004A for ; Sat, 10 Dec 2011 05:28:46 +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: <49689816166eee3d4fd4d2b1b9932398f3835341.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: 49689816166eee3d4fd4d2b1b9932398f3835341 Date: Sat, 10 Dec 2011 05:28:46 +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: fc918eb9-6ab3-4762-8a35-ee8f5ad4b3ed X-Archives-Hash: 1751ea7a79e31461f8a315109e2068b1 commit: 49689816166eee3d4fd4d2b1b9932398f3835341 Author: Arfrever Frehtes Taifersar Arahesis Gentoo Org> AuthorDate: Sat Dec 10 05:27:18 2011 +0000 Commit: Arfrever Frehtes Taifersar Arahesis gentoo org> CommitDate: Sat Dec 10 05:27:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D49689816 portage.util.movefile._copyxattr(): Print more informative exception when target filesystem does not support extended attributes. --- pym/portage/util/movefile.py | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index e1dfa42..89fa69c 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -14,6 +14,7 @@ from portage import bsd_chflags, _encodings, _os_overri= des, _selinux, \ _unicode_decode, _unicode_encode, _unicode_func_wrapper,\ _unicode_module_wrapper from portage.const import MOVE_BINARY +from portage.exception import OperationNotSupported from portage.localization import _ from portage.process import spawn from portage.util import writemsg @@ -26,7 +27,13 @@ if hasattr(_os, "getxattr"): # Python >=3D3.3 and GNU/Linux def _copyxattr(src, dest): for attr in _os.listxattr(src): - _os.setxattr(dest, attr, _os.getxattr(src, attr)) + try: + _os.setxattr(dest, attr, _os.getxattr(src, attr)) + raise_exception =3D False + except OSError: + raise_exception =3D True + if raise_exception: + raise OperationNotSupported("Filesystem containing file '%s' does no= t support extended attributes" % dest) else: try: import xattr @@ -35,7 +42,13 @@ else: if xattr is not None: def _copyxattr(src, dest): for attr in xattr.list(src): - xattr.set(dest, attr, xattr.get(src, attr)) + try: + xattr.set(dest, attr, xattr.get(src, attr)) + raise_exception =3D False + except IOError: + raise_exception =3D True + if raise_exception: + raise OperationNotSupported("Filesystem containing file '%s' does n= ot support extended attributes" % dest) else: _devnull =3D open("/dev/null", "w") try: @@ -53,8 +66,10 @@ else: 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 =3D subprocess.Popen(["setfattr", "--restore=3D-"]= , stdin=3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE) setfattr_process.communicate(input=3Db"".join(extended_attributes)) + if setfattr_process.returncode !=3D 0: + raise OperationNotSupported("Filesystem containing file '%s' does = not support extended attributes" % dest) else: def _copyxattr(src, dest): pass