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