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 1RUSR4-0002vl-GB for garchives@archives.gentoo.org; Sun, 27 Nov 2011 00:17:34 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9516621C035; Sun, 27 Nov 2011 00:17:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 51B1A21C035 for ; Sun, 27 Nov 2011 00:17:27 +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 CB0271B4002 for ; Sun, 27 Nov 2011 00:17:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E081D80042 for ; Sun, 27 Nov 2011 00:17:25 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <126136fabaa7f90ff7d987ae6453ba0d1bb5f720.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: scripts/ X-VCS-Repository: proj/elfix X-VCS-Files: scripts/paxmodule.c scripts/setup.py X-VCS-Directories: scripts/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 126136fabaa7f90ff7d987ae6453ba0d1bb5f720 Date: Sun, 27 Nov 2011 00:17:25 +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: 6c987f2e-4d42-49a9-8f88-e988341c58db X-Archives-Hash: 9344e52b209b21f4a0dcdd17580e3a8f commit: 126136fabaa7f90ff7d987ae6453ba0d1bb5f720 Author: Anthony G. Basile gentoo org> AuthorDate: Sun Nov 27 00:17:19 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sun Nov 27 00:17:19 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3D126136fa scripts/{setup.py,paxmodule.c}: build with/without xattr support --- scripts/paxmodule.c | 17 +++++++++++++++++ scripts/setup.py | 22 +++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/scripts/paxmodule.c b/scripts/paxmodule.c index a106ff5..b665412 100644 --- a/scripts/paxmodule.c +++ b/scripts/paxmodule.c @@ -21,7 +21,10 @@ #include =20 #include + +#ifdef XATTR #include +#endif =20 #include #include @@ -29,7 +32,10 @@ #include =20 #define BUF_SIZE 7 //Buffer size for holding human readable flags + +#ifdef XATTR #define PAX_NAMESPACE "user.pax" +#endif =20 =20 static PyObject * pax_getflags(PyObject *, PyObject *); @@ -106,6 +112,7 @@ get_pt_flags(int fd) } =20 =20 +#ifdef XATTR uint16_t get_xt_flags(int fd) { @@ -114,6 +121,7 @@ get_xt_flags(int fd) fgetxattr(fd, PAX_NAMESPACE, &xt_flags, sizeof(uint16_t)); return xt_flags; } +#endif =20 =20 void @@ -161,6 +169,7 @@ pax_getflags(PyObject *self, PyObject *args) return NULL; } =20 +#ifdef XATTR flags =3D get_xt_flags(fd); if( flags !=3D UINT16_MAX ) { @@ -169,13 +178,16 @@ pax_getflags(PyObject *self, PyObject *args) } else { +#endif flags =3D get_pt_flags(fd); if( flags !=3D UINT16_MAX ) { memset(buf, 0, BUF_SIZE); bin2string(flags, buf); } +#ifdef XATTR } +#endif =20 close(fd); =20 @@ -237,11 +249,13 @@ set_pt_flags(int fd, uint16_t pt_flags) } =20 =20 +#ifdef XATTR void set_xt_flags(int fd, uint16_t xt_flags) { fsetxattr(fd, PAX_NAMESPACE, &xt_flags, sizeof(uint16_t), 0); } +#endif =20 =20 static PyObject * @@ -266,7 +280,10 @@ pax_setflags(PyObject *self, PyObject *args) flags =3D (uint16_t) iflags; =20 set_pt_flags(fd, flags); + +#ifdef XATTR set_xt_flags(fd, flags); +#endif =20 close(fd); =20 diff --git a/scripts/setup.py b/scripts/setup.py index 3170930..40aecdb 100755 --- a/scripts/setup.py +++ b/scripts/setup.py @@ -1,12 +1,24 @@ #!/usr/bin/env python =20 +import os from distutils.core import setup, Extension =20 -module1 =3D Extension( - name=3D'pax', - sources =3D ['paxmodule.c'], - libraries =3D ['elf', 'attr'], -) +xattr =3D os.getenv('XATTR') + +if xattr !=3D None: + module1 =3D Extension( + name=3D'pax', + sources =3D ['paxmodule.c'], + libraries =3D ['elf', 'attr'], + define_macros =3D [('XATTR', None)] + ) +else: + module1 =3D Extension( + name=3D'pax', + sources =3D ['paxmodule.c'], + libraries =3D ['elf'], + undef_macros =3D ['XATTR'] + ) =20 setup( name =3D 'PaxPython',