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 |
[ -n "$1" ] || usage |
16 |
[ -n "$2" ] || usage |
17 |
|
18 |
PKG_NAME=$1 |
19 |
PKG_DEPS=$2 |
20 |
|
10 |
LF=$(printf '\nX') |
21 |
LF=$(printf '\nX') |
11 |
LF=${LF%X} |
22 |
LF=${LF%X} |
12 |
|
23 |
|
Lines 18-23
Link Here
|
18 |
echo "Error: $@" >&2 |
29 |
echo "Error: $@" >&2 |
19 |
} |
30 |
} |
20 |
|
31 |
|
|
|
32 |
listcontains() { |
33 |
local str lst elt |
34 |
str=$1 |
35 |
lst=$2 |
36 |
|
37 |
for elt in ${lst} ; do |
38 |
if [ ${elt} = ${str} ] ; then |
39 |
return 0 |
40 |
fi |
41 |
done |
42 |
return 1 |
43 |
} |
44 |
|
21 |
shebangonefile() { |
45 |
shebangonefile() { |
22 |
local f interp rc |
46 |
local f interp rc |
23 |
|
47 |
|
Lines 206-213
Link Here
|
206 |
fi |
230 |
fi |
207 |
} |
231 |
} |
208 |
|
232 |
|
209 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool" |
233 |
proxydeps_suggest_uses() { |
|
|
234 |
local pkg=$1 |
235 |
if expr ${pkg} : '^gettext-[0-9]' > /dev/null ; then |
236 |
warn "you need USES+=gettext" |
237 |
fi |
238 |
if expr ${pkg} : '^glib-2' > /dev/null ; then |
239 |
warn "you need USE_GNOME+=glib20" |
240 |
fi |
241 |
if expr ${pkg} : '^cairo-[0-9]' > /dev/null ; then |
242 |
warn "you need USE_GNOME+=cairo" |
243 |
fi |
244 |
# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk |
245 |
if echo ${pkg} | grep -E '^lib(X11|Xau|Xdmcp|Xext|SM|ICE|Xfixes|Xft|Xdamage|Xcomposite|Xmu|Xmuu|Xpm|Xt|Xi|Xrandr|Xrender|Xres)-' > /dev/null ; then |
246 |
warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's/^lib(.+)\-.*/\1/' | tr '[:upper:]' '[:lower:]')" |
247 |
fi |
248 |
# Qt4 |
249 |
if echo ${pkg} | grep -E '^qt4-([a-z]+)-[0-9]' > /dev/null ; then |
250 |
warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's/^qt4-([a-z]+)-[0-9].*/\1/')" |
251 |
fi |
252 |
# Qt5 |
253 |
if echo ${pkg} | grep -E '^qt5-([a-z]+)-[0-9]' > /dev/null ; then |
254 |
warn "you need USE_QT5+=$(echo ${pkg} | sed -E 's/^qt5-([a-z]+)-[0-9].*/\1/')" |
255 |
fi |
256 |
} |
210 |
|
257 |
|
|
|
258 |
proxydeps_check() { |
259 |
local pkg=$1 |
260 |
local filelist=$2 |
261 |
local deplist=$3 |
262 |
|
263 |
local file dep_file dep_file_pkg already pkg_dep_files |
264 |
|
265 |
# check for every dynamic executable |
266 |
for file in ${filelist}; do |
267 |
pkg_dep_files=$(ldd -a "${file}" | \ |
268 |
awk 'BEGIN {section=0}; /^\// {section++} /^[^\/]/ {if(section<=1) print}' | \ |
269 |
sed -e 's/.*=> //' | sed -e 's/ .*//') |
270 |
# check every dependency file |
271 |
for dep_file in $pkg_dep_files; do |
272 |
if listcontains ${dep_file} "${already}" ; then |
273 |
continue |
274 |
fi |
275 |
if ! (expr "$dep_file" : '^/lib/' \| "$dep_file" : '^/usr/lib/' > /dev/null) ; then |
276 |
if $(pkg which ${dep_file} > /dev/null 2>&1) ; then |
277 |
dep_file_pkg=$(pkg which ${dep_file} | sed -e 's/.* installed by package //g') |
278 |
if ! listcontains ${dep_file_pkg} "${deplist} ${pkg}" ; then |
279 |
warn "dependency file ${dep_file} belongs to the package ${dep_file_pkg} which isn't declared as a dependency" |
280 |
proxydeps_suggest_uses ${dep_file_pkg} |
281 |
fi |
282 |
else |
283 |
warn "dependency file ${dep_file} doesn't belong to any package" |
284 |
fi |
285 |
fi |
286 |
already="${already} ${dep_file}" |
287 |
done |
288 |
done |
289 |
} |
290 |
|
291 |
|
292 |
proxydeps() { |
293 |
# finds all dynamic executables which have dependencies that aren't within the |
294 |
# declared set of dependencies in this port |
295 |
local filelist |
296 |
filelist=`find ${STAGEDIR} -type f \ |
297 |
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ |
298 |
-and -exec /bin/sh -c "ldd {} > /dev/null 2>&1" \; \ |
299 |
-and -exec echo {} \;` |
300 |
proxydeps_check ${PKG_NAME} "${filelist}" "${PKG_DEPS}" |
301 |
} |
302 |
|
303 |
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool proxydeps" |
304 |
|
211 |
ret=0 |
305 |
ret=0 |
212 |
cd ${STAGEDIR} |
306 |
cd ${STAGEDIR} |
213 |
for check in ${checks}; do |
307 |
for check in ${checks}; do |