Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/Mk/Scripts/qa.sh
16124 views
1
#!/bin/sh
2
# MAINTAINER: [email protected]
3
4
set -o pipefail
5
6
if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then
7
echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2
8
exit 1
9
fi
10
11
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
12
13
LF=$(printf '\nX')
14
LF=${LF%X}
15
16
notice() {
17
echo "Notice: $*" >&2
18
}
19
20
warn() {
21
echo "Warning: $*" >&2
22
}
23
24
err() {
25
echo "Error: $*" >&2
26
}
27
28
list_stagedir_elfs() {
29
cd ${STAGEDIR} && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@"
30
}
31
32
shebangonefile() {
33
local f interp interparg badinterp rc
34
35
f="$*"
36
rc=0
37
38
# whitelist some files
39
case "${f}" in
40
*.pm|*.pod|*.txt|${STAGEDIR}${LINUXBASE}/*)
41
return 0
42
;;
43
esac
44
45
interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
46
badinterp=""
47
case "${interp}" in
48
"") ;;
49
/bin/rc)
50
# whitelist some interpreters
51
;;
52
${LOCALBASE}/bin/python|${PREFIX}/bin/python|${LOCALBASE}/bin/python2|${PREFIX}/bin/python2|${LOCALBASE}/bin/python3|${PREFIX}/bin/python3)
53
badinterp="${interp}"
54
;;
55
${LINUXBASE}/*) ;;
56
${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*)
57
# lang/perl5* are allowed to have these shebangs.
58
if ! expr ${PKGORIGIN} : '^lang/perl5.*' > /dev/null; then
59
err "'${interp}' is an invalid shebang for '${f#${STAGEDIR}${PREFIX}/}' you must use ${LOCALBASE}/bin/perl."
60
err "Either pass \${PERL} to the build or use USES=shebangfix"
61
rc=1
62
fi
63
;;
64
${LOCALBASE}/*) ;;
65
${PREFIX}/*) ;;
66
/bin/csh) ;;
67
/bin/sh) ;;
68
/bin/tcsh) ;;
69
/usr/bin/awk) ;;
70
/usr/bin/env)
71
interparg=$(sed -n -e '1s/^#![[:space:]]*[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
72
case "${interparg}" in
73
python|python2|python3)
74
badinterp="${interp} ${interparg}"
75
;;
76
esac
77
;;
78
/usr/bin/nawk) ;;
79
/usr/bin/sed) ;;
80
/usr/sbin/dtrace) ;;
81
/usr/bin/make) ;;
82
/usr/libexec/atf-sh) ;;
83
*)
84
badinterp="${interp}"
85
;;
86
esac
87
88
if [ -n "${badinterp}" ]; then
89
err "'${badinterp}' is an invalid shebang you need USES=shebangfix for '${f#${STAGEDIR}${PREFIX}/}'"
90
rc=1
91
fi
92
93
return ${rc}
94
}
95
96
shebang() {
97
local f l link rc
98
99
rc=0
100
101
while read -r f; do
102
# No results presents a blank line from heredoc.
103
[ -z "${f}" ] && continue
104
shebangonefile "${f}" || rc=1
105
# Use heredoc to avoid losing rc from find|while subshell
106
done <<-EOF
107
$(find ${STAGEDIR}${PREFIX} \
108
-type f -perm +111 2>/dev/null)
109
EOF
110
111
return ${rc}
112
}
113
114
baselibs() {
115
local rc
116
local found_openssl
117
local file
118
[ "${PKGBASE}" = "pkg" -o "${PKGBASE}" = "pkg-devel" ] && return
119
while read -r f; do
120
case ${f} in
121
File:\ .*)
122
file=${f#File: .}
123
;;
124
*NEEDED*\[libarchive.so.[56]])
125
err "Bad linking on ${f##* } for ${file} please add USES=libarchive"
126
rc=1
127
;;
128
*NEEDED*\[libedit.so.7])
129
err "Bad linking on ${f##* } for ${file} please add USES=libedit"
130
rc=1
131
;;
132
*NEEDED*\[libcrypto.so.*]|*NEEDED*\[libssl.so.*])
133
found_openssl=1
134
;;
135
esac
136
done <<-EOF
137
$(list_stagedir_elfs -exec readelf -d {} + 2>/dev/null)
138
EOF
139
if [ -z "${USESSSL}" -a -n "${found_openssl}" ]; then
140
warn "you need USES=ssl"
141
elif [ -n "${USESSSL}" -a -z "${found_openssl}" ]; then
142
warn "you may not need USES=ssl"
143
fi
144
return ${rc}
145
}
146
147
symlinks() {
148
local rc
149
150
rc=0
151
152
# Split stat(1) result into 2 lines and read each line separately to
153
# retain spaces in filenames.
154
while read -r l; do
155
# No results presents a blank line from heredoc.
156
[ -z "${l}" ] && continue
157
read -r link
158
case "${link}" in
159
${STAGEDIR}*)
160
err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory"
161
rc=1
162
;;
163
/*)
164
# Only warn for symlinks within the package.
165
if [ -e "${STAGEDIR}${link}" ]; then
166
warn "Bad symlink '${l#${STAGEDIR}}' pointing to an absolute pathname '${link}'"
167
fi
168
# Also warn if the symlink exists nowhere.
169
if [ ! -e "${STAGEDIR}${link}" -a ! -e "${link}" ]; then
170
warn "Symlink '${l#${STAGEDIR}}' pointing to '${link}' which does not exist in the stage directory or in localbase"
171
fi
172
;;
173
esac
174
# Use heredoc to avoid losing rc from find|while subshell.
175
done <<-EOF
176
$(find ${STAGEDIR} -type l -exec stat -f "%N${LF}%Y" {} +)
177
EOF
178
179
return ${rc}
180
}
181
182
paths() {
183
local rc
184
185
rc=0
186
187
while read -r f; do
188
# No results presents a blank line from heredoc.
189
[ -z "${f}" ] && continue
190
# Ignore false-positive/harmless files
191
case "${f}" in
192
*/lib/ruby/gems/*) continue ;;
193
*/share/texmf-var/web2c/*/*.fmt) continue ;;
194
*/share/texmf-var/web2c/*/*.log) continue ;;
195
esac
196
err "'${f#${STAGEDIR}${PREFIX}/}' is referring to ${STAGEDIR}"
197
rc=1
198
# Use heredoc to avoid losing rc from find|while subshell
199
done <<-EOF
200
$(find ${TMPPLIST} ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +)
201
EOF
202
203
return ${rc}
204
}
205
206
# For now do not raise an error, just warnings
207
stripped() {
208
[ -x /usr/bin/file ] || return # this is fatal
209
[ -n "${STRIP}" ] || return 0
210
# Split file and result into 2 lines and read separately to ensure
211
# files with spaces are kept intact.
212
# Using readelf -h ... /ELF Header:/ will match on all ELF files.
213
find ${STAGEDIR} -type f ! -name '*.a' ! -name '*.o' \
214
-exec sh -c 'readelf -S -- /dev/null "$@" || :' -- {} + 2>/dev/null | awk '
215
/File:/ {sub(/File: /, "", $0); file=$0}
216
/[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' |
217
while read -r f; do
218
warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
219
done
220
}
221
222
desktopfileutils() {
223
if [ -z "${USESDESKTOPFILEUTILS}" ]; then
224
grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null &&
225
warn "you need USES=desktop-file-utils"
226
else
227
grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null ||
228
warn "you may not need USES=desktop-file-utils"
229
fi
230
return 0
231
}
232
233
sharedmimeinfo() {
234
local f found
235
236
found=0
237
for f in ${STAGEDIR}${PREFIX}/share/mime/packages/*.xml; do
238
[ "${f}" = "${STAGEDIR}${PREFIX}/share/mime/packages/*.xml" ] && break #no matches
239
[ "${f}" = "${STAGEDIR}${PREFIX}/share/mime/packages/freedesktop.org.xml" ] && continue
240
found=1
241
break
242
done
243
if [ -z "${USESSHAREDMIMEINFO}" -a ${found} -eq 1 ]; then
244
warn "you need USES=shared-mime-info"
245
elif [ -n "${USESSHAREDMIMEINFO}" -a ${found} -eq 0 ]; then
246
warn "you may not need USES=shared-mime-info"
247
fi
248
return 0
249
}
250
251
suidfiles() {
252
local filelist
253
254
filelist=$(find ${STAGEDIR} -type f \
255
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
256
\( -perm -u+s -or -perm -g+s \))
257
if [ -n "${filelist}" ]; then
258
warn "setuid files in the stage directory (are these necessary?):"
259
ls -liTd ${filelist}
260
fi
261
return 0
262
}
263
264
libtool() {
265
if [ -z "${USESLIBTOOL}" ]; then
266
find ${STAGEDIR} -name '*.la' | while read -r f; do
267
if grep -q 'libtool library' "${f}"; then
268
err ".la libraries found, port needs USES=libtool"
269
return 1
270
fi
271
done
272
# The return above continues here.
273
fi
274
}
275
276
libperl() {
277
local has_some_libperl_so files found
278
if [ -n "${SITE_ARCH_REL}" -a -d "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" ]; then
279
has_some_libperl_so=0
280
files=0
281
while read -r f; do
282
# No results presents a blank line from heredoc.
283
[ -z "${f}" ] && continue
284
files=$((files+1))
285
found=$(readelf -d ${f} | awk "BEGIN {libperl=1}
286
/NEEDED.*${LIBPERL}/ { libperl = 0 }
287
END {print libperl}
288
")
289
case "${found}" in
290
1)
291
warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"
292
;;
293
0)
294
has_some_libperl_so=1
295
;;
296
esac
297
# Use heredoc to avoid losing rc from find|while subshell
298
done <<-EOT
299
$(find ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} -name '*.so')
300
EOT
301
302
if [ ${files} -gt 0 -a ${has_some_libperl_so} -eq 0 ]; then
303
err "None of the ${files} .so in ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} are linked with ${LIBPERL}, see above for the full list."
304
return 1
305
else
306
return 0
307
fi
308
fi
309
}
310
311
prefixvar() {
312
if [ ${PREFIX} != ${LINUXBASE} -a -d ${STAGEDIR}${PREFIX}/var ]; then
313
warn "port uses ${PREFIX}/var instead of /var"
314
fi
315
}
316
317
terminfo() {
318
local f found
319
320
for f in ${STAGEDIR}${PREFIX}/share/misc/*.terminfo; do
321
[ "${f}" = "${STAGEDIR}${PREFIX}/share/misc/*.terminfo" ] && break #no matches
322
found=1
323
break
324
done
325
for f in ${STAGEDIR}${PREFIX}/share/misc/terminfo.db*; do
326
[ "${f}" = "${STAGEDIR}${PREFIX}/share/misc/terminfo.db*" ] && break #no matches
327
found=1
328
break
329
done
330
if [ -z "${USESTERMINFO}" -a -n "${found}" ]; then
331
warn "you need USES=terminfo"
332
elif [ -n "${USESTERMINFO}" -a -z "${found}" ]; then
333
warn "you may not need USES=terminfo"
334
fi
335
return 0
336
}
337
338
listcontains() {
339
local str lst elt
340
str=$1
341
lst=$2
342
343
for elt in ${lst} ; do
344
if [ ${elt} = ${str} ]; then
345
return 0
346
fi
347
done
348
return 1
349
}
350
351
proxydeps_suggest_uses() {
352
local pkg=$1
353
local lib_file=$2
354
355
# miscellaneous USE clauses
356
if [ ${pkg} = 'devel/gettext-runtime' ]; then
357
warn "you need USES+=gettext-runtime"
358
elif [ ${pkg} = 'databases/sqlite3' ]; then
359
warn "you need USES+=sqlite"
360
elif [ ${pkg} = 'databases/sqlite2' ]; then
361
warn "you need USES+=sqlite:2"
362
# Gnome -> same as port
363
# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \&\& echo "\\${pkg} = \\\"\2/\3\\\" -o \\\\"|'|sort|sh
364
elif [ ${pkg} = "accessibility/atk" -o \
365
${pkg} = "accessibility/atkmm" -o \
366
${pkg} = "graphics/cairo" -o \
367
${pkg} = "graphics/cairomm" -o \
368
${pkg} = "devel/dconf" -o \
369
${pkg} = "devel/gconf2" -o \
370
${pkg} = "devel/gconfmm26" -o \
371
${pkg} = "devel/glib20" -o \
372
${pkg} = "devel/glibmm" -o \
373
${pkg} = "audio/gsound" -o \
374
${pkg} = "x11-toolkits/gtk20" -o \
375
${pkg} = "x11-toolkits/gtk30" -o \
376
${pkg} = "www/gtkhtml4" -o \
377
${pkg} = "x11-toolkits/gtkmm20" -o \
378
${pkg} = "x11-toolkits/gtkmm24" -o \
379
${pkg} = "x11-toolkits/gtkmm30" -o \
380
${pkg} = "x11-toolkits/gtksourceview2" -o \
381
${pkg} = "x11-toolkits/gtksourceview3" -o \
382
${pkg} = "x11-toolkits/gtksourceviewmm3" -o \
383
${pkg} = "databases/libgda5" -o \
384
${pkg} = "databases/libgda5-ui" -o \
385
${pkg} = "databases/libgdamm5" -o \
386
${pkg} = "devel/libglade2" -o \
387
${pkg} = "graphics/libgnomecanvas" -o \
388
${pkg} = "x11/libgnomekbd" -o \
389
${pkg} = "devel/libgsf" -o \
390
${pkg} = "graphics/librsvg2" -o \
391
${pkg} = "devel/libsigc++12" -o \
392
${pkg} = "devel/libsigc++20" -o \
393
${pkg} = "x11-toolkits/libwnck" -o \
394
${pkg} = "x11-toolkits/libwnck3" -o \
395
${pkg} = "textproc/libxml++26" -o \
396
${pkg} = "textproc/libxml2" -o \
397
${pkg} = "textproc/libxslt" -o \
398
${pkg} = "x11-wm/metacity" -o \
399
${pkg} = "x11-toolkits/pango" -o \
400
${pkg} = "x11-toolkits/pangomm" -o \
401
${pkg} = "x11-toolkits/pangox-compat" -o \
402
${pkg} = "x11-toolkits/vte" -o \
403
${pkg} = "x11-toolkits/vte3" ]; then
404
warn "you need USE_GNOME+=${pkg#*/}"
405
# Gnome different as port
406
# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \|\| echo "elif [ \\${pkg} = \\\"\2/\3\\\" ]; then; warn \\\"you need USE_GNOME+=\1\\\""|'|sort|sh
407
elif [ ${pkg} = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3"
408
elif [ ${pkg} = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf"
409
elif [ ${pkg} = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf2"
410
elif [ ${pkg} = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3"
411
elif [ ${pkg} = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection"
412
elif [ ${pkg} = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2"
413
elif [ ${pkg} = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl"
414
elif [ ${pkg} = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus3"
415
elif [ ${pkg} = "devel/ORBit2" ]; then warn "you need USE_GNOME+=orbit2"
416
elif [ ${pkg} = "graphics/librsvg2-rust" ]; then warn "you need USE_GNOME+=librsvg2"
417
# mate
418
# grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_MATE+=\1"|'
419
elif [ ${pkg} = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja"
420
elif [ ${pkg} = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter"
421
elif [ ${pkg} = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop"
422
elif [ ${pkg} = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd"
423
elif [ ${pkg} = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather"
424
elif [ ${pkg} = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco"
425
elif [ ${pkg} = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus"
426
elif [ ${pkg} = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel"
427
elif [ ${pkg} = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit"
428
# KDE
429
# grep -B1 _LIB= Mk/Uses/kde.mk | grep _PORT=|sed -e 's/^kde-\(.*\)_PORT=[[:space:]]*\([^[:space:]]*\).*/elif [ ${pkg} = "\2" ]; then warn "you need to use USE_KDE+=\1"/'
430
# KDE Applications
431
elif [ ${pkg} = "net/akonadi-contacts" ]; then warn "you need to use USE_KDE+=akonadicontacts"
432
elif [ ${pkg} = "deskutils/akonadi-import-wizard" ]; then warn "you need to use USE_KDE+=akonadiimportwizard"
433
elif [ ${pkg} = "net/akonadi-mime" ]; then warn "you need to use USE_KDE+=akonadimime"
434
elif [ ${pkg} = "net/akonadi-notes" ]; then warn "you need to use USE_KDE+=akonadinotes"
435
elif [ ${pkg} = "net/akonadi-calendar" ]; then warn "you need to use USE_KDE+=akonadicalendar"
436
elif [ ${pkg} = "net/akonadi-search" ]; then warn "you need to use USE_KDE+=akonadisearch"
437
elif [ ${pkg} = "net/kalarmcal" ]; then warn "you need to use USE_KDE+=alarmcalendar"
438
elif [ ${pkg} = "net/calendarsupport" ]; then warn "you need to use USE_KDE+=calendarsupport"
439
elif [ ${pkg} = "net/kcalcore" ]; then warn "you need to use USE_KDE+=calendarcore"
440
elif [ ${pkg} = "net/kcalutils" ]; then warn "you need to use USE_KDE+=calendarutils"
441
elif [ ${pkg} = "net/kcontacts" ]; then warn "you need to use USE_KDE+=contacts"
442
elif [ ${pkg} = "net/eventviews" ]; then warn "you need to use USE_KDE+=eventviews"
443
elif [ ${pkg} = "net/libkgapi" ]; then warn "you need to use USE_KDE+=gapi"
444
elif [ ${pkg} = "deskutils/grantleetheme" ]; then warn "you need to use USE_KDE+=grantleetheme"
445
elif [ ${pkg} = "net/libgravatar" ]; then warn "you need to use USE_KDE+=gravatar"
446
elif [ ${pkg} = "net/kidentitymanagement" ]; then warn "you need to use USE_KDE+=identitymanagement"
447
elif [ ${pkg} = "net/kimap" ]; then warn "you need to use USE_KDE+=imap"
448
elif [ ${pkg} = "net/incidenceeditor" ]; then warn "you need to use USE_KDE+=incidenceeditor"
449
elif [ ${pkg} = "deskutils/kdepim-apps-libs" ]; then warn "you need to use USE_KDE+=kdepim-apps-libs"
450
elif [ ${pkg} = "net/kitinerary" ]; then warn "you need to use USE_KDE+=kitinerary"
451
elif [ ${pkg} = "net/kontactinterface" ]; then warn "you need to use USE_KDE+=kontactinterface"
452
elif [ ${pkg} = "net/kf5-kdav" ]; then warn "you need to use USE_KDE+=kdav"
453
elif [ ${pkg} = "security/kpkpass" ]; then warn "you need to use USE_KDE+=kpkpass"
454
elif [ ${pkg} = "net/ksmtp" ]; then warn "you need to use USE_KDE+=ksmtp"
455
elif [ ${pkg} = "net/kldap" ]; then warn "you need to use USE_KDE+=ldap"
456
elif [ ${pkg} = "deskutils/libkdepim" ]; then warn "you need to use USE_KDE+=libkdepim"
457
elif [ ${pkg} = "security/libkleo" ]; then warn "you need to use USE_KDE+=libkleo"
458
elif [ ${pkg} = "net/libksieve" ]; then warn "you need to use USE_KDE+=libksieve"
459
elif [ ${pkg} = "net/mailcommon" ]; then warn "you need to use USE_KDE+=mailcommon"
460
elif [ ${pkg} = "net/mailimporter" ]; then warn "you need to use USE_KDE+=mailimporter"
461
elif [ ${pkg} = "net/kmailtransport" ]; then warn "you need to use USE_KDE+=mailtransport"
462
elif [ ${pkg} = "net/kmbox" ]; then warn "you need to use USE_KDE+=mbox"
463
elif [ ${pkg} = "net/messagelib" ]; then warn "you need to use USE_KDE+=messagelib"
464
elif [ ${pkg} = "net/kmime" ]; then warn "you need to use USE_KDE+=mime"
465
elif [ ${pkg} = "net/pimcommon" ]; then warn "you need to use USE_KDE+=pimcommon"
466
elif [ ${pkg} = "net/kpimtextedit" ]; then warn "you need to use USE_KDE+=pimtextedit"
467
elif [ ${pkg} = "net/ktnef" ]; then warn "you need to use USE_KDE+=tnef"
468
elif [ ${pkg} = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi"
469
elif [ ${pkg} = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets"
470
elif [ ${pkg} = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb"
471
elif [ ${pkg} = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc"
472
elif [ ${pkg} = "graphics/libkdcraw" ]; then warn "you need to use USE_KDE+=libkdcraw"
473
elif [ ${pkg} = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames"
474
elif [ ${pkg} = "misc/libkeduvocdocument" ]; then warn "you need to use USE_KDE+=libkeduvocdocument"
475
elif [ ${pkg} = "graphics/libkexiv2" ]; then warn "you need to use USE_KDE+=libkexiv2"
476
elif [ ${pkg} = "graphics/libkipi" ]; then warn "you need to use USE_KDE+=libkipi"
477
elif [ ${pkg} = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane"
478
elif [ ${pkg} = "astro/marble" ]; then warn "you need to use USE_KDE+=marble"
479
elif [ ${pkg} = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular"
480
# KDE Plasma
481
elif [ ${pkg} = "x11/plasma5-kactivitymanagerd" ]; then warn "you need to use USE_KDE+=activitymanagerd"
482
elif [ ${pkg} = "x11-wm/plasma5-kdecoration" ]; then warn "you need to use USE_KDE+=decoration"
483
elif [ ${pkg} = "devel/plasma5-khotkeys" ]; then warn "you need to use USE_KDE+=hotkeys"
484
elif [ ${pkg} = "sysutils/plasma5-kmenuedit" ]; then warn "you need to use USE_KDE+=kmenuedit"
485
elif [ ${pkg} = "security/plasma5-kscreenlocker" ]; then warn "you need to use USE_KDE+=kscreenlocker"
486
elif [ ${pkg} = "x11/plasma5-libkscreen" ]; then warn "you need to use USE_KDE+=libkscreen"
487
elif [ ${pkg} = "sysutils/plasma5-libksysguard" ]; then warn "you need to use USE_KDE+=libksysguard"
488
elif [ ${pkg} = "deskutils/plasma5-milou" ]; then warn "you need to use USE_KDE+=milou"
489
elif [ ${pkg} = "x11-themes/plasma5-oxygen" ]; then warn "you need to use USE_KDE+=oxygen"
490
elif [ ${pkg} = "x11/plasma5-plasma-workspace" ]; then warn "you need to use USE_KDE+=plasma-workspace"
491
elif [ ${pkg} = "sysutils/plasma5-powerdevil" ]; then warn "you need to use USE_KDE+=powerdevil"
492
# KDE Frameworks
493
elif [ ${pkg} = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica"
494
elif [ ${pkg} = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo"
495
elif [ ${pkg} = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration"
496
elif [ ${pkg} = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils"
497
elif [ ${pkg} = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative"
498
elif [ ${pkg} = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded"
499
elif [ ${pkg} = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support"
500
elif [ ${pkg} = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu"
501
elif [ ${pkg} = "www/kf5-kdewebkit" ]; then warn "you need to use USE_KDE+=kdewebkit"
502
elif [ ${pkg} = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml"
503
elif [ ${pkg} = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio"
504
elif [ ${pkg} = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross"
505
elif [ ${pkg} = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework"
506
elif [ ${pkg} = "graphics/kf5-prison" ]; then warn "you need to use USE_KDE+=prison"
507
elif [ ${pkg} = "misc/kf5-purpose" ]; then warn "you need to use USE_KDE+=purpose"
508
elif [ ${pkg} = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid"
509
elif [ ${pkg} = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet"
510
elif [ ${pkg} = "net/kf5-syndication" ]; then warn "you need to use USE_KDE+=syndication"
511
elif [ ${pkg} = "textproc/kf5-syntax-highlighting" ]; then warn "you need to use USE_KDE+=syntaxhighlighting"
512
elif [ ${pkg} = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver"
513
elif expr ${pkg} : '.*/kf5-.*' > /dev/null; then
514
warn "you need USE_KDE+=$(echo ${pkg} | sed -E 's|.*/kf5-k||')"
515
# GStreamer 0.10
516
elif [ ${pkg} = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes"
517
elif [ ${pkg} = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes"
518
elif [ ${pkg} = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad"
519
# GStreamer 1
520
elif [ ${pkg} = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes"
521
elif [ ${pkg} = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes"
522
elif [ ${pkg} = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad"
523
# boost related
524
elif [ ${pkg} = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python"
525
# sdl-related
526
elif [ ${pkg} = 'devel/sdl12' ]; then
527
warn "you need USE_SDL+=sdl"
528
elif echo ${pkg} | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then
529
warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl_||')"
530
elif [ ${pkg} = 'devel/sdl20' ]; then
531
warn "you need USE_SDL+=sdl2"
532
elif echo ${pkg} | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then
533
warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl2_||')2"
534
# gl-related
535
elif expr ${lib_file} : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then
536
warn "you need USE_GL+=gl"
537
elif expr ${lib_file} : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then
538
warn "you need USE_GL+=gbm"
539
elif expr ${lib_file} : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then
540
warn "you need USE_GL+=glesv2"
541
elif expr ${lib_file} : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then
542
warn "you need USE_GL+=egl"
543
elif [ ${pkg} = 'graphics/glew' ]; then
544
warn "you need USE_GL+=glew"
545
elif [ ${pkg} = 'graphics/libGLU' ]; then
546
warn "you need USE_GL+=glu"
547
elif [ ${pkg} = 'graphics/libGLw' ]; then
548
warn "you need USE_GL+=glw"
549
elif [ ${pkg} = 'graphics/freeglut' ]; then
550
warn "you need USE_GL+=glut"
551
# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk
552
elif echo ${pkg} | grep -E '/lib(X11|Xau|Xdmcp|Xext|SM|ICE|Xfixes|Xft|Xdamage|Xcomposite|Xcursor|Xinerama|Xmu|Xmuu|Xpm|Xt|Xtst|Xi|Xrandr|Xrender|Xres|XScrnSaver|Xv|Xxf86vm|Xxf86dga|Xxf86misc|xcb)$' > /dev/null; then
553
warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')"
554
elif [ ${pkg} = 'x11/pixman' ]; then
555
warn "you need USE_XORG+=pixman"
556
# Qt5
557
elif expr ${pkg} : '.*/qt5-.*' > /dev/null; then
558
warn "you need USES=qt:5 and USE_QT+=$(echo ${pkg} | sed -E 's|.*/qt5-||')"
559
# MySQL
560
elif expr ${lib_file} : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then
561
warn "you need USES+=mysql"
562
# postgresql
563
elif expr ${pkg} : "^databases/postgresql.*-client" > /dev/null; then
564
warn "you need USES+=pgsql"
565
# bdb
566
elif expr ${pkg} : "^databases/db[456]" > /dev/null; then
567
warn "you need USES+=bdb"
568
# fam/gamin
569
elif [ ${pkg} = "devel/fam" -o ${pkg} = "devel/gamin" ]; then
570
warn "you need USES+=fam"
571
# firebird
572
elif [ ${pkg} = "databases/firebird25-client" ]; then
573
warn "you need USES+=firebird"
574
# fuse
575
elif [ ${pkg} = "sysutils/fusefs-libs" ]; then
576
warn "you need USES+=fuse"
577
# gnustep
578
elif [ ${pkg} = "lang/gnustep-base" ]; then
579
warn "you need USES+=gnustep and USE_GNUSTEP+=base"
580
elif [ ${pkg} = "x11-toolkits/gnustep-gui" ]; then
581
warn "you need USES+=gnustep and USE_GNUSTEP+=gui"
582
# iconv
583
elif [ ${pkg} = "converters/libiconv" ]; then
584
warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs"
585
# jpeg
586
elif [ ${pkg} = "graphics/jpeg-turbo" ]; then
587
warn "you need USES+=jpeg"
588
# libarchive
589
elif [ ${pkg} = "archivers/libarchive" ]; then
590
warn "you need USES+=libarchive"
591
elif [ ${pkg} = "devel/libedit" ]; then
592
warn "you need USES+=libedit"
593
# lua
594
elif expr ${pkg} : "^lang/lua" > /dev/null; then
595
warn "you need USES+=lua"
596
# motif
597
elif [ ${pkg} = "x11-toolkits/lesstif" -o ${pkg} = "x11-toolkits/open-motif" ]; then
598
warn "you need USES+=motif"
599
# ncurses
600
elif [ ${pkg} = "devel/ncurses" ]; then
601
warn "you need USES+=ncurses"
602
# objc
603
elif [ ${pkg} = "lang/libobjc2" ]; then
604
warn "you need USES+=objc"
605
# openal
606
elif [ ${pkg} = "audio/openal" -o ${pkg} = "audio/openal-soft" -o ${pkg} = "audio/freealut" ]; then
607
warn "you need USES+=openal"
608
# readline
609
elif [ ${pkg} = "devel/readline" ]; then
610
warn "you need USES+=readline"
611
# ssl
612
elif [ ${pkg} = "security/openssl" -o ${pkg} = "security/openssl111" \
613
-o ${pkg} = "security/libressl" -o ${pkg} = "security/libressl-devel" \
614
]; then
615
warn "you need USES=ssl"
616
# Tcl
617
elif expr ${pkg} : "^lang/tcl" > /dev/null; then
618
warn "you need USES+=tcl"
619
# Tk
620
elif expr ${pkg} : "^x11-toolkits/tk" > /dev/null; then
621
warn "you need USES+=tk"
622
# Xfce
623
# grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|'
624
elif [ ${pkg} = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon"
625
elif [ ${pkg} = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo"
626
elif [ ${pkg} = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui"
627
elif [ ${pkg} = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu"
628
elif [ ${pkg} = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil"
629
elif [ ${pkg} = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel"
630
elif [ ${pkg} = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar"
631
elif [ ${pkg} = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf"
632
# default
633
elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then
634
lib_file=${lib_file#${LOCALBASE}/lib/}
635
lib_file=${lib_file%.so*}.so
636
warn "you need LIB_DEPENDS+=${lib_file}:${pkg}"
637
fi
638
}
639
640
proxydeps() {
641
local file dep_file dep_file_pkg already rc
642
643
rc=0
644
645
# Check all dynamicaly linked ELF files
646
# Some .so are not executable, but we want to check them too.
647
while read -r file; do
648
# No results presents a blank line from heredoc.
649
[ -z "${file}" ] && continue
650
while read -r dep_file; do
651
# No results presents a blank line from heredoc.
652
[ -z "${dep_file}" ] && continue
653
# Skip files we already checked.
654
if listcontains ${dep_file} "${already}"; then
655
continue
656
fi
657
if pkg which -q ${dep_file} > /dev/null 2>&1; then
658
dep_file_pkg=$(pkg which -qo ${dep_file})
659
660
# Check that the .so we need has a SONAME
661
if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then
662
if ! readelf -d "${dep_file}" | grep -q SONAME; then
663
err "${file} is linked to ${dep_file} which does not have a SONAME. ${dep_file_pkg} needs to be fixed."
664
fi
665
fi
666
667
# If we don't already depend on it, and we don't provide it
668
if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
669
# If the package has a flavor, check that the dependency is not on that particular flavor.
670
flavor=$(pkg annotate -q -S "$(pkg which -q "${dep_file}")" flavor)
671
if [ -n "${flavor}" ]; then
672
if listcontains ${dep_file_pkg}@${flavor} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
673
continue
674
fi
675
fi
676
err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency"
677
proxydeps_suggest_uses ${dep_file_pkg} ${dep_file}
678
rc=1
679
fi
680
else
681
err "${file} is linked to ${dep_file} that does not belong to any package"
682
rc=1
683
fi
684
already="${already} ${dep_file}"
685
done <<-EOT
686
$(env LD_LIBMAP_DISABLE=1 ldd -a "${STAGEDIR}${file}" | \
687
awk '
688
BEGIN {section=0}
689
/^\// {section++}
690
!/^\// && section<=1 && ($3 ~ "^'${PREFIX}'" || $3 ~ "^'${LOCALBASE}'") {print $3}')
691
EOT
692
done <<-EOT
693
$(list_stagedir_elfs | \
694
file -F $'\1' -f - | \
695
grep -a 'ELF.*FreeBSD.*dynamically linked' | \
696
cut -f 1 -d $'\1'| \
697
sed -e 's/^\.//')
698
EOT
699
700
[ -z "${PROXYDEPS_FATAL}" ] && return 0
701
702
return ${rc}
703
}
704
705
sonames() {
706
[ ! -d ${STAGEDIR}${PREFIX}/lib -o -n "${BUNDLE_LIBS}" ] && return 0
707
while read -r f; do
708
# No results presents a blank line from heredoc.
709
[ -z "${f}" ] && continue
710
# Ignore symlinks
711
[ -f "${f}" -a ! -L "${f}" ] || continue
712
if ! readelf -d ${f} | grep -q SONAME; then
713
warn "${f} doesn't have a SONAME."
714
warn "pkg(8) will not register it as being provided by the port."
715
warn "If another port depend on it, pkg will not be able to know where it comes from."
716
case "${f}" in
717
${STAGEDIR}${PREFIX}/lib/*/*)
718
warn "It is in a subdirectory, it may not be used in another port."
719
;;
720
*)
721
warn "It is directly in ${PREFIX}/lib, it is probably used by other ports."
722
;;
723
esac
724
fi
725
# Use heredoc to avoid losing rc from find|while subshell
726
done <<-EOT
727
$(find ${STAGEDIR}${PREFIX}/lib -name '*.so.*')
728
EOT
729
}
730
731
perlcore_port_module_mapping() {
732
case "$1" in
733
Net)
734
echo "Net::Config"
735
;;
736
libwww)
737
echo "LWP"
738
;;
739
*)
740
echo "$1" | sed -e 's/-/::/g'
741
;;
742
esac
743
}
744
745
perlcore() {
746
local portname version module gotsome
747
[ -x "${LOCALBASE}/bin/corelist" ] || return 0
748
for dep in ${UNIFIED_DEPENDS}; do
749
portname=$(expr "${dep}" : ".*/p5-\(.*\)")
750
if [ -n "${portname}" ]; then
751
gotsome=1
752
module=$(perlcore_port_module_mapping "${portname}")
753
version=$(expr "${dep}" : ".*>=*\([^:<]*\)")
754
755
while read -r l; do
756
case "${l}" in
757
*was\ not\ in\ CORE*)
758
# This never was with Perl
759
# CORE, so nothing to do here
760
;;
761
*and\ removed*)
762
# This was in Perl CORE but has
763
# been removed since.
764
warn "${dep##*:} was in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if it should be conditionally added depending on PERL_LEVEL"
765
;;
766
*deprecated*in*)
767
# This is in Perl CORE but is
768
# deprecated.
769
warn "${dep##*:} is in Perl CORE but deprecated. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL"
770
;;
771
*was\ first\ released*)
772
# This is in Perl CORE and is
773
# maybe not needed.
774
warn "${dep##*:} is present in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL"
775
;;
776
*)
777
err "This line is not handled: \"${l}\""
778
esac
779
done <<-EOT
780
$(${LOCALBASE}/bin/corelist "${module}"|tail -1)
781
EOT
782
fi
783
done
784
if [ -n "${gotsome}" ] && ! pkg info -e devel/p5-Module-CoreList; then
785
notice "You have some Perl modules as dependencies but you do not have devel/p5-Module-CoreList installed, the perlcore QA check gets better results when using it, especially with older Perl versions."
786
fi
787
}
788
789
no_arch() {
790
[ -z "$NO_ARCH" ] && return
791
rc=0
792
while read -r f; do
793
[ -z "$f" ] && continue
794
if [ -n "$NO_ARCH_IGNORE" ]; then
795
skip=
796
for blacklist in $NO_ARCH_IGNORE; do
797
case $f in
798
*$blacklist) skip=1; break;;
799
esac
800
done
801
[ "$skip" ] && continue
802
fi
803
err "'${f#.}' is a architecture specific binary file and you have set NO_ARCH. Either remove NO_ARCH or add '$(basename $f)' to NO_ARCH_IGNORE."
804
rc=1
805
done <<-EOF
806
$(list_stagedir_elfs \
807
| file -F $'\1' -f - -N \
808
| grep -aE 'ELF .* [LM]SB .*, .*, version [0-9]+ \(FreeBSD\)' \
809
| cut -f 1 -d $'\1')
810
EOF
811
return $rc
812
}
813
814
gemdeps()
815
{
816
rc=0
817
if [ "${PKGBASE%%-*}" = "rubygem" ]; then
818
# shellcheck disable=SC2153
819
# In the heredoc, ${PORTNAME} comes from the environment, not
820
# to be confused with ${portname}
821
while read -r l; do
822
if [ -n "${l}" ]; then
823
name=${l%% *}
824
vers=${l#* }
825
while read -r v; do
826
if ! while read -r p; do
827
${LOCALBASE}/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')"
828
done | grep -qFx OK; then
829
err RubyGem dependency ${name} ${v} is not satisfied.
830
rc=1
831
fi <<-EOF
832
$(${LOCALBASE}/bin/gem list -e "${name}" \
833
| sed "s|.*(\(.*\))|\1|" \
834
| tr -d ' ' \
835
| tr , '\n')
836
EOF
837
done <<-EOF
838
$(while echo "${vers}" | grep -q '"'; do
839
echo "${vers}" | cut -d '"' -f2
840
vers=$(echo "${vers}"|cut -d '"' -f3-)
841
done)
842
EOF
843
fi
844
done <<-EOF
845
$(grep -a 'add_runtime_dependency' ${STAGEDIR}${PREFIX}/lib/ruby/gems/*/specifications/${PORTNAME}-*.gemspec \
846
| sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \
847
| sort -u)
848
EOF
849
fi
850
return $rc
851
}
852
853
# If an non rubygem-port has a 'Gemfile' file
854
# it is checked with bundle to be sure
855
# all dependencies are satisfied.
856
# Without the check missing/wrong dependencies
857
# are just found when executing the application
858
gemfiledeps()
859
{
860
# skip check if port does not use ruby at all
861
if [ -z "$USE_RUBY" ]; then
862
return 0
863
fi
864
865
# skip check if port is a rubygem-* one; they have no Gemfiles
866
if [ "${PKGBASE%%-*}" = "rubygem" ]; then
867
return 0
868
fi
869
870
# advise install of bundler if its not present for check
871
if ! type bundle > /dev/null 2>&1; then
872
notice "Please install sysutils/rubygem-bundler for additional Gemfile-checks"
873
return 0
874
fi
875
876
# locate the Gemfile(s)
877
while read -r f; do
878
879
# no results presents a blank line from heredoc
880
[ -z "$f" ] && continue
881
882
# if there is no Gemfile everything is fine - stop here
883
[ ! -f "$f" ] && return 0;
884
885
# use bundle to check if Gemfile is satisfied
886
# if bundle returns 1 the Gemfile is not satisfied
887
# and so stage-qa isn't also
888
if ! bundle check --dry-run --gemfile $f > /dev/null 2>&1; then
889
warn "Dependencies defined in ${f} are not satisfied"
890
fi
891
892
done <<-EOF
893
$(find ${STAGEDIR} -name Gemfile)
894
EOF
895
return 0
896
}
897
898
flavors()
899
{
900
local rc pkgnames uniques
901
rc=0
902
if [ -n "${FLAVOR}" ]; then
903
pkgnames=$(make -C "${CURDIR}" flavors-package-names|sort)
904
uniques=$(echo "${pkgnames}"|uniq)
905
if [ "$pkgnames" != "${uniques}" ]; then
906
err "Package names are not unique with flavors:"
907
make -C "${CURDIR}" pretty-flavors-package-names >&2
908
err "maybe use <flavor>_PKGNAMEPREFIX/SUFFIX".
909
rc=1
910
fi
911
fi
912
return ${rc}
913
}
914
915
license()
916
{
917
local lic autoaccept pkgmirror #distsell distmirror pkgsell
918
919
if [ -n "$DISABLE_LICENSES" ]; then
920
warn "You have disabled the licenses framework with DISABLE_LICENSES, unable to run checks"
921
elif [ -n "$LICENSE" ]; then
922
for lic in $LICENSE_PERMS; do
923
case "$lic" in
924
auto-accept) autoaccept=1 ;;
925
#dist-mirror) distmirror=1 ;;
926
#dist-sell) distsell=1 ;;
927
pkg-mirror) pkgmirror=1 ;;
928
#pkg-sell) pkgsell=1 ;;
929
esac
930
done
931
932
if [ -z "$autoaccept" ]; then
933
warn "License is not auto-accepted, packages will not be built, ports depending on this one will be ignored."
934
fi
935
if [ -z "$pkgmirror" ]; then
936
warn "License does not allow package to be distributed, ports depending on this one will be ignored"
937
fi
938
fi
939
940
return 0
941
}
942
943
# This is to prevent adding dependencies to meta ports that are only there to
944
# improve the end user experience.
945
depends_blacklist()
946
{
947
local dep rc instead
948
949
rc=0
950
951
for dep in ${UNIFIED_DEPENDS}; do
952
origin=$(expr "${dep}" : ".*:\([^@]*\)")
953
instead=""
954
955
case "$origin" in
956
lang/python|lang/python2|lang/python3)
957
# lang/python depends on lang/pythonX, but it's
958
# ok, it is also in the blacklist.
959
if [ ${PKGORIGIN} != lang/python ]; then
960
instead="USES=python:xy with a specific version"
961
fi
962
;;
963
lang/gcc)
964
instead="USE_GCC"
965
;;
966
lang/julia)
967
instead="a dependency on lang/julia\${JULIA_DEFAULT:S/.//}"
968
;;
969
devel/llvm)
970
instead="a dependency on devel/llvm\${LLVM_DEFAULT}"
971
;;
972
www/py-django)
973
instead="one of the www/py-djangoXYZ port"
974
;;
975
esac
976
977
if [ -n "${instead}" ]; then
978
err "$origin should not be depended upon. Instead, use $instead."
979
rc=1
980
fi
981
done
982
983
return $rc
984
}
985
986
pkgmessage()
987
{
988
for message in ${PKGMESSAGES}; do
989
if [ -f "${message}" ]; then
990
if ! head -1 "${message}" | grep -q '^\['; then
991
warn "${message} not in UCL format, will be shown on initial install only."
992
warn "See https://www.freebsd.org/doc/en/books/porters-handbook/pkg-files.html#porting-message"
993
fi
994
fi
995
done
996
997
return 0
998
}
999
1000
reinplace()
1001
{
1002
if [ -f ${REWARNFILE} ]; then
1003
warn "Possible REINPLACE_CMD issues:"
1004
cat ${REWARNFILE}
1005
fi
1006
}
1007
1008
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo"
1009
checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo"
1010
checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors"
1011
checks="$checks license depends_blacklist pkgmessage reinplace"
1012
1013
ret=0
1014
cd ${STAGEDIR} || exit 1
1015
for check in ${checks}; do
1016
eval check_test="\$IGNORE_QA_$check"
1017
if [ -z "${check_test}" ]; then
1018
${check} || ret=1
1019
else
1020
warn "Ignoring $check QA test"
1021
fi
1022
done
1023
1024
exit ${ret}
1025
1026