Lines 7-12
Link Here
|
7 |
exit 1 |
7 |
exit 1 |
8 |
fi |
8 |
fi |
9 |
|
9 |
|
|
|
10 |
usage () { |
11 |
echo "usage: $0 pkg-name pkg-deps" |
12 |
exit 1 |
13 |
} |
14 |
|
15 |
[ "$#" -eq 2 ] || usage |
16 |
|
17 |
PKG_NAME=$1 |
18 |
PKG_DEPS=$2 |
19 |
|
10 |
LF=$(printf '\nX') |
20 |
LF=$(printf '\nX') |
11 |
LF=${LF%X} |
21 |
LF=${LF%X} |
12 |
|
22 |
|
Lines 18-23
Link Here
|
18 |
echo "Error: $@" >&2 |
28 |
echo "Error: $@" >&2 |
19 |
} |
29 |
} |
20 |
|
30 |
|
|
|
31 |
listcontains() { |
32 |
local str lst elt |
33 |
str=$1 |
34 |
lst=$2 |
35 |
|
36 |
for elt in ${lst} ; do |
37 |
if [ ${elt} = ${str} ] ; then |
38 |
return 0 |
39 |
fi |
40 |
done |
41 |
return 1 |
42 |
} |
43 |
|
21 |
shebangonefile() { |
44 |
shebangonefile() { |
22 |
local f interp rc |
45 |
local f interp rc |
23 |
|
46 |
|
Lines 255-262
Link Here
|
255 |
fi |
278 |
fi |
256 |
} |
279 |
} |
257 |
|
280 |
|
258 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl" |
281 |
proxydeps_suggest_uses() { |
|
|
282 |
local pkg=$1 |
283 |
local lib_file=$2 |
284 |
|
285 |
if expr ${pkg} : '^gettext-[0-9]' > /dev/null ; then |
286 |
warn "you need USES+=gettext" |
287 |
elif expr ${pkg} : '^glib-2' > /dev/null ; then |
288 |
warn "you need USE_GNOME+=glib20" |
289 |
elif expr ${pkg} : '^gdk-pixbuf2-' > /dev/null ; then |
290 |
warn "you need USE_GNOME+=gdkpixbuf2" |
291 |
elif expr ${pkg} : '^cairo-[0-9]' > /dev/null ; then |
292 |
warn "you need USE_GNOME+=cairo" |
293 |
# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk |
294 |
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|Xv|Xxf86vm|Xxf86dga|Xxf86misc)-' > /dev/null ; then |
295 |
warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's/^lib(.+)\-.*/\1/' | tr '[:upper:]' '[:lower:]')" |
296 |
# Qt4 |
297 |
elif echo ${pkg} | grep -E '^qt4-([a-z0-9]+)-[0-9]' > /dev/null ; then |
298 |
warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's/^qt4-([a-z0-9]+)-[0-9].*/\1/')" |
299 |
# Qt5 |
300 |
elif echo ${pkg} | grep -E '^qt5-([a-z]+)-[0-9]' > /dev/null ; then |
301 |
warn "you need USE_QT5+=$(echo ${pkg} | sed -E 's/^qt5-([a-z]+)-[0-9].*/\1/')" |
302 |
elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null ; then |
303 |
warn "you need LIB_DEPENDS+=${lib_file#${LOCALBASE}/lib/}:\${PORTSDIR}/$(pkg info -o ${pkg} | sed -E 's/^[^[:space:]]+[[:space:]]+//g')" |
304 |
fi |
305 |
} |
259 |
|
306 |
|
|
|
307 |
proxydeps_check() { |
308 |
local pkg=$1 |
309 |
local filelist=$2 |
310 |
local deplist=$3 |
311 |
|
312 |
local file dep_file dep_file_pkg already pkg_dep_files |
313 |
|
314 |
# check for every dynamic executable |
315 |
for file in ${filelist}; do |
316 |
pkg_dep_files=$(ldd -a "${file}" | \ |
317 |
awk 'BEGIN {section=0}; /^\// {section++} /^[^\/]/ {if(section<=1) print}' | \ |
318 |
sed -e 's/.*=> //' | sed -e 's/ .*//') |
319 |
# check every dependency file |
320 |
for dep_file in $pkg_dep_files; do |
321 |
if listcontains ${dep_file} "${already}" ; then |
322 |
continue |
323 |
fi |
324 |
if ! (expr "$dep_file" : '^/lib/' \| "$dep_file" : '^/usr/lib/' > /dev/null) ; then |
325 |
if $(pkg which ${dep_file} > /dev/null 2>&1) ; then |
326 |
dep_file_pkg=$(pkg which ${dep_file} | sed -e 's/.* installed by package //g') |
327 |
if ! listcontains ${dep_file_pkg} "${deplist} ${pkg}" ; then |
328 |
warn "dependency file ${dep_file} belongs to the package ${dep_file_pkg} which isn't declared as a dependency" |
329 |
proxydeps_suggest_uses ${dep_file_pkg} ${dep_file} |
330 |
fi |
331 |
else |
332 |
warn "dependency file ${dep_file} doesn't belong to any package" |
333 |
fi |
334 |
fi |
335 |
already="${already} ${dep_file}" |
336 |
done |
337 |
done |
338 |
} |
339 |
|
340 |
|
341 |
proxydeps() { |
342 |
# finds all dynamic executables which have dependencies that aren't within the |
343 |
# declared set of dependencies in this port |
344 |
local filelist |
345 |
filelist=`find ${STAGEDIR} -type f \ |
346 |
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ |
347 |
-and -exec /bin/sh -c "ldd {} > /dev/null 2>&1" \; \ |
348 |
-and -exec echo {} \;` |
349 |
proxydeps_check ${PKG_NAME} "${filelist}" "${PKG_DEPS}" |
350 |
} |
351 |
|
352 |
|
353 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl proxydeps" |
354 |
|
260 |
ret=0 |
355 |
ret=0 |
261 |
cd ${STAGEDIR} |
356 |
cd ${STAGEDIR} |
262 |
for check in ${checks}; do |
357 |
for check in ${checks}; do |