Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Cc: David Seifert <soap@g.o>
Subject: [gentoo-dev] [PATCH 04/22] db.eclass: add EAPI allowlist
Date: Tue, 14 Mar 2023 19:59:48
Message-Id: 20230314195826.35239-4-soap@gentoo.org
In Reply to: [gentoo-dev] [PATCH 01/22] apache-module.eclass: remove EAPI 5 by David Seifert
1 Signed-off-by: David Seifert <soap@g.o>
2 ---
3 eclass/db.eclass | 132 ++++++++++++++++++++++-------------------------
4 1 file changed, 61 insertions(+), 71 deletions(-)
5
6 diff --git a/eclass/db.eclass b/eclass/db.eclass
7 index 96669c6d8938..ac1e73e03bc4 100644
8 --- a/eclass/db.eclass
9 +++ b/eclass/db.eclass
10 @@ -1,4 +1,4 @@
11 -# Copyright 1999-2021 Gentoo Authors
12 +# Copyright 1999-2023 Gentoo Authors
13 # Distributed under the terms of the GNU General Public License v2
14
15 # @ECLASS: db.eclass
16 @@ -6,19 +6,23 @@
17 # base-system@g.o
18 # @BLURB: Internal eclass used by sys-libs/db ebuilds
19
20 -inherit eutils multilib multiprocessing
21 +case ${EAPI} in
22 + 7|8) ;;
23 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
24 +esac
25
26 -IUSE="doc test examples"
27 +if [[ -z ${_DB_ECLASS} ]]; then
28 +_DB_ECLASS=1
29
30 -EXPORT_FUNCTIONS src_test
31 +inherit multilib multiprocessing
32
33 -DEPEND="test? ( >=dev-lang/tcl-8.4 )"
34 +IUSE="doc tcl test examples"
35 +REQUIRED_USE="test? ( tcl )"
36
37 -RDEPEND=""
38 +BDEPEND="test? ( >=dev-lang/tcl-8.4 )"
39
40 db_fix_so() {
41 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
42 - LIB="${EROOT}/usr/$(get_libdir)"
43 + local LIB="${EROOT}"/usr/$(get_libdir)
44
45 cd "${LIB}" || die
46
47 @@ -32,71 +36,55 @@ db_fix_so() {
48 # now rebuild all the correct ones
49 local ext
50 for ext in so dylib a; do
51 + local name
52 for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
53 - target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -V |tail -n 1)"
54 - [[ -n "${target}" ]] && ln -sf ${target//.\//} ${name}.${ext}
55 - done;
56 - done;
57 -
58 - # db[23] gets some extra-special stuff
59 - if [[ -f libdb1$(get_libname 2) ]]; then
60 - ln -sf libdb1$(get_libname 2) libdb$(get_libname 2)
61 - ln -sf libdb1$(get_libname 2) libdb1$(get_libname)
62 - ln -sf libdb1$(get_libname 2) libdb-1$(get_libname)
63 - fi
64 - # what do we do if we ever get 3.3 ?
65 - local i
66 - for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
67 - if [[ -f $i-3.2$(get_libname) ]]; then
68 - ln -sf $i-3.2$(get_libname) $i-3$(get_libname)
69 - ln -sf $i-3.2$(get_libname) $i$(get_libname 3)
70 - fi
71 + target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" | sort -V | tail -n 1)"
72 + if [[ -n ${target} ]]; then
73 + ln -sf ${target//.\//} ${name}.${ext} || die
74 + fi
75 + done
76 done
77
78 # do the same for headers now
79 # but since there are only two of them, just overwrite them
80 - cd "${EROOT}"/usr/include
81 - target="$(find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -V |cut -d/ -f2- | tail -n1)"
82 - if [[ -n "${target}" ]] && [[ -e "${target}/db.h" ]] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
83 + cd "${EROOT}"/usr/include || die
84 + target="$(find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -V | cut -d/ -f2- | tail -n1)"
85 + if [[ -n ${target} && -e ${target}/db.h ]] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
86 einfo "Creating db.h symlinks to ${target}"
87 - ln -sf "${target}"/db.h .
88 - ln -sf "${target}"/db_185.h .
89 - elif [[ ! -e "${target}/db.h" ]]; then
90 - if [[ -n "${target}" ]]; then
91 + ln -sf "${target}"/db.h . || die
92 + ln -sf "${target}"/db_185.h . || die
93 + elif [[ ! -e ${target}/db.h ]]; then
94 + if [[ -n ${target} ]]; then
95 ewarn "Could not find ${target}/db.h"
96 elif [[ -h db.h ]]; then
97 einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
98 - rm -f db.h db_185.h
99 + rm -f db.h db_185.h || die
100 fi
101 fi
102 }
103
104 db_src_install_doc() {
105 - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
106 # not everybody wants this wad of documentation as it is primarily API docs
107 if use doc; then
108 dodir /usr/share/doc/${PF}/html
109 mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/ || die
110 - rm -rf "${ED}"/usr/docs
111 + rm -rf "${ED}"/usr/docs || die
112 else
113 - rm -rf "${ED}"/usr/docs
114 + rm -rf "${ED}"/usr/docs || die
115 fi
116
117 db_src_install_examples
118 }
119
120 db_src_install_examples() {
121 - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
122 - if use examples ; then
123 + if use examples; then
124 local langs=( c cxx stl )
125 - [[ "${IUSE/java}" != "${IUSE}" ]] \
126 - && use java \
127 - && langs+=( java )
128 + in_iuse java && use java && langs+=( java )
129 local i
130 - for i in ${langs[@]} ; do
131 - destdir="/usr/share/doc/${PF}/"
132 - src="${S}/../examples_${i}/"
133 - if [[ -f "${src}" ]]; then
134 + for i in ${langs[@]}; do
135 + local destdir="/usr/share/doc/${PF}/"
136 + local src="${S}/../examples_${i}/"
137 + if [[ -f ${src} ]]; then
138 dodir "${destdir}"
139 cp -ra "${src}" "${ED}${destdir}/" || die
140 fi
141 @@ -105,13 +93,12 @@ db_src_install_examples() {
142 }
143
144 db_src_install_usrbinslot() {
145 - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
146 # slot all program names to avoid overwriting
147 local fname
148 - for fname in "${ED}"/usr/bin/db*
149 - do
150 - dn="$(dirname "${fname}")"
151 - bn="$(basename "${fname}")"
152 +
153 + for fname in "${ED}"/usr/bin/db*; do
154 + local dn="$(dirname "${fname}")"
155 + local bn="$(basename "${fname}")"
156 bn="${bn/db/db${SLOT}}"
157 mv "${fname}" "${dn}/${bn}" || \
158 die "Failed to rename ${fname} to ${dn}/${bn}"
159 @@ -119,30 +106,28 @@ db_src_install_usrbinslot() {
160 }
161
162 db_src_install_headerslot() {
163 - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
164 # install all headers in a slotted location
165 dodir /usr/include/db${SLOT}
166 mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/ || die
167 }
168
169 db_src_install_usrlibcleanup() {
170 - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
171 - LIB="${ED}/usr/$(get_libdir)"
172 + local LIB="${ED}"/usr/$(get_libdir)
173 # Clean out the symlinks so that they will not be recorded in the
174 # contents (bug #60732)
175
176 - if [[ "${ED}" = "" ]]; then
177 + if [[ -z ${ED} ]]; then
178 die "Calling clean_links while \${ED} not defined"
179 fi
180
181 - if [[ -e "${LIB}"/libdb.a ]] && [[ ! -e "${LIB}"/libdb-${SLOT}.a ]]; then
182 + if [[ -e "${LIB}"/libdb.a && ! -e "${LIB}"/libdb-${SLOT}.a ]]; then
183 einfo "Moving libdb.a to a versioned name"
184 - mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a" || die
185 + mv "${LIB}"/libdb.a "${LIB}"/libdb-${SLOT}.a || die
186 fi
187
188 - if [[ -e "${LIB}"/libdb_cxx.a ]] && [[ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]]; then
189 + if [[ -e "${LIB}"/libdb_cxx.a && ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]]; then
190 einfo "Moving libdb_cxx.a to a versioned name"
191 - mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a" || die
192 + mv "${LIB}"/libdb_cxx.a "${LIB}"/libdb_cxx-${SLOT}.a || die
193 fi
194
195 local soext=$(get_libname)
196 @@ -154,11 +139,11 @@ db_src_install_usrlibcleanup() {
197
198 rm -f \
199 "${ED}"/usr/include/{db,db_185}.h \
200 - "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
201 + "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a || die
202 }
203
204 db_src_test() {
205 - if [[ $UID -eq 0 ]]; then
206 + if [[ ${UID} -eq 0 ]]; then
207 M="You must run the testsuite as non-root, skipping"
208 ewarn "${M}"
209 elog "${M}"
210 @@ -170,34 +155,39 @@ db_src_test() {
211 ewarn "This can take 6+ hours on modern machines"
212 # Fix stuff that fails with relative paths, and upstream moving files
213 # around...
214 - local test_parallel='' t
215 + local t test_parallel
216 for t in \
217 "${S}"/test/parallel.tcl \
218 "${S}"/../test/parallel.tcl \
219 "${S}"/test/tcl/parallel.tcl \
220 "${S}"/../test/tcl/parallel.tcl \
221 ; do
222 - [[ -f "${t}" ]] && test_parallel="${t}" && break
223 + [[ -f ${t} ]] && test_parallel="${t}" && break
224 done
225
226 sed -ri \
227 -e '/regsub .test_path ./s,(regsub),#\1,g' \
228 -e '/regsub .src_root ./s,(regsub),#\1,g' \
229 -e '/regsub .tcl_utils ./s,(regsub),#\1,g' \
230 - "${test_parallel}"
231 - cd "${S}"
232 + "${test_parallel}" || die
233 + cd "${S}" || die
234 for t in \
235 ../test/test.tcl \
236 ../test/tcl/test.tcl \
237 ; do
238 - [[ -f "${t}" ]] && testbase="${t}" && break
239 + [[ -f ${t} ]] && testbase="${t}" && break
240 done
241 - echo "source ${t}" > testrunner.tcl
242 - echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
243
244 - tclsh testrunner.tcl
245 + cat > testrunner.tcl <<-EOF || die
246 + source ${t}
247 + run_parallel $(makeopts_jobs) run_std
248 + EOF
249 +
250 + tclsh testrunner.tcl || die
251 grep -Eqs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
252 - else
253 - eerror "You must have USE=tcl to run the sys-libs/db testsuite."
254 fi
255 }
256 +
257 +fi
258 +
259 +EXPORT_FUNCTIONS src_test
260 --
261 2.40.0