Gentoo Archives: gentoo-portage-dev

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

Replies