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" |
12 |
exit 1 |
13 |
} |
14 |
|
15 |
[ "$#" -eq 1 ] || usage |
16 |
PKG_NAME="$1" |
17 |
|
10 |
LF=$(printf '\nX') |
18 |
LF=$(printf '\nX') |
11 |
LF=${LF%X} |
19 |
LF=${LF%X} |
12 |
|
20 |
|
Lines 18-23
Link Here
|
18 |
echo "Error: $@" >&2 |
26 |
echo "Error: $@" >&2 |
19 |
} |
27 |
} |
20 |
|
28 |
|
|
|
29 |
listcontains() { |
30 |
local str lst elt |
31 |
str=$1 |
32 |
lst=$2 |
33 |
|
34 |
for elt in ${lst} ; do |
35 |
if [ ${elt} = ${str} ] ; then |
36 |
return 0 |
37 |
fi |
38 |
done |
39 |
return 1 |
40 |
} |
41 |
|
42 |
list_staged_execs() { |
43 |
# finds all dynamic executables which have dependencies that aren't within the |
44 |
# declared set of dependencies in this port |
45 |
find ${STAGEDIR} -type f \ |
46 |
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ |
47 |
-and -exec /bin/sh -c "ldd {} > /dev/null 2>&1" \; \ |
48 |
-and -exec echo {} \; |
49 |
} |
50 |
|
51 |
list_all_deps() { |
52 |
ldd "$1" | grep -v "^\/" | sed -e 's/.*=> //' -e 's/ .*//' | sort | uniq |
53 |
} |
54 |
|
21 |
shebangonefile() { |
55 |
shebangonefile() { |
22 |
local f interp rc |
56 |
local f interp rc |
23 |
|
57 |
|
Lines 255-262
Link Here
|
255 |
fi |
289 |
fi |
256 |
} |
290 |
} |
257 |
|
291 |
|
258 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl" |
292 |
basemix() { |
|
|
293 |
if expr "${PKG_NAME}" : 'pkg-' > /dev/null ; then |
294 |
return 0 |
295 |
fi |
296 |
# shared libraries from base banned from being used by ports |
297 |
local banned="libssl.so libcrypto.so" |
298 |
for file in $(list_staged_execs); do |
299 |
local dep_files=$(list_all_deps "${file}") |
300 |
for dep_file in $dep_files; do |
301 |
if expr "$dep_file" : '^/lib/' \| "$dep_file" : '^/usr/lib/' > /dev/null ; then |
302 |
local so_name=$(echo "${dep_file}" | sed -e "s/.*\///g" -e "s/\.so.*/.so/g") |
303 |
if listcontains ${so_name} "${banned}" ; then |
304 |
err "Shared library ${so_name} from the base system should not be used by port." |
305 |
return 1 |
306 |
fi |
307 |
fi |
308 |
done |
309 |
done |
310 |
} |
259 |
|
311 |
|
|
|
312 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl basemix" |
313 |
|
260 |
ret=0 |
314 |
ret=0 |
261 |
cd ${STAGEDIR} |
315 |
cd ${STAGEDIR} |
262 |
for check in ${checks}; do |
316 |
for check in ${checks}; do |