View | Details | Raw Unified | Return to bug 195203 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/Scripts/qa-proxydeps.sh (+154 lines)
Line 0 Link Here
1
#!/bin/sh
2
# MAINTAINER: portmgr@FreeBSD.org
3
# $FreeBSD$
4
5
#
6
# This module finds shared objects that the port immediately depends on that
7
# are not declared as immediate dependencies.
8
#
9
10
listcontains() {
11
	local str lst elt
12
	str=$1
13
	lst=$2
14
15
	for elt in ${lst} ; do
16
		if [ ${elt} = ${str} ] ; then
17
			return 0
18
		fi
19
	done
20
	return 1
21
}
22
23
list_staged_execs() {
24
	# finds all dynamic executables which have dependencies that aren't within the
25
	# declared set of dependencies in this port
26
	find ${STAGEDIR} -type f \
27
		\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
28
		-and -exec /bin/sh -c "ldd {} > /dev/null 2>&1" \; \
29
		-and -exec echo {} \;
30
}
31
32
list_immediate_deps() {
33
	LD_LIBRARY_PATH=${LOCALBASE}/lib ldd -a "$1" | \
34
		awk 'BEGIN {section=0}; /^\// {section++} /^[^\/]/ {if(section<=1) print}' | \
35
		sed -e 's/.*=> //' -e 's/ .*//'
36
}
37
38
pkg_to_origin() {
39
	echo $(pkg info -o $1 | sed -E 's/^[^[:space:]]+[[:space:]]+//g')
40
}
41
42
proxydeps_suggest_uses() {
43
	local pkg=$1
44
	local lib_file=$2
45
46
	# miscellaneous USE clauses
47
	if expr ${pkg} : '^gettext-runtime' > /dev/null ; then
48
		warn "you need USES+=gettext"
49
	elif expr ${pkg} : '^glib-2' > /dev/null ; then
50
		warn "you need USE_GNOME+=glib20"
51
	elif expr ${pkg} : '^gdk-pixbuf2-' > /dev/null ; then
52
		warn "you need USE_GNOME+=gdkpixbuf2"
53
	elif expr ${pkg} : '^gtk2' > /dev/null ; then
54
		warn "you need USE_GNOME+=gtk20"
55
	elif expr ${pkg} : '^gtk3' > /dev/null ; then
56
		warn "you need USE_GNOME+=gtk30"
57
	elif expr ${pkg} : '^cairo-[0-9]' > /dev/null ; then
58
		warn "you need USE_GNOME+=cairo"
59
	elif expr ${pkg} : '^sqlite3' > /dev/null ; then
60
		warn "you need USES+=sqlite"
61
	# sdl-related
62
	elif expr ${pkg} : '^sdl-1' > /dev/null ; then
63
		warn "you need USE_SDL+=sdl"
64
	elif echo ${pkg} | grep -E '^sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)-' > /dev/null ; then
65
		warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's/^sdl_(.+)\-.*/\1/')"
66
	elif expr ${pkg} : '^sdl2-2' > /dev/null ; then
67
		warn "you need USE_SDL+=sdl2"
68
	elif echo ${pkg} | grep -E '^sdl2_(gfx|image|mixer|net|ttf)-' > /dev/null ; then
69
		warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's/^sdl2_(.+)\-.*/\1/')2"
70
	# gl-related
71
	elif expr ${pkg} : 'libGL-[0-9]' > /dev/null ; then
72
		warn "you need USE_GL+=gl"
73
	elif expr ${pkg} : 'gbm-[0-9]' > /dev/null ; then
74
		warn "you need USE_GL+=gbm"
75
	elif expr ${pkg} : 'libglesv2-[0-9]' > /dev/null ; then
76
		warn "you need USE_GL+=glesv2"
77
	elif expr ${pkg} : '^libEGL-[0-9]' > /dev/null ; then
78
		warn "you need USE_GL+=egl"
79
	elif expr ${pkg} : '^glew-[0-9]' > /dev/null ; then
80
		warn "you need USE_GL+=glew"
81
	elif expr ${pkg} : '^libGLU-[0-9]' > /dev/null ; then
82
		warn "you need USE_GL+=glu"
83
	elif expr ${pkg} : '^libGLw-[0-9]' > /dev/null ; then
84
		warn "you need USE_GL+=glw"
85
	elif expr ${pkg} : '^freeglut-[0-9]' > /dev/null ; then
86
		warn "you need USE_GL+=glut"
87
	# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk
88
	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
89
		warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's/^lib(.+)\-.*/\1/' | tr '[:upper:]' '[:lower:]')"
90
	elif expr ${pkg} : '^pixman-[0-9]' > /dev/null ; then
91
		warn "you need USE_XORG+=pixman"
92
	# Qt4
93
	elif echo ${pkg} | grep -E '^qt4-([a-z0-9]+)-[0-9]' > /dev/null ; then
94
		warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's/^qt4-([a-z0-9]+)-[0-9].*/\1/')"
95
	# Qt5
96
	elif echo ${pkg} | grep -E '^qt5-([a-z]+)-[0-9]' > /dev/null ; then
97
		warn "you need USE_QT5+=$(echo ${pkg} | sed -E 's/^qt5-([a-z]+)-[0-9].*/\1/')"
98
	# MySQL
99
	elif expr ${lib_file} : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null ; then
100
		warn "you need USES+=mysql"
101
	# default
102
	elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null ; then
103
		lib_file=${lib_file#${LOCALBASE}/lib/}
104
		lib_file=${lib_file%.so*}.so
105
		warn "you need LIB_DEPENDS+=${lib_file}:$(pkg_to_origin ${pkg})"
106
	fi
107
}
108
109
subst_dep_file() {
110
	local dep_file=$1
111
	if expr ${dep_file} : "${LOCALBASE}/lib/libGL.so.[0-9]$" > /dev/null ; then
112
		if [ -f ${LOCALBASE}/lib/.mesa/libGL.so ] ; then
113
			echo ${LOCALBASE}/lib/.mesa/libGL.so
114
			return
115
		fi
116
	elif expr ${dep_file} : "${LOCALBASE}/lib/libEGL.so.[0-9]$" > /dev/null ; then
117
		if [ -f ${LOCALBASE}/lib/.mesa/libEGL.so ] ; then
118
			echo ${LOCALBASE}/lib/.mesa/libEGL.so
119
			return
120
		fi
121
	fi
122
	echo ${dep_file}
123
}
124
125
proxydeps() {
126
	local pkg="${PKG_NAME}"
127
	local filelist="$(list_staged_execs)"
128
	local deplist="${PKG_DEPS}"
129
130
	local file dep_file dep_file_pkg already pkg_dep_files
131
132
	# check for every dynamic executable
133
	for file in ${filelist}; do
134
		pkg_dep_files=$(list_immediate_deps "${file}")
135
		for dep_file in $pkg_dep_files; do
136
			dep_file=$(subst_dep_file ${dep_file})
137
			if listcontains ${dep_file} "${already}" ; then
138
				continue
139
			fi
140
			if ! (expr "$dep_file" : '^/lib/' \| "$dep_file" : '^/usr/lib/' > /dev/null) ; then
141
				if $(pkg which ${dep_file} > /dev/null 2>&1) ; then
142
					dep_file_pkg=$(pkg which ${dep_file} | sed -e 's/.* installed by package //g')
143
					if ! listcontains ${dep_file_pkg} "${deplist} ${pkg}" && [ $(pkg_to_origin ${dep_file_pkg}) != ${PKG_ORIGIN} ] ; then
144
						warn "dependency file '${dep_file}' belongs to the package ${dep_file_pkg} which isn't declared as a dependency"
145
						proxydeps_suggest_uses ${dep_file_pkg} ${dep_file}
146
					fi
147
				else
148
					warn "dependency file '${dep_file}' doesn't belong to any package"
149
				fi
150
			fi
151
			already="${already} ${dep_file}"
152
		done
153
	done
154
}
(-)Mk/Scripts/qa.sh (-1 / +15 lines)
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-origin pkg-deps scriptsdir"
12
	exit 1
13
}
14
15
[ "$#" -eq 4 ] || usage
16
17
PKG_NAME=$1
18
PKG_ORIGIN=$2
19
PKG_DEPS=$3
20
SCRIPTSDIR=$4
21
22
. ${SCRIPTSDIR}/qa-proxydeps.sh
23
10
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
24
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
11
25
12
LF=$(printf '\nX')
26
LF=$(printf '\nX')
Lines 313-319 Link Here
313
	return 0
327
	return 0
314
}
328
}
315
329
316
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl prefixvar baselibs terminfo"
330
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl prefixvar baselibs terminfo proxydeps"
317
331
318
ret=0
332
ret=0
319
cd ${STAGEDIR}
333
cd ${STAGEDIR}
(-)Mk/bsd.port.mk (-1 / +6 lines)
Lines 4590-4595 Link Here
4590
	done ; \
4590
	done ; \
4591
	${SETENV} PKG_BIN="${PKG_BIN}" ${SH} ${SCRIPTSDIR}/actual-package-depends.sh $${depfiles} ${RUN_DEPENDS:C/(.*)\:.*/"\1"/}
4591
	${SETENV} PKG_BIN="${PKG_BIN}" ${SH} ${SCRIPTSDIR}/actual-package-depends.sh $${depfiles} ${RUN_DEPENDS:C/(.*)\:.*/"\1"/}
4592
4592
4593
ACTUAL-PACKAGE-DEPENDS-NAMES?= \
4594
	if [ "${_LIB_RUN_DEPENDS}" != "  " ]; then \
4595
		${PKG_QUERY} "%n-%v" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} 2>/dev/null || : ; \
4596
	fi
4597
4593
create-manifest:
4598
create-manifest:
4594
	@${MKDIR} ${METADIR}; \
4599
	@${MKDIR} ${METADIR}; \
4595
	(\
4600
	(\
Lines 5047-5053 Link Here
5047
.if !target(stage-qa)
5052
.if !target(stage-qa)
5048
stage-qa:
5053
stage-qa:
5049
	@${ECHO_MSG} "====> Running Q/A tests (stage-qa)"
5054
	@${ECHO_MSG} "====> Running Q/A tests (stage-qa)"
5050
	@${SETENV} ${QA_ENV} ${SH} ${SCRIPTSDIR}/qa.sh
5055
	@${SETENV} ${QA_ENV} ${SH} ${SCRIPTSDIR}/qa.sh "${PKGBASE}-${PKGVERSION}" ${PKGORIGIN} "`${ACTUAL-PACKAGE-DEPENDS-NAMES}`" ${SCRIPTSDIR}
5051
.if !defined(DEVELOPER)
5056
.if !defined(DEVELOPER)
5052
	@${ECHO_MSG} "/!\\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\\"
5057
	@${ECHO_MSG} "/!\\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\\"
5053
.endif
5058
.endif

Return to bug 195203