Gentoo Archives: gentoo-portage-dev

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