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 1RVCTO-0008EO-BJ for garchives@archives.gentoo.org; Tue, 29 Nov 2011 01:27:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D069021C02A; Tue, 29 Nov 2011 01:26:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9EB9921C02A for ; Tue, 29 Nov 2011 01:26:48 +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 249241B4019 for ; Tue, 29 Nov 2011 01:26:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3823E80044 for ; Tue, 29 Nov 2011 01:26:47 +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: 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: ddc9dbc832b3424da722f7442cf33327423735a6 Date: Tue, 29 Nov 2011 01:26:47 +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: 945ae96c-60b9-49ac-b0bb-007ab509df19 X-Archives-Hash: 2eb03b4cc3be3b1ecdfdd89626f74237 commit: ddc9dbc832b3424da722f7442cf33327423735a6 Author: Arfrever Frehtes Taifersar Arahesis Gentoo Org> AuthorDate: Tue Nov 29 01:26:04 2011 +0000 Commit: Arfrever Frehtes Taifersar Arahesis gentoo org> CommitDate: Tue Nov 29 01:26:04 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dddc9dbc8 Preserve extended attributes on regular files when using Python >=3D3.3. --- pym/portage/util/movefile.py | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py index 30cb6f1..995f6e7 100644 --- a/pym/portage/util/movefile.py +++ b/pym/portage/util/movefile.py @@ -16,6 +16,16 @@ from portage.localization import _ from portage.process import spawn from portage.util import writemsg =20 +if hasattr(_os, "getxattr"): + # Python >=3D3.3 + def _copyxattr(src, dest): + for attr in _os.listxattr(src): + _os.setxattr(dest, attr, _os.getxattr(src, attr)) +else: + def _copyxattr(src, dest): + pass + # Maybe call getfattr and setfattr executables. + def movefile(src, dest, newmtime=3DNone, sstat=3DNone, mysettings=3DNone= , hardlink_candidates=3DNone, encoding=3D_encodings['fs']): """moves a file from src to dest, preserving all permissions and attrib= utes; mtime will @@ -162,10 +172,12 @@ def movefile(src, dest, newmtime=3DNone, sstat=3DNo= ne, mysettings=3DNone, try: # For safety copy then move it over. if selinux_enabled: selinux.copyfile(src, dest + "#new") + _copyxattr(src, dest + "#new") selinux.rename(dest + "#new", dest) else: - shutil.copyfile(src,dest+"#new") - os.rename(dest+"#new",dest) + shutil.copyfile(src, dest + "#new") + _copyxattr(src, dest + "#new") + os.rename(dest + "#new", dest) didcopy=3D1 except SystemExit as e: raise