Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 08/10] dolib.{a,so}: inline the logic from dolib
Date: Sun, 04 Mar 2018 09:52:29
Message-Id: 1520157141.836.0.camel@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 08/10] dolib.{a,so}: inline the logic from dolib by "Michał Górny"
1 W dniu pon, 26.02.2018 o godzinie 16∶59 +0100, użytkownik Michał Górny
2 napisał:
3 > This cleans up the kinda-ugly logic necessary to preserve dolib.a/so
4 > while removing dolib in EAPI 7, and removes the undesirable symlink
5 > handling in dolib.a.
6 > ---
7 > bin/ebuild-helpers/dolib | 2 +-
8 > bin/ebuild-helpers/dolib.a | 42 +++++++++++++++++++++++++++++++++++++++++-
9 > bin/ebuild-helpers/dolib.so | 44 +++++++++++++++++++++++++++++++++++++++++++-
10 > 3 files changed, 85 insertions(+), 3 deletions(-)
11 >
12 > diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
13 > index 62e04b385..4be4aa4ea 100755
14 > --- a/bin/ebuild-helpers/dolib
15 > +++ b/bin/ebuild-helpers/dolib
16 > @@ -4,7 +4,7 @@
17 >
18 > source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
19 >
20 > -if [[ -z ${PORTAGE_INTERNAL_DOLIB} ]] && ! ___eapi_has_dolib_libopts; then
21 > +if ! ___eapi_has_dolib_libopts; then
22 > die "'${0##*/}' has been banned for EAPI '$EAPI'"
23 > exit 1
24 > fi
25 > diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
26 > index 5ea126b5d..9c1cbeca1 100755
27 > --- a/bin/ebuild-helpers/dolib.a
28 > +++ b/bin/ebuild-helpers/dolib.a
29 > @@ -2,4 +2,44 @@
30 > # Copyright 1999-2018 Gentoo Foundation
31 > # Distributed under the terms of the GNU General Public License v2
32 >
33 > -LIBOPTIONS='-m0644' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
34 > +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
35 > +
36 > +if ! ___eapi_has_prefix_variables; then
37 > + ED=${D}
38 > +fi
39 > +
40 > +# Setup ABI cruft
41 > +LIBDIR_VAR="LIBDIR_${ABI}"
42 > +if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
43 > + CONF_LIBDIR=${!LIBDIR_VAR}
44 > +fi
45 > +unset LIBDIR_VAR
46 > +# we need this to default to lib so that things dont break
47 > +CONF_LIBDIR=${CONF_LIBDIR:-lib}
48 > +libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
49 > +
50 > +
51 > +if [[ $# -lt 1 ]] ; then
52 > + __helpers_die "${0##*/}: at least one argument needed"
53 > + exit 1
54 > +fi
55 > +if [[ ! -d ${libdir} ]] ; then
56 > + install -d "${libdir}" || { __helpers_die "${0##*/}: failed to install ${libdir}"; exit 1; }
57 > +fi
58 > +
59 > +ret=0
60 > +
61 > +for x in "$@" ; do
62 > + if [[ -e ${x} ]] ; then
63 > + install -m0644 "${x}" "${libdir}"
64 > + else
65 > + echo "!!! ${0##*/}: ${x} does not exist" 1>&2
66 > + false
67 > + fi
68 > + ((ret|=$?))
69 > +done
70 > +
71 > +[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
72 > +exit ${ret}
73 > +
74 > +# vim:ft=sh
75 > diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
76 > index a3b579e5e..e99962ae4 100755
77 > --- a/bin/ebuild-helpers/dolib.so
78 > +++ b/bin/ebuild-helpers/dolib.so
79 > @@ -2,4 +2,46 @@
80 > # Copyright 1999-2018 Gentoo Foundation
81 > # Distributed under the terms of the GNU General Public License v2
82 >
83 > -LIBOPTIONS='-m0755' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
84 > +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
85 > +
86 > +if ! ___eapi_has_prefix_variables; then
87 > + ED=${D}
88 > +fi
89 > +
90 > +# Setup ABI cruft
91 > +LIBDIR_VAR="LIBDIR_${ABI}"
92 > +if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
93 > + CONF_LIBDIR=${!LIBDIR_VAR}
94 > +fi
95 > +unset LIBDIR_VAR
96 > +# we need this to default to lib so that things dont break
97 > +CONF_LIBDIR=${CONF_LIBDIR:-lib}
98 > +libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
99 > +
100 > +
101 > +if [[ $# -lt 1 ]] ; then
102 > + __helpers_die "${0##*/}: at least one argument needed"
103 > + exit 1
104 > +fi
105 > +if [[ ! -d ${libdir} ]] ; then
106 > + install -d "${libdir}" || { __helpers_die "${0##*/}: failed to install ${libdir}"; exit 1; }
107 > +fi
108 > +
109 > +ret=0
110 > +
111 > +for x in "$@" ; do
112 > + if [[ -e ${x} ]] ; then
113 > + if [[ ! -L ${x} ]] ; then
114 > + install -m0755 "${x}" "${libdir}"
115 > + else
116 > + ln -s "$(readlink "${x}")" "${libdir}/${x##*/}"
117 > + fi
118 > + else
119 > + echo "!!! ${0##*/}: ${x} does not exist" 1>&2
120 > + false
121 > + fi
122 > + ((ret|=$?))
123 > +done
124 > +
125 > +[[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
126 > +exit ${ret}
127
128 I withdraw this patch, we can't remove symlink logic from dolib.a
129 without breaking existing ebuilds.
130
131 --
132 Best regards,
133 Michał Górny