Gentoo Archives: gentoo-portage-dev

From: Alec Warner <antarus@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Anthony G. Basile" <blueness@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] ebuild-helpers/xattr/install: use install-xattr
Date: Mon, 02 Jun 2014 16:13:12
Message-Id: CAAr7Pr_oYVt_oVrf0wMuv_7K+cvoAyU2wWwkt4MQvnxtvbi39w@mail.gmail.com
In Reply to: [gentoo-portage-dev] [PATCH] ebuild-helpers/xattr/install: use install-xattr by basile@opensource.dyc.edu
1 On Sat, May 31, 2014 at 4:36 PM, <basile@××××××××××××××.edu> wrote:
2
3 > From: "Anthony G. Basile" <blueness@g.o>
4 >
5 > Currently bin/ebuild-helpers/xattr/install uses
6 > ${PORTAGE_BIN_PATH}/install.py
7 > as a wrapper to coreutils' install to preserve a file's extended
8 > attributes when
9 > installing, usually during src_install(). This is needed, for instance,
10 > when
11 > preserving xattr based PaX flags, bug #465000. However the python wrapper
12 > is
13 > very slow, comment #42 of bug #465000. A C wrapper was developed and
14 > tested,
15 > bugs #501534 and #511984. This patch checks for the existence of the C
16 > wrapper,
17 > and uses it, falling back on the python wrapper only if not found, or if
18 > over-
19 > ridden by ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION}.
20 > ---
21 > bin/ebuild-helpers/xattr/install | 27 +++++++++++++++++++++++++--
22 > 1 file changed, 25 insertions(+), 2 deletions(-)
23 >
24 > diff --git a/bin/ebuild-helpers/xattr/install
25 > b/bin/ebuild-helpers/xattr/install
26 > index f51f621..9b5d346 100755
27 > --- a/bin/ebuild-helpers/xattr/install
28 > +++ b/bin/ebuild-helpers/xattr/install
29 > @@ -4,9 +4,32 @@
30 >
31 > PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
32 > PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
33 > +INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr
34 > # Use safe cwd, avoiding unsafe import for bug #469338.
35 > export __PORTAGE_HELPER_CWD=${PWD}
36 > cd "${PORTAGE_PYM_PATH}"
37 > export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
38 > -PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
39 > - exec "${PORTAGE_PYTHON:-/usr/bin/python}"
40 > "${PORTAGE_BIN_PATH}/install.py" "$@"
41 > +
42 > +
43 > +if [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == "c" ]]; then
44 > + implementation="c"
45 > +elif [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == "python" ]]; then
46 > + implementation="python"
47
48 +else
49 > + # If PORTAGE_INSTALL_XATTR_IMPLEMENTATION is not set then we'll
50 > autodetect
51 >
52
53 This doesn't run if it is unset, it runs if it is unset, or it is set, but
54 not to 'c' or 'python'.
55
56 -A
57
58
59 > + if [[ -x "${INSTALL_XATTR}" ]]; then
60 > + implementation="c"
61 > + else
62 > + implementation="python"
63 > + fi
64 > +fi
65 > +
66 > +if [[ "${implementation}" == "c" ]]; then
67 > + exec "${INSTALL_XATTR}" "$@"
68 > +elif [[ "${implementation}" == "python" ]]; then
69 > + PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
70 > + exec "${PORTAGE_PYTHON:-/usr/bin/python}"
71 > "${PORTAGE_BIN_PATH}/install.py" "$@"
72 > +else
73 > + echo "Unknown implementation for
74 > PORTAGE_INSTALL_XATTR_IMPLEMENTATION"
75 > + exit -1
76 > +fi
77 > --
78 > 1.8.5.5
79 >
80 >
81 >

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] ebuild-helpers/xattr/install: use install-xattr "Anthony G. Basile" <basile@××××××××××××××.edu>