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

Collapse All | Expand All

(-)Mk/Scripts/actual-package-depends.sh (-10 / +12 lines)
Lines 2-8 Link Here
2
# MAINTAINER: portmgr@FeeeBSD.org
2
# MAINTAINER: portmgr@FeeeBSD.org
3
# $FreeBSD$
3
# $FreeBSD$
4
4
5
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_ACTUAL_PACKAGE_DEPENDS}" ] && set -x
5
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_ACTUAL_PACKAGE_DEPENDS}" ] && set -x
6
6
7
if [ -z "${PKG_BIN}" ]; then
7
if [ -z "${PKG_BIN}" ]; then
8
	echo "PKG_BIN required in environment." >&2
8
	echo "PKG_BIN required in environment." >&2
Lines 12-32 fi Link Here
12
resolv_symlink() {
12
resolv_symlink() {
13
	local file tgt
13
	local file tgt
14
	file=${1}
14
	file=${1}
15
	if [ ! -L ${file} ] ; then
15
	if [ ! -L "${file}" ] ; then
16
		echo ${file}
16
		echo "${file}"
17
		return
17
		return
18
	fi
18
	fi
19
19
20
	tgt=`readlink ${file}`
20
	tgt=$(readlink "${file}")
21
	case $tgt in
21
	case $tgt in
22
	/*)
22
	/*)
23
		echo $tgt
23
		echo "$tgt"
24
		return
24
		return
25
		;;
25
		;;
26
	esac
26
	esac
27
27
28
	file=${file%/*}/${tgt}
28
	file=${file%/*}/${tgt}
29
	absolute_path ${file}
29
	absolute_path "${file}"
30
}
30
}
31
31
32
absolute_path() {
32
absolute_path() {
Lines 35-40 absolute_path() { Link Here
35
35
36
	myifs=${IFS}
36
	myifs=${IFS}
37
	IFS='/'
37
	IFS='/'
38
	# shellcheck disable=SC2086
39
	# we want splitting here.
38
	set -- ${file}
40
	set -- ${file}
39
	IFS=${myifs}
41
	IFS=${myifs}
40
	for el; do
42
	for el; do
Lines 45-51 absolute_path() { Link Here
45
		*) target="${target}/${el}" ;;
47
		*) target="${target}/${el}" ;;
46
		esac
48
		esac
47
	done
49
	done
48
	echo ${target}
50
	echo "${target}"
49
}
51
}
50
52
51
find_dep() {
53
find_dep() {
Lines 60-74 find_dep() { Link Here
60
		searchfile=$pattern
62
		searchfile=$pattern
61
		;;
63
		;;
62
	*)
64
	*)
63
		searchfile=$(/usr/bin/which ${pattern} 2>/dev/null)
65
		searchfile=$(/usr/bin/which "${pattern}" 2>/dev/null)
64
		;;
66
		;;
65
	esac
67
	esac
66
	if [ -n "${searchfile}" ]; then
68
	if [ -n "${searchfile}" ]; then
67
		${PKG_BIN} which -q ${searchfile} || ${PKG_BIN} which -q "$(resolv_symlink ${searchfile} 2>/dev/null)" ||
69
		${PKG_BIN} which -q "${searchfile}" || ${PKG_BIN} which -q "$(resolv_symlink "${searchfile}" 2>/dev/null)" ||
68
			echo "actual-package-depends: dependency on ${searchfile} not registered (normal if it belongs to base)" >&2
70
			echo "actual-package-depends: dependency on ${searchfile} not registered (normal if it belongs to base)" >&2
69
	fi
71
	fi
70
}
72
}
71
73
72
for lookup; do
74
for lookup; do
73
	${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep ${lookup})" || :
75
	${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep "${lookup}")" || :
74
done
76
done
(-)Mk/Scripts/check-stagedir.sh (-71 / +71 lines)
Lines 13-26 Link Here
13
13
14
set -e
14
set -e
15
15
16
. ${SCRIPTSDIR}/functions.sh
16
. "${SCRIPTSDIR}"/functions.sh
17
17
18
# lists an mtree file's contents, prefixed to dir.
18
# lists an mtree file's contents, prefixed to dir.
19
listmtree() { # mtreefile prefix
19
listmtree() { # mtreefile prefix
20
	{
20
	{
21
		echo '#mtree'
21
		echo '#mtree'
22
		sed 's/nochange$//;' $1
22
		sed 's/nochange$//;' "$1"
23
	} | tar -tf- | sed "s,^,$2/,;s,^$2/\.$,$2,;s,^$,/,"
23
	} | tar -tf- | sed "s,^,$2/,;s,^$2/\\.$,$2,;s,^$,/,"
24
}
24
}
25
25
26
### PRODUCE MTREE FILE
26
### PRODUCE MTREE FILE
Lines 33-39 parse_mtree() { Link Here
33
		# Use MTREE_FILE if specified and it doesn't already
33
		# Use MTREE_FILE if specified and it doesn't already
34
		# match LOCALBASE
34
		# match LOCALBASE
35
		if [ -n "${MTREE_FILE}" ]; then
35
		if [ -n "${MTREE_FILE}" ]; then
36
			if [ "${PREFIX}" != "${LOCALBASE}" -o "${MTREE_FILE}" \
36
			if [ "${PREFIX}" != "${LOCALBASE}" ] || [ "${MTREE_FILE}" \
37
			    != "${PORTSDIR}/Templates/BSD.local.dist" ]; then
37
			    != "${PORTSDIR}/Templates/BSD.local.dist" ]; then
38
				listmtree "${MTREE_FILE}" "${PREFIX}"
38
				listmtree "${MTREE_FILE}" "${PREFIX}"
39
			fi
39
			fi
Lines 45-71 parse_mtree() { Link Here
45
		# Add LOCALBASE
45
		# Add LOCALBASE
46
		a=${LOCALBASE}
46
		a=${LOCALBASE}
47
		while :; do
47
		while :; do
48
			echo ${a}
48
			echo "${a}"
49
			a=${a%/*}
49
			a=${a%/*}
50
			[ -z "${a}" ] && break
50
			[ -z "${a}" ] && break
51
		done
51
		done
52
52
53
		# Add in PREFIX if this port wants it
53
		# Add in PREFIX if this port wants it
54
		if [ ${NO_PREFIX_RMDIR} -eq 0 ]; then
54
		if [ "${NO_PREFIX_RMDIR}" -eq 0 ]; then
55
			a=${PREFIX}
55
			a=${PREFIX}
56
			while :; do
56
			while :; do
57
				echo ${a}
57
				echo "${a}"
58
				a=${a%/*}
58
				a=${a%/*}
59
				[ -z "${a}" ] && break
59
				[ -z "${a}" ] && break
60
			done
60
			done
61
		fi
61
		fi
62
	} >${WRKDIR}/.mtree
62
	} >"${WRKDIR}"/.mtree
63
}
63
}
64
64
65
# Sort a directory list by the order of the dfs-sorted file (from find -ds)
65
# Sort a directory list by the order of the dfs-sorted file (from find -d -s)
66
sort_dfs() {
66
sort_dfs() {
67
	while read dir; do
67
	while read -r dir; do
68
		grep "^[0-9]* ${dir}$" ${WRKDIR}/.staged-dirs-dfs-sorted
68
		grep "^[0-9]* ${dir}$" "${WRKDIR}"/.staged-dirs-dfs-sorted
69
	done | sort -n | cut -d ' ' -f2-
69
	done | sort -n | cut -d ' ' -f2-
70
}
70
}
71
71
Lines 73-79 sort_dfs() { Link Here
73
setup_plist_seds() {
73
setup_plist_seds() {
74
	### HANDLE PORTDOCS/PORTEXAMPLES
74
	### HANDLE PORTDOCS/PORTEXAMPLES
75
	sed_portdocsexamples="/%%DOCSDIR%%/s!^!%%PORTDOCS%%!g; /%%EXAMPLESDIR%%/s!^!%%PORTEXAMPLES%%!g;"
75
	sed_portdocsexamples="/%%DOCSDIR%%/s!^!%%PORTDOCS%%!g; /%%EXAMPLESDIR%%/s!^!%%PORTEXAMPLES%%!g;"
76
	if [ ${makeplist} -eq 0 ]; then
76
	if [ "${makeplist}" -eq 0 ]; then
77
	#	echo "=====> Using OPTIONS: ${PORT_OPTIONS}" | /usr/bin/fmt -w 79 | \
77
	#	echo "=====> Using OPTIONS: ${PORT_OPTIONS}" | /usr/bin/fmt -w 79 | \
78
	#	    sed -e '2,$s/^/                      /'
78
	#	    sed -e '2,$s/^/                      /'
79
		# Handle magical PORT* features
79
		# Handle magical PORT* features
Lines 88-138 setup_plist_seds() { Link Here
88
		unset PORT_OPTIONS
88
		unset PORT_OPTIONS
89
	fi
89
	fi
90
90
91
	sed_plist_sub=$(echo "${PLIST_SUB_SED}" | /bin/sh ${SCRIPTSDIR}/plist_sub_sed_sort.sh)
91
	sed_plist_sub=$(echo "${PLIST_SUB_SED}" | /bin/sh "${SCRIPTSDIR}"/plist_sub_sed_sort.sh)
92
	unset PLIST_SUB_SED
92
	unset PLIST_SUB_SED
93
	# Used for generate_plist
93
	# Used for generate_plist
94
	sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \
94
	sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \
95
	    ${sed_portdocsexamples} /^share\/licenses/d; \
95
	    ${sed_portdocsexamples} /^share\\/licenses/d; \
96
	    \#${LOCALBASE}/lib/debug#d;"
96
	    \\#${LOCALBASE}/lib/debug#d;"
97
	sed_dirs_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \
97
	sed_dirs_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \
98
	    ${sed_portdocsexamples} \
98
	    ${sed_portdocsexamples} \
99
	    /^@dir share\/licenses/d;"
99
	    /^@dir share\\/licenses/d;"
100
100
101
	# These prevent ignoring DOCS/EXAMPLES dirs with sed_portdocsexamples
101
	# These prevent ignoring DOCS/EXAMPLES dirs with sed_portdocsexamples
102
	sed_files="s!^${PREFIX}/!!g; ${sed_plist_sub} /^share\/licenses/d; \
102
	sed_files="s!^${PREFIX}/!!g; ${sed_plist_sub} /^share\\/licenses/d; \
103
	    \#${LOCALBASE}/lib/debug#d;"
103
	    \\#${LOCALBASE}/lib/debug#d;"
104
	sed_dirs="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \
104
	sed_dirs="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \
105
	    /^@dir share\/licenses/d;"
105
	    /^@dir share\\/licenses/d;"
106
106
107
}
107
}
108
108
109
# Generate plist from staged files
109
# Generate plist from staged files
110
generate_plist() {
110
generate_plist() {
111
	: >${WRKDIR}/.staged-plist
111
	: >"${WRKDIR}"/.staged-plist
112
112
113
	### HANDLE FILES
113
	### HANDLE FILES
114
	find ${STAGEDIR} -type f -o -type l | sort | \
114
	find "${STAGEDIR}" -type f -o -type l | sort | \
115
	    sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files
115
	    sed -e "s,${STAGEDIR},," >"${WRKDIR}"/.staged-files
116
	comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files | \
116
	comm -13 "${WRKDIR}"/.plist-files "${WRKDIR}"/.staged-files | \
117
	    sed -e "${sed_files_gen}" \
117
	    sed -e "${sed_files_gen}" \
118
	     >>${WRKDIR}/.staged-plist || :
118
	     >>"${WRKDIR}"/.staged-plist || :
119
119
120
	### HANDLE DIRS
120
	### HANDLE DIRS
121
	cat ${WRKDIR}/.plist-dirs-unsorted ${WRKDIR}/.mtree \
121
	cat "${WRKDIR}"/.plist-dirs-unsorted "${WRKDIR}"/.mtree \
122
	    | sort -u >${WRKDIR}/.traced-dirs
122
	    | sort -u >"${WRKDIR}"/.traced-dirs
123
	find ${STAGEDIR} -type d | sed -e "s,^${STAGEDIR},,;/^$/d" | sort \
123
	find "${STAGEDIR}" -type d | sed -e "s,^${STAGEDIR},,;/^$/d" | sort \
124
	    >${WRKDIR}/.staged-dirrms-sorted
124
	    >"${WRKDIR}"/.staged-dirrms-sorted
125
	find -sd ${STAGEDIR}${PREFIX} -type d -empty | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \
125
	find -s -d "${STAGEDIR}${PREFIX}" -type d -empty | sed -e "s,^${STAGEDIR},,;\\,^${PREFIX}$,d;/^$/d" \
126
	    >${WRKDIR}/.staged-dirs-dfs
126
	    >"${WRKDIR}"/.staged-dirs-dfs
127
	find -sd ${STAGEDIR} -type d ! -path "${STAGEDIR}${PREFIX}/*" | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \
127
	find -s -d "${STAGEDIR}" -type d ! -path "${STAGEDIR}${PREFIX}/*" | sed -e "s,^${STAGEDIR},,;\\,^${PREFIX}$,d;/^$/d" \
128
	    >>${WRKDIR}/.staged-dirs-dfs
128
	    >>"${WRKDIR}"/.staged-dirs-dfs
129
	sort ${WRKDIR}/.staged-dirs-dfs >${WRKDIR}/.staged-dirs-sorted
129
	sort "${WRKDIR}"/.staged-dirs-dfs >"${WRKDIR}"/.staged-dirs-sorted
130
	awk '{print FNR, $0}' ${WRKDIR}/.staged-dirs-dfs \
130
	awk '{print FNR, $0}' "${WRKDIR}"/.staged-dirs-dfs \
131
	    >${WRKDIR}/.staged-dirs-dfs-sorted
131
	    >"${WRKDIR}"/.staged-dirs-dfs-sorted
132
	# Find all staged dirs and then sort them by depth-first (find -ds)
132
	# Find all staged dirs and then sort them by depth-first (find -d -s)
133
	comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs-sorted \
133
	comm -13 "${WRKDIR}"/.traced-dirs "${WRKDIR}"/.staged-dirs-sorted \
134
	    | sort_dfs | sed "${sed_dirs_gen}" \
134
	    | sort_dfs | sed "${sed_dirs_gen}" \
135
	    >>${WRKDIR}/.staged-plist || :
135
	    >>"${WRKDIR}"/.staged-plist || :
136
}
136
}
137
137
138
# Check for files in STAGEDIR missing from plist
138
# Check for files in STAGEDIR missing from plist
Lines 141-147 check_orphans_from_plist() { Link Here
141
141
142
	echo "===> Checking for items in STAGEDIR missing from pkg-plist"
142
	echo "===> Checking for items in STAGEDIR missing from pkg-plist"
143
	# Handle whitelisting
143
	# Handle whitelisting
144
	while read path; do
144
	while read -r path; do
145
		case "${path}" in
145
		case "${path}" in
146
		*.bak) ;;
146
		*.bak) ;;
147
		*.orig) ;;
147
		*.orig) ;;
Lines 175-181 check_orphans_from_plist() { Link Here
175
			echo "Error: Orphaned: ${path}" >&2
175
			echo "Error: Orphaned: ${path}" >&2
176
		;;
176
		;;
177
		esac
177
		esac
178
	done < ${WRKDIR}/.staged-plist
178
	done < "${WRKDIR}"/.staged-plist
179
	return ${ret}
179
	return ${ret}
180
}
180
}
181
181
Lines 183-216 check_orphans_from_plist() { Link Here
183
check_missing_plist_items() {
183
check_missing_plist_items() {
184
	local ret=0
184
	local ret=0
185
	echo "===> Checking for items in pkg-plist which are not in STAGEDIR"
185
	echo "===> Checking for items in pkg-plist which are not in STAGEDIR"
186
	: >${WRKDIR}/.invalid-plist-missing
186
	: >"${WRKDIR}"/.invalid-plist-missing
187
	comm -23 ${WRKDIR}/.plist-files-no-comments ${WRKDIR}/.staged-files | \
187
	comm -23 "${WRKDIR}"/.plist-files-no-comments "${WRKDIR}"/.staged-files | \
188
	    sed -e "${sed_files}" \
188
	    sed -e "${sed_files}" \
189
	    >>${WRKDIR}/.invalid-plist-missing || :
189
	    >>"${WRKDIR}"/.invalid-plist-missing || :
190
190
191
	# Look for directories, then sort them by DFS. Must create the dirs
191
	# Look for directories, then sort them by DFS. Must create the dirs
192
	# so find -ds can be used to sort them.
192
	# so find -ds can be used to sort them.
193
	rm -rf ${WRKDIR}/.missing-dirs > /dev/null 2>&1 || :
193
	rm -rf "${WRKDIR}"/.missing-dirs > /dev/null 2>&1 || :
194
	mkdir ${WRKDIR}/.missing-dirs
194
	mkdir "${WRKDIR}"/.missing-dirs
195
	comm -23 ${WRKDIR}/.plist-dirs-sorted-no-comments \
195
	comm -23 "${WRKDIR}"/.plist-dirs-sorted-no-comments \
196
	    ${WRKDIR}/.staged-dirrms-sorted > ${WRKDIR}/.missing-plist-dirs
196
	    "${WRKDIR}"/.staged-dirrms-sorted > "${WRKDIR}"/.missing-plist-dirs
197
	# Creates the dirs in WRKDIR/.missing-dirs and ensure spaces are
197
	# Creates the dirs in WRKDIR/.missing-dirs and ensure spaces are
198
	# quoted.
198
	# quoted.
199
	sed -e "s,^,${WRKDIR}/.missing-dirs," \
199
	sed -e "s,^,${WRKDIR}/.missing-dirs," \
200
	    -e 's,^\(.*\)$,"\1",' \
200
	    -e 's,^\(.*\)$,"\1",' \
201
	    ${WRKDIR}/.missing-plist-dirs | xargs mkdir -p
201
	    "${WRKDIR}"/.missing-plist-dirs | xargs mkdir -p
202
	find -ds ${WRKDIR}/.missing-dirs | \
202
	find -d -s "${WRKDIR}"/.missing-dirs | \
203
	    sed -e "s,^${WRKDIR}/.missing-dirs,," | \
203
	    sed -e "s,^${WRKDIR}/.missing-dirs,," | \
204
	    while read dir; do \
204
	    while read -r dir; do \
205
	    grep -x "${dir}" ${WRKDIR}/.missing-plist-dirs || :; done | \
205
	    grep -x "${dir}" "${WRKDIR}"/.missing-plist-dirs || :; done | \
206
	    sed "${sed_dirs}" \
206
	    sed "${sed_dirs}" \
207
	    >>${WRKDIR}/.invalid-plist-missing || :
207
	    >>"${WRKDIR}"/.invalid-plist-missing || :
208
	rm -rf ${WRKDIR}/.missing-dirs
208
	rm -rf "${WRKDIR}"/.missing-dirs
209
	if [ -s "${WRKDIR}/.invalid-plist-missing" ]; then
209
	if [ -s "${WRKDIR}/.invalid-plist-missing" ]; then
210
		ret=1
210
		ret=1
211
		while read line; do
211
		while read -r line; do
212
			echo "Error: Missing: ${line}" >&2
212
			echo "Error: Missing: ${line}" >&2
213
		done < ${WRKDIR}/.invalid-plist-missing
213
		done < "${WRKDIR}"/.invalid-plist-missing
214
	fi
214
	fi
215
	return ${ret}
215
	return ${ret}
216
}
216
}
Lines 228-256 esac Link Here
228
validate_env STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \
228
validate_env STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \
229
    TMPPLIST PLIST_SUB_SED SCRIPTSDIR PORT_OPTIONS NO_PREFIX_RMDIR
229
    TMPPLIST PLIST_SUB_SED SCRIPTSDIR PORT_OPTIONS NO_PREFIX_RMDIR
230
230
231
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECK_STAGEDIR}" ] && set -x
231
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_CHECK_STAGEDIR}" ] && set -x
232
232
233
set -u
233
set -u
234
234
235
if [ $makeplist = 0 ] ; then
235
if [ $makeplist = 0 ] ; then
236
	echo "===> Parsing plist"
236
	echo "===> Parsing plist"
237
	parse_plist "${PREFIX}" 1 < ${TMPPLIST} \
237
	parse_plist "${PREFIX}" 1 < "${TMPPLIST}" \
238
	    3>${WRKDIR}/.plist-dirs-unsorted \
238
	    3>"${WRKDIR}"/.plist-dirs-unsorted \
239
	    >${WRKDIR}/.plist-files-unsorted
239
	    >"${WRKDIR}"/.plist-files-unsorted
240
	unset TMPPLIST
240
	unset TMPPLIST
241
	# Create the -no-comments files and trim out @comment from the plists.
241
	# Create the -no-comments files and trim out @comment from the plists.
242
	# This is used for various tests later.
242
	# This is used for various tests later.
243
	sed -e '/^@comment/d' ${WRKDIR}/.plist-dirs-unsorted \
243
	sed -e '/^@comment/d' "${WRKDIR}"/.plist-dirs-unsorted \
244
	    >${WRKDIR}/.plist-dirs-unsorted-no-comments
244
	    >"${WRKDIR}"/.plist-dirs-unsorted-no-comments
245
	sed -i '' -e 's/^@comment //' ${WRKDIR}/.plist-dirs-unsorted
245
	sed -i '' -e 's/^@comment //' "${WRKDIR}"/.plist-dirs-unsorted
246
	sed -e '/^@comment/d' ${WRKDIR}/.plist-files-unsorted | sort \
246
	sed -e '/^@comment/d' "${WRKDIR}"/.plist-files-unsorted | sort \
247
	    >${WRKDIR}/.plist-files-no-comments
247
	    >"${WRKDIR}"/.plist-files-no-comments
248
	sed -e 's/^@comment //' ${WRKDIR}/.plist-files-unsorted | sort \
248
	sed -e 's/^@comment //' "${WRKDIR}"/.plist-files-unsorted | sort \
249
	    >${WRKDIR}/.plist-files
249
	    >"${WRKDIR}"/.plist-files
250
else
250
else
251
	# generate plist - pretend the plist had been empty
251
	# generate plist - pretend the plist had been empty
252
	: >${WRKDIR}/.plist-dirs-unsorted
252
	: >"${WRKDIR}"/.plist-dirs-unsorted
253
	: >${WRKDIR}/.plist-files
253
	: >"${WRKDIR}"/.plist-files
254
	echo '/you/have/to/check/what/makeplist/gives/you'
254
	echo '/you/have/to/check/what/makeplist/gives/you'
255
fi
255
fi
256
256
Lines 261-275 generate_plist Link Here
261
261
262
# If just making plist, show results and exit successfully.
262
# If just making plist, show results and exit successfully.
263
if [ ${makeplist} -eq 1 ]; then
263
if [ ${makeplist} -eq 1 ]; then
264
	cat ${WRKDIR}/.staged-plist
264
	cat "${WRKDIR}"/.staged-plist
265
	exit 0
265
	exit 0
266
fi
266
fi
267
267
268
check_orphans_from_plist || ret=1
268
check_orphans_from_plist || ret=1
269
269
270
# Prepare plist-dirs for directory checks
270
# Prepare plist-dirs for directory checks
271
sort -u ${WRKDIR}/.plist-dirs-unsorted-no-comments \
271
sort -u "${WRKDIR}"/.plist-dirs-unsorted-no-comments \
272
    >${WRKDIR}/.plist-dirs-sorted-no-comments
272
    >"${WRKDIR}"/.plist-dirs-sorted-no-comments
273
273
274
check_missing_plist_items || ret=1
274
check_missing_plist_items || ret=1
275
275
(-)Mk/Scripts/check-vulnerable.sh (-1 / +1 lines)
Lines 9-15 set -e Link Here
9
9
10
validate_env dp_ECHO_MSG dp_PKG_BIN dp_PORTNAME dp_PKGNAME
10
validate_env dp_ECHO_MSG dp_PKG_BIN dp_PORTNAME dp_PKGNAME
11
11
12
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECK_VULNERABLE}" ] && set -x
12
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_CHECK_VULNERABLE}" ] && set -x
13
13
14
set -u
14
set -u
15
15
(-)Mk/Scripts/check_leftovers.sh (-14 / +12 lines)
Lines 23-29 Link Here
23
# The PLIST_SUB feature can be disabled by setting PLIST_SUB_SED=
23
# The PLIST_SUB feature can be disabled by setting PLIST_SUB_SED=
24
# in environment.
24
# in environment.
25
25
26
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECK_LEFTOVERS}" ] && set -x
26
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_CHECK_LEFTOVERS}" ] && set -x
27
27
28
origin="$1"
28
origin="$1"
29
[ $# -eq 1 ] || { echo "Must supply ORIGIN as parameter" >&2; exit 1; }
29
[ $# -eq 1 ] || { echo "Must supply ORIGIN as parameter" >&2; exit 1; }
Lines 35-55 portdir="${PORTSDIR}/${origin}" Link Here
35
if [ -n "${PREFIX}" ]; then
35
if [ -n "${PREFIX}" ]; then
36
	PORT_FLAGS="${PORT_FLAGS} PREFIX=${PREFIX}"
36
	PORT_FLAGS="${PORT_FLAGS} PREFIX=${PREFIX}"
37
else
37
else
38
	PREFIX=$(make -C ${portdir} -VPREFIX)
38
	PREFIX=$(make -C "${portdir}" -VPREFIX)
39
fi
39
fi
40
if [ -n "${LOCALBASE}" ]; then
40
if [ -n "${LOCALBASE}" ]; then
41
	PORT_FLAGS="${PORT_FLAGS} LOCALBASE=${LOCALBASE}"
41
	PORT_FLAGS="${PORT_FLAGS} LOCALBASE=${LOCALBASE}"
42
else
42
else
43
	LOCALBASE=$(make -C ${portdir} -VLOCALBASE)
43
	LOCALBASE=$(make -C "${portdir}" -VLOCALBASE)
44
fi
44
fi
45
if [ -z "${CCACHE_DIR}" ]; then
45
if [ -z "${CCACHE_DIR}" ]; then
46
	CCACHE_DIR=$(make -C ${portdir} -VCCACHE_DIR)
46
	CCACHE_DIR=$(make -C "${portdir}" -VCCACHE_DIR)
47
fi
47
fi
48
homedirs=$(awk -F: -v users=$(make -C ${portdir} -V USERS|sed -e 's, ,|,g;/^$/d;s,^,^(,;s,$,)$,') 'users && $1 ~ users {print $9}' ${PORTSDIR}/UIDs|sort -u|sed -e "s|/usr/local|${PREFIX}|"|tr "\n" " ")
48
homedirs=$(awk -F: -v users="$(make -C "${portdir}" -V USERS|sed -e 's, ,|,g;/^$/d;s,^,^(,;s,$,)$,')" 'users && $1 ~ users {print $9}' "${PORTSDIR}"/UIDs|sort -u|sed -e "s|/usr/local|${PREFIX}|"|tr "\\n" " ")
49
plistsub_sed=$(make -C ${portdir} -VPLIST_SUB_SED | /bin/sh ${PORTSDIR}/Mk/Scripts/plist_sub_sed_sort.sh)
49
plistsub_sed=$(make -C "${portdir}" -VPLIST_SUB_SED | /bin/sh "${PORTSDIR}"/Mk/Scripts/plist_sub_sed_sort.sh)
50
tmpplist=$(make -C ${portdir} -VTMPPLIST)
50
tmpplist=$(make -C "${portdir}" -VTMPPLIST)
51
51
52
while read modtype path extra; do
52
while read -r modtype path extra; do
53
	# Ignore everything from these files/directories
53
	# Ignore everything from these files/directories
54
	case "${path}" in
54
	case "${path}" in
55
		${CCACHE_DIR}/*|\
55
		${CCACHE_DIR}/*|\
Lines 95-101 while read modtype path extra; do Link Here
95
			# Don't show dirs already in plist (due to parents)
95
			# Don't show dirs already in plist (due to parents)
96
			grep -qE \
96
			grep -qE \
97
			    "^@(unexec rmdir \"?(%D/|${PREFIX})?${path#${PREFIX}/}[ \"]|dir(rm|rmtry)? ${path#${PREFIX}/}\$)" \
97
			    "^@(unexec rmdir \"?(%D/|${PREFIX})?${path#${PREFIX}/}[ \"]|dir(rm|rmtry)? ${path#${PREFIX}/}\$)" \
98
			    ${tmpplist} && continue
98
			    "${tmpplist}" && continue
99
		fi
99
		fi
100
100
101
		# Check absolute paths
101
		# Check absolute paths
Lines 117-132 while read modtype path extra; do Link Here
117
		# bsd.port.mk for now.
117
		# bsd.port.mk for now.
118
		# Skip if it is PREFIX and non-LOCALBASE. See misc/kdehier4
118
		# Skip if it is PREFIX and non-LOCALBASE. See misc/kdehier4
119
		# or mail/qmail for examples
119
		# or mail/qmail for examples
120
		[ "${path}" = "${PREFIX}" -a "${LOCALBASE}" != "${PREFIX}" ] &&
120
		[ "${path}" = "${PREFIX}" ] && [ "${LOCALBASE}" != "${PREFIX}" ] &&
121
		    ignore_path=1
121
		    ignore_path=1
122
122
123
		# The removal of info may be a bug; it's part of BSD.local.dist.
123
		# The removal of info may be a bug; it's part of BSD.local.dist.
124
		# See ports/74691
124
		# See ports/74691
125
125
126
		[ "${sub_path}" = "info" -a "${LOCALBASE}" != "${PREFIX}" ] &&
126
		[ "${sub_path}" = "info" ] && [ "${LOCALBASE}" != "${PREFIX}" ] &&
127
		    ignore_path=1
127
		    ignore_path=1
128
128
129
		[ $ignore_path -eq 0 ] && echo "- ${sub_path}"
129
		[ $ignore_path -eq 0 ] && printf -- "- %s\\n" "${sub_path}"
130
		;;
130
		;;
131
	M)
131
	M)
132
		# Check relative/plist paths
132
		# Check relative/plist paths
Lines 152-161 while read modtype path extra; do Link Here
152
			share/xml/catalog.ports) ;;
152
			share/xml/catalog.ports) ;;
153
			# Ignore ghc's doc index
153
			# Ignore ghc's doc index
154
			share/doc/ghc-%%GHC_VERSION%%/*) ;;
154
			share/doc/ghc-%%GHC_VERSION%%/*) ;;
155
			share/doc/ghc-%%GHC_VERSION%%/html/libraries/%%PORTNAME%%-%%PORTVERSION%%/html) ;;
156
			# Ignore ghc's package conf
155
			# Ignore ghc's package conf
157
			lib/ghc-%%GHC_VERSION%%/package.conf.d/*) ;;
156
			lib/ghc-%%GHC_VERSION%%/package.conf.d/*) ;;
158
			lib/ghc-%%GHC_VERSION%%/package.conf.d/%%PORTNAME%%-%%PORTVERSION%%.conf) ;;
159
			# Ignore common system config files
157
			# Ignore common system config files
160
			/etc/group|\
158
			/etc/group|\
161
			/etc/make.conf|\
159
			/etc/make.conf|\
(-)Mk/Scripts/checksum.sh (-5 / +9 lines)
Lines 11-17 validate_env dp_CHECKSUM_ALGORITHMS dp_CURDIR dp_DISTDIR dp_DISTINFO_FILE \ Link Here
11
	dp_DIST_SUBDIR dp_ECHO_MSG dp_FETCH_REGET dp_MAKE dp_MAKEFLAGS \
11
	dp_DIST_SUBDIR dp_ECHO_MSG dp_FETCH_REGET dp_MAKE dp_MAKEFLAGS \
12
	dp_DISABLE_SIZE dp_NO_CHECKSUM
12
	dp_DISABLE_SIZE dp_NO_CHECKSUM
13
13
14
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECKSUM}" ] && set -x
14
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_CHECKSUM}" ] && set -x
15
15
16
set -u
16
set -u
17
17
Lines 34-40 if [ -f "${dp_DISTINFO_FILE}" ]; then Link Here
34
				ignore="true"
34
				ignore="true"
35
			fi
35
			fi
36
36
37
			if [ $ignore = "false" -a -z "$CKSUM" ]; then
37
			if [ $ignore = "false" ] && [ -z "$CKSUM" ]; then
38
				${dp_ECHO_MSG} "=> No $alg checksum recorded for $file."
38
				${dp_ECHO_MSG} "=> No $alg checksum recorded for $file."
39
				ignore="true"
39
				ignore="true"
40
			fi
40
			fi
Lines 57-63 if [ -f "${dp_DISTINFO_FILE}" ]; then Link Here
57
				${dp_ECHO_MSG} "=> $alg Checksum mismatch for $file."
57
				${dp_ECHO_MSG} "=> $alg Checksum mismatch for $file."
58
				refetchlist="$refetchlist $file "
58
				refetchlist="$refetchlist $file "
59
				OK="${OK:-retry}"
59
				OK="${OK:-retry}"
60
				[ "${OK}" = "retry" -a "${dp_FETCH_REGET}" -gt 0 ] && rm -f "${file}"
60
				if [ "${OK}" = "retry" ] && [ "${dp_FETCH_REGET}" -gt 0 ]; then
61
					rm -f "${file}"
62
				fi
61
				ignored="false"
63
				ignored="false"
62
			fi
64
			fi
63
		done
65
		done
Lines 70-75 if [ -f "${dp_DISTINFO_FILE}" ]; then Link Here
70
72
71
	if [ "${OK:=true}" = "retry" ] && [ "${dp_FETCH_REGET}" -gt 0 ]; then
73
	if [ "${OK:=true}" = "retry" ] && [ "${dp_FETCH_REGET}" -gt 0 ]; then
72
		${dp_ECHO_MSG} "===>  Refetch for ${dp_FETCH_REGET} more times files: $refetchlist"
74
		${dp_ECHO_MSG} "===>  Refetch for ${dp_FETCH_REGET} more times files: $refetchlist"
75
		# shellcheck disable=SC2086
76
		# dp_MAKEFLAGS contains arguments, needs splitting.
73
		if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FORCE_FETCH_LIST="$refetchlist" FETCH_REGET="$((dp_FETCH_REGET - 1))" fetch; then
77
		if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FORCE_FETCH_LIST="$refetchlist" FETCH_REGET="$((dp_FETCH_REGET - 1))" fetch; then
74
			if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FETCH_REGET="$((dp_FETCH_REGET - 1))" checksum ; then
78
			if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FETCH_REGET="$((dp_FETCH_REGET - 1))" checksum ; then
75
			OK="true"
79
			OK="true"
Lines 77-83 if [ -f "${dp_DISTINFO_FILE}" ]; then Link Here
77
		fi
81
		fi
78
	fi
82
	fi
79
83
80
	if [ "$OK" != "true" -a "${dp_FETCH_REGET}" -eq 0 ]; then
84
	if [ "$OK" != "true" ] && [ "${dp_FETCH_REGET}" -eq 0 ]; then
81
		${dp_ECHO_MSG} "===>  Giving up on fetching files: $refetchlist"
85
		${dp_ECHO_MSG} "===>  Giving up on fetching files: $refetchlist"
82
		${dp_ECHO_MSG} "Make sure the Makefile and distinfo file (${dp_DISTINFO_FILE})"
86
		${dp_ECHO_MSG} "Make sure the Makefile and distinfo file (${dp_DISTINFO_FILE})"
83
		${dp_ECHO_MSG} "are up to date.  If you are absolutely sure you want to override this"
87
		${dp_ECHO_MSG} "are up to date.  If you are absolutely sure you want to override this"
Lines 87-93 if [ -f "${dp_DISTINFO_FILE}" ]; then Link Here
87
	if [ "$OK" != "true" ]; then
91
	if [ "$OK" != "true" ]; then
88
		exit 1
92
		exit 1
89
	fi
93
	fi
90
elif [ -n "${@}" ]; then
94
elif [ -n "${*}" ]; then
91
	${dp_ECHO_MSG} "=> No checksum file (${dp_DISTINFO_FILE})."
95
	${dp_ECHO_MSG} "=> No checksum file (${dp_DISTINFO_FILE})."
92
	exit 1
96
	exit 1
93
fi
97
fi
(-)Mk/Scripts/create-manifest.sh (-15 / +15 lines)
Lines 16-22 validate_env dp_ACTUAL_PACKAGE_DEPENDS dp_CATEGORIES dp_COMMENT \ Link Here
16
	dp_PKGVERSION dp_PKG_BIN dp_PKG_IGNORE_DEPENDS dp_PKG_NOTES \
16
	dp_PKGVERSION dp_PKG_BIN dp_PKG_IGNORE_DEPENDS dp_PKG_NOTES \
17
	dp_PORT_OPTIONS dp_PREFIX dp_USERS dp_WWW
17
	dp_PORT_OPTIONS dp_PREFIX dp_USERS dp_WWW
18
18
19
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CREATE_MANIFEST}" ] && set -x
19
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_CREATE_MANIFEST}" ] && set -x
20
20
21
set -u
21
set -u
22
22
Lines 26-42 listcontains() { Link Here
26
	lst=$2
26
	lst=$2
27
27
28
	for elt in ${lst} ; do
28
	for elt in ${lst} ; do
29
		if [ ${elt} = ${str} ]; then
29
		if [ "${elt}" = "${str}" ]; then
30
			return 0
30
			return 0
31
		fi
31
		fi
32
	done
32
	done
33
	return 1
33
	return 1
34
}
34
}
35
35
36
mkdir -p ${dp_METADIR}
36
mkdir -p "${dp_METADIR}"
37
37
38
# Save stdout and redirect it to the manifest file.
38
# Save stdout and redirect it to the manifest file.
39
exec 3>&1 >${dp_METADIR}/+MANIFEST
39
exec 3>&1 >"${dp_METADIR}"/+MANIFEST
40
40
41
# First, all the required bits
41
# First, all the required bits
42
cat <<EOT
42
cat <<EOT
Lines 57-73 EOT Link Here
57
[ -z "${dp_LICENSE}" ] || echo "licenses: [ ${dp_LICENSE} ]"
57
[ -z "${dp_LICENSE}" ] || echo "licenses: [ ${dp_LICENSE} ]"
58
[ -z "${dp_USERS}" ] || echo "users: [ ${dp_USERS} ]"
58
[ -z "${dp_USERS}" ] || echo "users: [ ${dp_USERS} ]"
59
[ -z "${dp_GROUPS}" ] || echo "groups: [ ${dp_GROUPS} ]"
59
[ -z "${dp_GROUPS}" ] || echo "groups: [ ${dp_GROUPS} ]"
60
[ -n "${dp_NO_ARCH}" ] && echo "arch : `${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2`:*"
60
[ -n "${dp_NO_ARCH}" ] && echo "arch : $(${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2):*"
61
[ -n "${dp_NO_ARCH}" ] && echo "abi : `${dp_PKG_BIN} config abi | cut -d: -f1,2`:*"
61
[ -n "${dp_NO_ARCH}" ] && echo "abi : $(${dp_PKG_BIN} config abi | cut -d: -f1,2):*"
62
62
63
# Then the key/values sections
63
# Then the key/values sections
64
echo "deps: { "
64
echo "deps: { "
65
eval ${dp_ACTUAL_PACKAGE_DEPENDS} | grep -v -E ${dp_PKG_IGNORE_DEPENDS} | sort -u
65
eval "${dp_ACTUAL_PACKAGE_DEPENDS}" | grep -v -E "${dp_PKG_IGNORE_DEPENDS}" | sort -u
66
echo "}"
66
echo "}"
67
67
68
echo "options: {"
68
echo "options: {"
69
for opt in ${dp_COMPLETE_OPTIONS_LIST}; do
69
for opt in ${dp_COMPLETE_OPTIONS_LIST}; do
70
	if listcontains ${opt} "${dp_PORT_OPTIONS}"; then
70
	if listcontains "${opt}" "${dp_PORT_OPTIONS}"; then
71
		echo " ${opt}: on,"
71
		echo " ${opt}: on,"
72
	else
72
	else
73
		echo " ${opt}: off,"
73
		echo " ${opt}: off,"
Lines 86-92 if [ -n "${dp_PKG_NOTES}" ]; then Link Here
86
fi
86
fi
87
87
88
# Copy the pkg-descr file
88
# Copy the pkg-descr file
89
cp ${dp_DESCR} ${dp_METADIR}/+DESC
89
cp "${dp_DESCR}" "${dp_METADIR}/+DESC"
90
90
91
# Concatenate all the scripts
91
# Concatenate all the scripts
92
output_files=
92
output_files=
Lines 96-123 for stage in INSTALL DEINSTALL UPGRADE; do Link Here
96
		[ -f "${output}" ] && output_files="${output_files:+${output_files} }${output}"
96
		[ -f "${output}" ] && output_files="${output_files:+${output_files} }${output}"
97
	done
97
	done
98
done
98
done
99
[ -n "${output_files}" ] && rm -f ${output_files}
99
[ -n "${output_files}" ] && rm -f "${output_files}"
100
100
101
for stage in INSTALL DEINSTALL UPGRADE; do
101
for stage in INSTALL DEINSTALL UPGRADE; do
102
	for prepost in '' PRE POST; do
102
	for prepost in '' PRE POST; do
103
		eval files="\${dp_PKG${prepost}${stage}}"
103
		eval files="\${dp_PKG${prepost}${stage}}"
104
		output=${dp_METADIR}/+${prepost:+${prepost}_}${stage}
104
		output=${dp_METADIR}/+${prepost:+${prepost}_}${stage}
105
		for input in ${files}; do
105
		for input in ${files}; do
106
			[ -f "${input}" ] && cat ${input} >> ${output}
106
			[ -f "${input}" ] && cat "${input}" >> "${output}"
107
		done
107
		done
108
	done
108
	done
109
done
109
done
110
110
111
# *** STARTING NOW, STDOUT is +DISPLAY ***
111
# *** STARTING NOW, STDOUT is +DISPLAY ***
112
112
113
exec >${dp_METADIR}/+DISPLAY
113
exec >"${dp_METADIR}/+DISPLAY"
114
114
115
for message in ${dp_PKGMESSAGES}; do
115
for message in ${dp_PKGMESSAGES}; do
116
  [ -f "${message}" ] && cat "${message}"
116
  [ -f "${message}" ] && cat "${message}"
117
done
117
done
118
118
119
# Try and keep these messages in sync with check-deprecated
119
# Try and keep these messages in sync with check-deprecated
120
if [ ${dp_MAINTAINER} = "ports@FreeBSD.org" ]; then
120
if [ "${dp_MAINTAINER}" = "ports@FreeBSD.org" ]; then
121
	if [ -f "${dp_METADIR}/+DISPLAY" ]; then echo; fi
121
	if [ -f "${dp_METADIR}/+DISPLAY" ]; then echo; fi
122
	cat <<-EOT
122
	cat <<-EOT
123
	===>   NOTICE:
123
	===>   NOTICE:
Lines 153-158 if [ -n "${dp_DEPRECATED}" ]; then Link Here
153
	fi
153
	fi
154
fi
154
fi
155
155
156
if [ ! -s ${dp_METADIR}/+DISPLAY ]; then
156
if [ ! -s "${dp_METADIR}/+DISPLAY" ]; then
157
	rm -f ${dp_METADIR}/+DISPLAY
157
	rm -f "${dp_METADIR}/+DISPLAY"
158
fi
158
fi
(-)Mk/Scripts/depends-list.sh (-7 / +17 lines)
Lines 4-10 Link Here
4
4
5
set -e
5
set -e
6
6
7
. ${dp_SCRIPTSDIR}/functions.sh
7
. "${dp_SCRIPTSDIR}"/functions.sh
8
8
9
flavors=0
9
flavors=0
10
recursive=0
10
recursive=0
Lines 38-51 done Link Here
38
shift $((OPTIND-1))
38
shift $((OPTIND-1))
39
39
40
validate_env PORTSDIR dp_PKGNAME
40
validate_env PORTSDIR dp_PKGNAME
41
if [ ${recursive} -eq 1 -o ${requires_wrkdir} -eq 1 ]; then
41
if [ ${recursive} -eq 1 ] || [ ${requires_wrkdir} -eq 1 ]; then
42
	validate_env dp_MAKE
42
	validate_env dp_MAKE
43
	# Cache command executions to avoid looking them up again in every
43
	# Cache command executions to avoid looking them up again in every
44
	# sub-make.
44
	# sub-make.
45
	MAKE="${dp_MAKE}" export_ports_env >/dev/null
45
	MAKE="${dp_MAKE}" export_ports_env >/dev/null
46
fi
46
fi
47
47
48
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DEPENDS_LIST}" ] && set -x
48
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DEPENDS_LIST}" ] && set -x
49
49
50
set -u
50
set -u
51
51
Lines 60-65 check_dep() { Link Here
60
		unset FLAVOR
60
		unset FLAVOR
61
		myifs=${IFS}
61
		myifs=${IFS}
62
		IFS=:
62
		IFS=:
63
		# shellcheck disable=SC2086
64
		# we need splitting here.
63
		set -- ${_dep}
65
		set -- ${_dep}
64
		IFS=${myifs}
66
		IFS=${myifs}
65
67
Lines 75-81 check_dep() { Link Here
75
			d=${d%@*}
77
			d=${d%@*}
76
			;;
78
			;;
77
		esac
79
		esac
78
		if [ ${flavors} -eq 1 -a -n "${FLAVOR:-}" ]; then
80
		if [ ${flavors} -eq 1 ] && [ -n "${FLAVOR:-}" ]; then
79
			port_display="${d}@${FLAVOR}"
81
			port_display="${d}@${FLAVOR}"
80
		else
82
		else
81
			port_display="${d}"
83
			port_display="${d}"
Lines 101-111 check_dep() { Link Here
101
		# Grab any needed vars from the port.
103
		# Grab any needed vars from the port.
102
104
103
		if [ ${requires_wrkdir} -eq 1 ]; then
105
		if [ ${requires_wrkdir} -eq 1 ]; then
104
			set -- $(${dp_MAKE} -C ${d} -VWRKDIR -V_UNIFIED_DEPENDS)
106
			# shellcheck disable=SC2046
107
			# We want word splitting here.
108
			set -- $(${dp_MAKE} -C "${d}" -VWRKDIR -V_UNIFIED_DEPENDS)
105
			wrkdir="$1"
109
			wrkdir="$1"
106
			shift
110
			shift
107
		elif [ ${recursive} -eq 1 ]; then
111
		elif [ ${recursive} -eq 1 ]; then
108
			set -- $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS)
112
			# shellcheck disable=SC2046
113
			# We want word splitting here.
114
			set -- $(${dp_MAKE} -C "${d}" -V_UNIFIED_DEPENDS)
109
		fi
115
		fi
110
116
111
		# If a WRKDIR is required to show the dependency, check for it.
117
		# If a WRKDIR is required to show the dependency, check for it.
Lines 114-124 check_dep() { Link Here
114
			show_dep=0
120
			show_dep=0
115
		fi
121
		fi
116
		[ ${show_dep} -eq 1 ] && echo "${port_display}"
122
		[ ${show_dep} -eq 1 ] && echo "${port_display}"
117
		if [ ${recursive} -eq 1 -o ${requires_wrkdir} -eq 1 -a ${show_dep} -eq 1 ]; then
123
		if [ ${recursive} -eq 1 ] || ( [ ${requires_wrkdir} -eq 1 ] && [ ${show_dep} -eq 1 ] ); then
124
			# shellcheck disable=SC2068
125
			# Do not add quotes, we want to split the string here.
118
			check_dep $@
126
			check_dep $@
119
		fi
127
		fi
120
	done
128
	done
121
}
129
}
122
130
123
checked=
131
checked=
132
# shellcheck disable=SC2068
133
# Do not add quotes, we want to split the string here.
124
check_dep $@
134
check_dep $@
(-)Mk/Scripts/dialog4ports.sh (-13 / +13 lines)
Lines 3-50 Link Here
3
# Maintainer: portmgr@FreeBSD.org
3
# Maintainer: portmgr@FreeBSD.org
4
set -e
4
set -e
5
5
6
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DIALOG4PORTS}" ] && set -x
6
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DIALOG4PORTS}" ] && set -x
7
7
8
if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then
8
if [ -z "${DIALOG4PORTS}" ] || [ -z "${PORTSDIR}" ] || [ -z "${MAKE}" ]; then
9
	echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&2
9
	echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&2
10
	exit 1
10
	exit 1
11
fi
11
fi
12
12
13
: ${DIALOGPORT:=ports-mgmt/dialog4ports}
13
: "${DIALOGPORT:=ports-mgmt/dialog4ports}"
14
: ${DIALOGNAME:=dialog4ports}
14
: "${DIALOGNAME:=dialog4ports}"
15
15
16
OPTIONSFILE="$1"
16
OPTIONSFILE="$1"
17
17
18
if ! [ -e $DIALOG4PORTS ]; then
18
if ! [ -e "$DIALOG4PORTS" ]; then
19
	# If INSTALL_AS_USER is set then just build and use the WRKDIR version
19
	# If INSTALL_AS_USER is set then just build and use the WRKDIR version
20
	# Also do this if PREFIX!=LOCALBASE to avoid missing file or double
20
	# Also do this if PREFIX!=LOCALBASE to avoid missing file or double
21
	# installs
21
	# installs
22
	if [ -n "${INSTALL_AS_USER}" -o "${PREFIX}" != "${LOCALBASE}" ]; then
22
	if [ -n "${INSTALL_AS_USER}" ] || [ "${PREFIX}" != "${LOCALBASE}" ]; then
23
		if ! [ -d "${PORTSDIR}/${DIALOGPORT}" ]; then
23
		if ! [ -d "${PORTSDIR}/${DIALOGPORT}" ]; then
24
			echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&2
24
			echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&2
25
			exit 1
25
			exit 1
26
		fi
26
		fi
27
		DIALOG4PORTS=$(${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -V DIALOG4PORTS)
27
		DIALOG4PORTS=$(${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -V DIALOG4PORTS)
28
		if ! [ -e "${DIALOG4PORTS}" ]; then
28
		if ! [ -e "${DIALOG4PORTS}" ]; then
29
			echo "===> Building ${DIALOGNAME} as it is required for the config dialog"
29
			echo "===> Building ${DIALOGNAME} as it is required for the config dialog"
30
			${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean build
30
			${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean build
31
		fi
31
		fi
32
	else
32
	else
33
		# Build+install through su-install as normal
33
		# Build+install through su-install as normal
34
		echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog"
34
		echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog"
35
		${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean install
35
		${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean install
36
		# Need to clean again as it can't run twice in 1 call above
36
		# Need to clean again as it can't run twice in 1 call above
37
		${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean
37
		${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean
38
	fi
38
	fi
39
fi
39
fi
40
40
41
# Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]).
41
# Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]).
42
# Clear environment of PKGNAME or the dialog will show on older versions
42
# Clear environment of PKGNAME or the dialog will show on older versions
43
# that do not understand -v.
43
# that do not understand -v.
44
if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then
44
if ! env -u PKGNAME "${DIALOG4PORTS}" -v > /dev/null 2>&1; then
45
	exec $DIALOG4PORTS > $OPTIONSFILE 2>&1
45
	exec "$DIALOG4PORTS" > "$OPTIONSFILE" 2>&1
46
fi
46
fi
47
47
48
# Newer versions use stderr to work around a jail issue
48
# Newer versions use stderr to work around a jail issue
49
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html
49
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html
50
exec $DIALOG4PORTS 2> $OPTIONSFILE
50
exec "$DIALOG4PORTS" 2> "$OPTIONSFILE"
(-)Mk/Scripts/do-depends.sh (-18 / +24 lines)
Lines 5-11 Link Here
5
5
6
set -e
6
set -e
7
7
8
. ${dp_SCRIPTSDIR}/functions.sh
8
. "${dp_SCRIPTSDIR}"/functions.sh
9
9
10
validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \
10
validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \
11
	dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \
11
	dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \
Lines 13-19 validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \ Link Here
13
	dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \
13
	dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \
14
	dp_SCRIPTSDIR PORTSDIR dp_MAKE dp_MAKEFLAGS
14
	dp_SCRIPTSDIR PORTSDIR dp_MAKE dp_MAKEFLAGS
15
15
16
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_DEPENDS}" ] && set -x
16
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DO_DEPENDS}" ] && set -x
17
17
18
set -u
18
set -u
19
19
Lines 22-29 install_depends() Link Here
22
	origin=$1
22
	origin=$1
23
	target=$2
23
	target=$2
24
	depends_args=$3
24
	depends_args=$3
25
	if [ -z "${dp_USE_PACKAGE_DEPENDS}" -a -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then
25
	if [ -z "${dp_USE_PACKAGE_DEPENDS}" ] && [ -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then
26
		MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args}
26
		# shellcheck disable=SC2086
27
		# depends_args contains arguments, needs splitting.
28
		MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C "${origin}" -DINSTALLS_DEPENDS "${target}" ${depends_args}
27
		return 0
29
		return 0
28
	fi
30
	fi
29
31
Lines 31-52 install_depends() Link Here
31
	    PKGFILE pkgfile \
33
	    PKGFILE pkgfile \
32
	    PKGBASE pkgbase
34
	    PKGBASE pkgbase
33
35
34
	if [ -r "${pkgfile}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then
36
	if [ -r "${pkgfile}" ] && [ "${target}" = "${dp_DEPENDS_TARGET}" ]; then
35
		echo "===>   Installing existing package ${pkgfile}"
37
		echo "===>   Installing existing package ${pkgfile}"
36
		if [ "${pkgbase}" = "pkg" ]; then
38
		if [ "${pkgbase}" = "pkg" ]; then
37
			[ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR}
39
			[ -d "${dp_WRKDIR}" ] || mkdir -p "${dp_WRKDIR}"
38
			tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static"
40
			tar xf "${pkgfile}" -C "${dp_WRKDIR}" -s ",/.*/,,g" "*/pkg-static"
39
			${dp_WRKDIR}/pkg-static add ${pkgfile}
41
			"${dp_WRKDIR}"/pkg-static add "${pkgfile}"
40
			rm -f ${dp_WRKDIR}/pkg-static
42
			rm -f "${dp_WRKDIR}"/pkg-static
41
		else
43
		else
42
			${dp_PKG_ADD} -A ${pkgfile}
44
			${dp_PKG_ADD} -A "${pkgfile}"
43
		fi
45
		fi
44
	elif [ -n "${dp_USE_PACKAGE_DEPENDS_ONLY}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then
46
	elif [ -n "${dp_USE_PACKAGE_DEPENDS_ONLY}" ] && [ "${target}" = "${dp_DEPENDS_TARGET}" ]; then
45
		echo "===>   ${dp_PKGNAME} depends on package: ${pkgfile} - not found" >&2
47
		echo "===>   ${dp_PKGNAME} depends on package: ${pkgfile} - not found" >&2
46
		echo "===>   USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source" >&2
48
		echo "===>   USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source" >&2
47
		exit 1
49
		exit 1
48
	else
50
	else
49
		MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args}
51
		# shellcheck disable=SC2086
52
		# depends_args contains arguments, needs splitting.
53
		MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C "${origin}" -DINSTALLS_DEPENDS "${target}" ${depends_args}
50
	fi
54
	fi
51
}
55
}
52
56
Lines 72-78 find_file() Link Here
72
76
73
find_file_path()
77
find_file_path()
74
{
78
{
75
	if which -s $1 ; then
79
	if which -s "$1" ; then
76
		echo "===>   ${dp_PKGNAME} depends on executable: $1 - found"
80
		echo "===>   ${dp_PKGNAME} depends on executable: $1 - found"
77
		return 0
81
		return 0
78
	fi
82
	fi
Lines 82-89 find_file_path() Link Here
82
86
83
find_lib()
87
find_lib()
84
{
88
{
85
	echo -n "===>   ${dp_PKGNAME} depends on shared library: $1"
89
	printf "===>   %s depends on shared library: %s" "${dp_PKGNAME}" "$1"
86
	libfile=$(env -i PATH="${PATH}" LIB_DIRS="${dp_LIB_DIRS}" LOCALBASE="${dp_LOCALBASE}" ${dp_SH} ${dp_SCRIPTSDIR}/find-lib.sh $1)
90
	libfile=$(env -i PATH="${PATH}" LIB_DIRS="${dp_LIB_DIRS}" LOCALBASE="${dp_LOCALBASE}" "${dp_SH}" "${dp_SCRIPTSDIR}"/find-lib.sh "$1")
87
	if [ -z "${libfile}" ]; then
91
	if [ -z "${libfile}" ]; then
88
		echo " - not found"
92
		echo " - not found"
89
		return 1
93
		return 1
Lines 98-106 for _line in ${dp_RAWDEPENDS} ; do Link Here
98
	unset FLAVOR
102
	unset FLAVOR
99
	myifs=${IFS}
103
	myifs=${IFS}
100
	IFS=:
104
	IFS=:
105
	# shellcheck disable=SC2086
106
	# we want splitting here.
101
	set -- ${_line}
107
	set -- ${_line}
102
	IFS=${myifs}
108
	IFS=${myifs}
103
	if [ $# -lt 2 -o $# -gt 3 ]; then
109
	if [ $# -lt 2 ] || [ $# -gt 3 ]; then
104
		echo "Error: bad dependency syntax in ${dp_DEPTYPE}" >&2
110
		echo "Error: bad dependency syntax in ${dp_DEPTYPE}" >&2
105
		echo "expecting: pattern:origin[@flavour][:target]" >&2
111
		echo "expecting: pattern:origin[@flavour][:target]" >&2
106
		echo "got: ${_line}" >&2
112
		echo "got: ${_line}" >&2
Lines 170-176 for _line in ${dp_RAWDEPENDS} ; do Link Here
170
	if ${fct} "${pattern}" ; then
176
	if ${fct} "${pattern}" ; then
171
		continue
177
		continue
172
	fi
178
	fi
173
	[ ${pattern} = "/nonexistent" ] || anynotfound=1
179
	[ "${pattern}" = "/nonexistent" ] || anynotfound=1
174
180
175
	if [ ! -f "${origin}/Makefile" ]; then
181
	if [ ! -f "${origin}/Makefile" ]; then
176
		echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2
182
		echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2
Lines 190-196 if [ $err -eq 1 ]; then Link Here
190
	exit 1
196
	exit 1
191
fi
197
fi
192
198
193
if [ -n "${dp_STRICT_DEPENDS}" -a ${anynotfound} -eq 1 ]; then \
199
if [ -n "${dp_STRICT_DEPENDS}" ] && [ ${anynotfound} -eq 1 ]; then \
194
	echo "===>   dp_STRICT_DEPENDS set - Not installing missing dependencies."
200
	echo "===>   dp_STRICT_DEPENDS set - Not installing missing dependencies."
195
	echo "       This means a dependency is wrong since it was not satisfied in the ${dp_DEPTYPE} phase."
201
	echo "       This means a dependency is wrong since it was not satisfied in the ${dp_DEPTYPE} phase."
196
	exit 1
202
	exit 1
(-)Mk/Scripts/do-fetch.sh (-9 / +10 lines)
Lines 13-19 validate_env dp_DEVELOPER dp_DISABLE_SIZE dp_DISTDIR dp_DISTINFO_FILE \ Link Here
13
	dp_MASTER_SITE_BACKUP dp_MASTER_SITE_OVERRIDE dp_MASTER_SORT_AWK \
13
	dp_MASTER_SITE_BACKUP dp_MASTER_SITE_OVERRIDE dp_MASTER_SORT_AWK \
14
	dp_NO_CHECKSUM dp_RANDOMIZE_SITES dp_SITE_FLAVOR dp_TARGET
14
	dp_NO_CHECKSUM dp_RANDOMIZE_SITES dp_SITE_FLAVOR dp_TARGET
15
15
16
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_FETCH}" ] && set -x
16
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DO_FETCH}" ] && set -x
17
17
18
set -u
18
set -u
19
19
Lines 48-54 for _file in "${@}"; do Link Here
48
			fi
48
			fi
49
		done
49
		done
50
	fi
50
	fi
51
	if [ -f "${file}" -a "$force_fetch" != "true" ]; then
51
	if [ -f "${file}" ] && [ "$force_fetch" != "true" ]; then
52
		continue
52
		continue
53
	fi
53
	fi
54
	full_file="${dp_DIST_SUBDIR:+${dp_DIST_SUBDIR}/}${file}"
54
	full_file="${dp_DIST_SUBDIR:+${dp_DIST_SUBDIR}/}${file}"
Lines 58-64 for _file in "${@}"; do Link Here
58
		${dp_ECHO_MSG} "=> Please correct this problem and try again."
58
		${dp_ECHO_MSG} "=> Please correct this problem and try again."
59
		exit 1
59
		exit 1
60
	fi
60
	fi
61
	if [ -f "${dp_DISTINFO_FILE}" -a -z "${dp_NO_CHECKSUM}" ]; then
61
	if [ -f "${dp_DISTINFO_FILE}" ] && [ -z "${dp_NO_CHECKSUM}" ]; then
62
		_sha256sum=$(distinfo_data SHA256 "${full_file}")
62
		_sha256sum=$(distinfo_data SHA256 "${full_file}")
63
		if [ -z "$_sha256sum" ]; then
63
		if [ -z "$_sha256sum" ]; then
64
			${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is not in ${dp_DISTINFO_FILE}."
64
			${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is not in ${dp_DISTINFO_FILE}."
Lines 104-114 for _file in "${@}"; do Link Here
104
		fi
104
		fi
105
	done
105
	done
106
	___MASTER_SITES_TMP=
106
	___MASTER_SITES_TMP=
107
	SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(echo -n "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}"
107
	SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(printf "%s" "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}"
108
	case ${dp_TARGET} in
108
	case ${dp_TARGET} in
109
		fetch-list)
109
		fetch-list)
110
			echo -n "mkdir -p ${dp_DISTDIR} && "
110
			printf "mkdir -p %s && cd %s && { " "${dp_DISTDIR}" "${dp_DISTDIR}"
111
			echo -n "cd ${dp_DISTDIR} && { "
112
			;;
111
			;;
113
	esac
112
	esac
114
	sites_remaining=0
113
	sites_remaining=0
Lines 134-146 for _file in "${@}"; do Link Here
134
				;;
133
				;;
135
		esac
134
		esac
136
		_fetch_cmd="${dp_FETCH_CMD} ${dp_FETCH_BEFORE_ARGS}"
135
		_fetch_cmd="${dp_FETCH_CMD} ${dp_FETCH_BEFORE_ARGS}"
137
		if [ -z "${dp_DISABLE_SIZE}" -a -n "${CKSIZE}" ]; then
136
		if [ -z "${dp_DISABLE_SIZE}" ] && [ -n "${CKSIZE}" ]; then
138
			_fetch_cmd="${_fetch_cmd} -S ${CKSIZE}"
137
			_fetch_cmd="${_fetch_cmd} -S ${CKSIZE}"
139
		fi
138
		fi
140
		_fetch_cmd="${_fetch_cmd} ${args} ${dp_FETCH_AFTER_ARGS}"
139
		_fetch_cmd="${_fetch_cmd} ${args} ${dp_FETCH_AFTER_ARGS}"
141
		case ${dp_TARGET} in
140
		case ${dp_TARGET} in
142
			do-fetch|makesum)
141
			do-fetch|makesum)
143
				${dp_ECHO_MSG} "=> Attempting to fetch ${site}${file}"
142
				${dp_ECHO_MSG} "=> Attempting to fetch ${site}${file}"
143
				# shellcheck disable=SC2086
144
				# _fetch_cmd contains arguments, with spaces, needs to be split.
144
				if env -S "${dp_FETCH_ENV}" ${_fetch_cmd}; then
145
				if env -S "${dp_FETCH_ENV}" ${_fetch_cmd}; then
145
					actual_size=$(stat -f %z "${file}")
146
					actual_size=$(stat -f %z "${file}")
146
					if [ -n "${dp_DISABLE_SIZE}" ] || [ -z "${CKSIZE}" ] || [ "${actual_size}" -eq "${CKSIZE}" ]; then
147
					if [ -n "${dp_DISABLE_SIZE}" ] || [ -z "${CKSIZE}" ] || [ "${actual_size}" -eq "${CKSIZE}" ]; then
Lines 155-164 for _file in "${@}"; do Link Here
155
				fi
156
				fi
156
				;;
157
				;;
157
			fetch-list)
158
			fetch-list)
158
				echo -n "env $(escape "${_fetch_cmd}") || "
159
				printf "env %s || " "$(escape "${_fetch_cmd}")"
159
				;;
160
				;;
160
			fetch-url-list-int)
161
			fetch-url-list-int)
161
				echo ${args}
162
				echo "${args}"
162
				;;
163
				;;
163
		esac
164
		esac
164
	done
165
	done
(-)Mk/Scripts/do-patch.sh (-3 / +11 lines)
Lines 13-19 validate_env dp_BZCAT dp_CAT dp_DISTDIR dp_ECHO_MSG dp_EXTRA_PATCHES \ Link Here
13
	dp_PATCH_SILENT dp_PATCH_WRKSRC dp_PKGNAME dp_PKGORIGIN \
13
	dp_PATCH_SILENT dp_PATCH_WRKSRC dp_PKGNAME dp_PKGORIGIN \
14
	dp_UNZIP_NATIVE_CMD dp_XZCAT
14
	dp_UNZIP_NATIVE_CMD dp_XZCAT
15
15
16
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_PATCH}" ] && set -x
16
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DO_PATCH}" ] && set -x
17
17
18
set -u
18
set -u
19
19
Lines 51-56 apply_one_patch() { Link Here
51
			${dp_CAT} "${file}"
51
			${dp_CAT} "${file}"
52
			;;
52
			;;
53
	esac | do_patch "$@" ${patch_strip}
53
	esac | do_patch "$@" ${patch_strip}
54
	# Do not quote patch_strip, otherwise, it may generate an empty
55
	# argument, which breaks patch.
54
}
56
}
55
57
56
do_patch() {
58
do_patch() {
Lines 79-89 patch_from_directory() { Link Here
79
						if [ -n "${dp_PATCH_DEBUG_TMP}" ]; then
81
						if [ -n "${dp_PATCH_DEBUG_TMP}" ]; then
80
							${dp_ECHO_MSG} "===>  Applying ${msg} patch ${i}"
82
							${dp_ECHO_MSG} "===>  Applying ${msg} patch ${i}"
81
						fi
83
						fi
82
						if do_patch ${dp_PATCH_ARGS} < ${i}; then
84
						# shellcheck disable=SC2086
85
						# dp_PATCH_ARGS contains arguments, with spaces, needs to be split.
86
						if do_patch ${dp_PATCH_ARGS} < "${i}"; then
83
							PATCHES_APPLIED="${PATCHES_APPLIED} ${i}"
87
							PATCHES_APPLIED="${PATCHES_APPLIED} ${i}"
84
						else
88
						else
85
							${dp_ECHO_MSG} "=> ${msg} patch ${i} failed to apply cleanly."
89
							${dp_ECHO_MSG} "=> ${msg} patch ${i} failed to apply cleanly."
86
							if [ -n "${PATCHES_APPLIED}" -a "${dp_PATCH_SILENT}" != "yes" ]; then
90
							if [ -n "${PATCHES_APPLIED}" ] && [ "${dp_PATCH_SILENT}" != "yes" ]; then
87
								${dp_ECHO_MSG} "=> Patch(es) ${PATCHES_APPLIED} applied cleanly."
91
								${dp_ECHO_MSG} "=> Patch(es) ${PATCHES_APPLIED} applied cleanly."
88
							fi
92
							fi
89
							false
93
							false
Lines 99-104 if [ -n "${dp_PATCHFILES}" ]; then Link Here
99
	${dp_ECHO_MSG} "===>  Applying distribution patches for ${dp_PKGNAME}"
103
	${dp_ECHO_MSG} "===>  Applying distribution patches for ${dp_PKGNAME}"
100
	cd "${dp_DISTDIR}"
104
	cd "${dp_DISTDIR}"
101
	for i in ${dp_PATCHFILES}; do
105
	for i in ${dp_PATCHFILES}; do
106
		# shellcheck disable=SC2086
107
		# dp_PATCH_DIST_ARGS contains arguments, with spaces, needs to be split.
102
		apply_one_patch "${i}" \
108
		apply_one_patch "${i}" \
103
			"${dp_PATCH_DEBUG_TMP:+ Applying distribution patch}" \
109
			"${dp_PATCH_DEBUG_TMP:+ Applying distribution patch}" \
104
			${dp_PATCH_DIST_ARGS}
110
			${dp_PATCH_DIST_ARGS}
Lines 111-116 if [ -n "${dp_EXTRA_PATCHES}" ]; then Link Here
111
			patch_from_directory "${i}" \
117
			patch_from_directory "${i}" \
112
				"extra patch"
118
				"extra patch"
113
		else
119
		else
120
			# shellcheck disable=SC2086
121
			# dp_PATCH_ARGS contains arguments, with spaces, needs to be split.
114
			apply_one_patch "${i}" \
122
			apply_one_patch "${i}" \
115
				"Applying extra patch" \
123
				"Applying extra patch" \
116
				${dp_PATCH_ARGS}
124
				${dp_PATCH_ARGS}
(-)Mk/Scripts/do-users-groups.sh (-14 / +32 lines)
Lines 12-23 validate_env dp_ECHO_MSG dp_GID_FILES dp_GID_OFFSET dp_GROUPS_BLACKLIST \ Link Here
12
	dp_UG_DEINSTALL dp_UG_INSTALL dp_UID_FILES dp_UID_OFFSET \
12
	dp_UG_DEINSTALL dp_UG_INSTALL dp_UID_FILES dp_UID_OFFSET \
13
	dp_USERS_BLACKLIST
13
	dp_USERS_BLACKLIST
14
14
15
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_USERS_GROUPS}" ] && set -x
15
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_DO_USERS_GROUPS}" ] && set -x
16
16
17
set -u
17
set -u
18
18
19
USERS=$1
19
ALL_USERS=$1
20
GROUPS=$2
20
ALL_GROUPS=$2
21
21
22
error() {
22
error() {
23
	${dp_ECHO_MSG} "${1}"
23
	${dp_ECHO_MSG} "${1}"
Lines 46-52 fi Link Here
46
# Both scripts need to start the same, so
46
# Both scripts need to start the same, so
47
cp -f "${dp_UG_INSTALL}" "${dp_UG_DEINSTALL}"
47
cp -f "${dp_UG_INSTALL}" "${dp_UG_DEINSTALL}"
48
48
49
if [ -n "${GROUPS}" ]; then
49
if [ -n "${ALL_GROUPS}" ]; then
50
	for file in ${dp_GID_FILES}; do
50
	for file in ${dp_GID_FILES}; do
51
		if [ ! -f "${file}" ]; then
51
		if [ ! -f "${file}" ]; then
52
			error "** ${file} doesn't exist. Exiting."
52
			error "** ${file} doesn't exist. Exiting."
Lines 54-70 if [ -n "${GROUPS}" ]; then Link Here
54
	done
54
	done
55
	${dp_ECHO_MSG} "===> Creating groups."
55
	${dp_ECHO_MSG} "===> Creating groups."
56
	echo "echo \"===> Creating groups.\"" >> "${dp_UG_INSTALL}"
56
	echo "echo \"===> Creating groups.\"" >> "${dp_UG_INSTALL}"
57
	for group in ${GROUPS}; do
57
	for group in ${ALL_GROUPS}; do
58
		# _bgpd:*:130:
58
		# _bgpd:*:130:
59
		# shellcheck disable=SC2086
60
		# We need splitting.
59
		if ! grep -q "^${group}:" ${dp_GID_FILES}; then \
61
		if ! grep -q "^${group}:" ${dp_GID_FILES}; then \
60
			error "** Cannot find any information about group \`${group}' in ${dp_GID_FILES}."
62
			error "** Cannot find any information about group \`${group}' in ${dp_GID_FILES}."
61
		fi
63
		fi
64
		# shellcheck disable=SC2086
65
		# We need splitting in the heredoc.
62
		while read -r line; do
66
		while read -r line; do
63
			# Do not change IFS for more than one command, if we
67
			# Do not change IFS for more than one command, if we
64
			# changed IFS around the while read, it would mess up
68
			# changed IFS around the while read, it would mess up
65
			# the string splitting in the heredoc command.
69
			# the string splitting in the heredoc command.
66
			o_IFS=${IFS}
70
			o_IFS=${IFS}
67
			IFS=":"
71
			IFS=":"
72
			# shellcheck disable=SC2086
73
			# We want splitting.
68
			set -- ${line}
74
			set -- ${line}
69
			IFS=${o_IFS}
75
			IFS=${o_IFS}
70
			group=$1
76
			group=$1
Lines 87-93 if [ -n "${GROUPS}" ]; then Link Here
87
	done
93
	done
88
fi
94
fi
89
95
90
if [ -n "${USERS}" ]; then
96
if [ -n "${ALL_USERS}" ]; then
91
	for file in ${dp_UID_FILES}; do
97
	for file in ${dp_UID_FILES}; do
92
		if [ ! -f "${file}" ]; then
98
		if [ ! -f "${file}" ]; then
93
			error "** ${file} doesn't exist. Exiting."
99
			error "** ${file} doesn't exist. Exiting."
Lines 97-113 if [ -n "${USERS}" ]; then Link Here
97
	${dp_ECHO_MSG} "===> Creating users"
103
	${dp_ECHO_MSG} "===> Creating users"
98
	echo "echo \"===> Creating users\"" >> "${dp_UG_INSTALL}"
104
	echo "echo \"===> Creating users\"" >> "${dp_UG_INSTALL}"
99
105
100
	for user in ${USERS}; do
106
	for user in ${ALL_USERS}; do
101
		# _bgpd:*:130:130:BGP Daemon:/var/empty:/sbin/nologin
107
		# _bgpd:*:130:130:BGP Daemon:/var/empty:/sbin/nologin
108
		# shellcheck disable=SC2086
109
		# We need splitting.
102
		if ! grep -q "^${user}:" ${dp_UID_FILES} ; then
110
		if ! grep -q "^${user}:" ${dp_UID_FILES} ; then
103
			error "** Cannot find any information about user \`${user}' in ${dp_UID_FILES}."
111
			error "** Cannot find any information about user \`${user}' in ${dp_UID_FILES}."
104
		fi
112
		fi
113
		# shellcheck disable=SC2086
114
		# We need splitting in the heredoc.
105
		while read -r line; do
115
		while read -r line; do
106
			# Do not change IFS for more than one command, if we
116
			# Do not change IFS for more than one command, if we
107
			# changed IFS around the while read, it would mess up
117
			# changed IFS around the while read, it would mess up
108
			# the string splitting in the heredoc command.
118
			# the string splitting in the heredoc command.
109
			o_IFS=${IFS}
119
			o_IFS=${IFS}
110
			IFS=":"
120
			IFS=":"
121
			# shellcheck disable=SC2086
122
			# We want splitting.
111
			set -- ${line}
123
			set -- ${line}
112
			IFS=${o_IFS}
124
			IFS=${o_IFS}
113
			login=$1
125
			login=$1
Lines 148-156 if [ -n "${USERS}" ]; then Link Here
148
	done
160
	done
149
fi
161
fi
150
162
151
if [ -n "${GROUPS}" ]; then
163
if [ -n "${ALL_GROUPS}" ]; then
152
	for group in ${GROUPS}; do
164
	for group in ${ALL_GROUPS}; do
153
		# mail:*:6:postfix,clamav
165
		# mail:*:6:postfix,clamav
166
		# shellcheck disable=SC2086
167
		# We need splitting in the heredoc.
154
		while read -r line; do
168
		while read -r line; do
155
			# Do not change IFS for more than one command, if we
169
			# Do not change IFS for more than one command, if we
156
			# changed IFS around the while read, it would mess up
170
			# changed IFS around the while read, it would mess up
Lines 159-164 if [ -n "${GROUPS}" ]; then Link Here
159
			IFS=":"
173
			IFS=":"
160
			# As some lines do not have a fourth argument, provide
174
			# As some lines do not have a fourth argument, provide
161
			# one so $4 always exists.
175
			# one so $4 always exists.
176
			# shellcheck disable=SC2086
177
			# We need splitting.
162
			set -- ${line} ""
178
			set -- ${line} ""
163
			IFS=${o_IFS}
179
			IFS=${o_IFS}
164
			group=$1
180
			group=$1
Lines 167-176 if [ -n "${GROUPS}" ]; then Link Here
167
			gid=$((gid+dp_GID_OFFSET))
183
			gid=$((gid+dp_GID_OFFSET))
168
			o_IFS=${IFS}
184
			o_IFS=${IFS}
169
			IFS=","
185
			IFS=","
186
			# shellcheck disable=SC2086
187
			# We need splitting.
170
			set -- ${members}
188
			set -- ${members}
171
			IFS=${o_IFS}
189
			IFS=${o_IFS}
172
			for login in "$@"; do
190
			for login in "$@"; do
173
				for user in ${USERS}; do
191
				for user in ${ALL_USERS}; do
174
					if [ -n "${user}" ] && [ "${user}" = "${login}" ]; then
192
					if [ -n "${user}" ] && [ "${user}" = "${login}" ]; then
175
						cat >> "${dp_UG_INSTALL}" <<-eot2
193
						cat >> "${dp_UG_INSTALL}" <<-eot2
176
						if ! \${PW} groupshow ${group} | grep -qw ${login}; then
194
						if ! \${PW} groupshow ${group} | grep -qw ${login}; then
Lines 187-194 if [ -n "${GROUPS}" ]; then Link Here
187
	done
205
	done
188
fi
206
fi
189
207
190
if [ -n "${USERS}" ]; then
208
if [ -n "${ALL_USERS}" ]; then
191
	for user in ${USERS}; do
209
	for user in ${ALL_USERS}; do
192
		if ! echo "${dp_USERS_BLACKLIST}" | grep -qw "${user}"; then
210
		if ! echo "${dp_USERS_BLACKLIST}" | grep -qw "${user}"; then
193
			cat >> "${dp_UG_DEINSTALL}" <<-eot
211
			cat >> "${dp_UG_DEINSTALL}" <<-eot
194
			if \${PW} usershow ${user} >/dev/null 2>&1; then
212
			if \${PW} usershow ${user} >/dev/null 2>&1; then
Lines 199-206 if [ -n "${USERS}" ]; then Link Here
199
	done
217
	done
200
fi
218
fi
201
219
202
if [ -n "${GROUPS}" ]; then
220
if [ -n "${ALL_GROUPS}" ]; then
203
	for group in ${GROUPS}; do
221
	for group in ${ALL_GROUPS}; do
204
		if ! echo "${dp_GROUPS_BLACKLIST}" | grep -qw "${group}"; then
222
		if ! echo "${dp_GROUPS_BLACKLIST}" | grep -qw "${group}"; then
205
			cat >> "${dp_UG_DEINSTALL}" <<-eot
223
			cat >> "${dp_UG_DEINSTALL}" <<-eot
206
			if \${PW} groupshow ${group} >/dev/null 2>&1; then
224
			if \${PW} groupshow ${group} >/dev/null 2>&1; then
(-)Mk/Scripts/find-lib.sh (-7 / +7 lines)
Lines 2-15 Link Here
2
# MAINTAINER: portmgr@FreeBSD.org
2
# MAINTAINER: portmgr@FreeBSD.org
3
# $FreeBSD$
3
# $FreeBSD$
4
4
5
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_FIND_LIB}" ] && set -x
5
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_FIND_LIB}" ] && set -x
6
6
7
if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then
7
if [ -z "${LIB_DIRS}" ] || [ -z "${LOCALBASE}" ]; then
8
	echo "LIB_DIRS, LOCALBASE required in environment." >&2
8
	echo "LIB_DIRS, LOCALBASE required in environment." >&2
9
	exit 1
9
	exit 1
10
fi
10
fi
11
11
12
if [ -f /usr/share/misc/magic.mime -o -f /usr/share/misc/magic.mime.mgc ]; then
12
if [ -f /usr/share/misc/magic.mime ] || [ -f /usr/share/misc/magic.mime.mgc ]; then
13
	echo >&2
13
	echo >&2
14
	echo "Either /usr/share/misc/magic.mime or /usr/share/misc/magic.mime.mgc exist and must be removed." >&2
14
	echo "Either /usr/share/misc/magic.mime or /usr/share/misc/magic.mime.mgc exist and must be removed." >&2
15
	echo "These are legacy files from an older release and may safely be deleted." >&2
15
	echo "These are legacy files from an older release and may safely be deleted." >&2
Lines 22-33 if [ $# -ne 1 ]; then Link Here
22
fi
22
fi
23
23
24
lib=$1
24
lib=$1
25
dirs="${LIB_DIRS} `cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`"
25
dirs="${LIB_DIRS} $(cat "${LOCALBASE}"/libdata/ldconfig/* 2>/dev/null || :)"
26
26
27
for libdir in ${dirs} ; do
27
for libdir in ${dirs} ; do
28
	test -f ${libdir}/${lib} || continue
28
	test -f "${libdir}/${lib}" || continue
29
	libfile=${libdir}/${lib}
29
	libfile=${libdir}/${lib}
30
	[ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue
30
	[ "$(file -b -L --mime-type "${libfile}")" = "application/x-sharedlib" ] || continue
31
	echo $libfile
31
	echo "$libfile"
32
	break
32
	break
33
done
33
done
(-)Mk/Scripts/functions.sh (-15 / +31 lines)
Lines 30-36 parse_plist() { Link Here
30
		# the plist so it does not show up as an orphan. PLIST_SUB uses
30
		# the plist so it does not show up as an orphan. PLIST_SUB uses
31
		# a @comment to deactive files. XXX: It would be better to
31
		# a @comment to deactive files. XXX: It would be better to
32
		# make all ports use @ignore instead of @comment.
32
		# make all ports use @ignore instead of @comment.
33
		if [ ${parse_comments} -eq 1 -a -z "${line%%@comment *}" ]; then
33
		if [ "${parse_comments}" -eq 1 ] && [ -z "${line%%@comment *}" ]; then
34
			line="${line##*@comment }"
34
			line="${line##*@comment }"
35
			# Remove @comment so it can be parsed as a file,
35
			# Remove @comment so it can be parsed as a file,
36
			# but later prepend it again to create a list of
36
			# but later prepend it again to create a list of
Lines 60-66 parse_plist() { Link Here
60
		@dir*|'@unexec rmdir'*|'@unexec /bin/rmdir'*)
60
		@dir*|'@unexec rmdir'*|'@unexec /bin/rmdir'*)
61
			line="$(printf %s "$line" \
61
			line="$(printf %s "$line" \
62
			    | sed -Ee 's/\|\|.*//;s|[[:space:]]+[0-9]*[[:space:]]*>[&]?[[:space:]]*[^[:space:]]+||g' \
62
			    | sed -Ee 's/\|\|.*//;s|[[:space:]]+[0-9]*[[:space:]]*>[&]?[[:space:]]*[^[:space:]]+||g' \
63
			        -e "/^@unexec[[:space:]]+(\/bin\/)?rmdir( -p)?/s|([^%])%D([^%])|\1${cwd}\2|g" \
63
			        -e "/^@unexec[[:space:]]+(\\/bin\\/)?rmdir( -p)?/s|([^%])%D([^%])|\\1${cwd}\\2|g" \
64
			        -e '/^@unexec[[:space:]]+(\/bin\/)?rmdir( -p)?/s|"(.*)"[[:space:]]*|\1|g' \
64
			        -e '/^@unexec[[:space:]]+(\/bin\/)?rmdir( -p)?/s|"(.*)"[[:space:]]*|\1|g' \
65
			        -e 's/@unexec[[:space:]]+(\/bin\/)?rmdir( -p)?[[:space:]]+//' \
65
			        -e 's/@unexec[[:space:]]+(\/bin\/)?rmdir( -p)?[[:space:]]+//' \
66
				-e 's/@dir(rm|rmtry)?[[:space:]]+//' \
66
				-e 's/@dir(rm|rmtry)?[[:space:]]+//' \
Lines 72-85 parse_plist() { Link Here
72
		;;
72
		;;
73
		# Handle [file] Keywords
73
		# Handle [file] Keywords
74
		@info\ *|@shell\ *|@xmlcatmgr\ *)
74
		@info\ *|@shell\ *|@xmlcatmgr\ *)
75
			# shellcheck disable=SC2086
76
			# We want splitting.
75
			set -- $line
77
			set -- $line
76
			shift
78
			shift
77
			case "$@" in
79
			case "$*" in
78
			/*) echo "${comment}$@" ;;
80
			/*) echo "${comment}$*" ;;
79
			*) echo "${comment}${cwd}/$@" ;;
81
			*) echo "${comment}${cwd}/$*" ;;
80
			esac
82
			esac
81
		;;
83
		;;
82
		@sample\ *)
84
		@sample\ *)
85
			# shellcheck disable=SC2086
86
			# We want splitting.
83
			set -- $line
87
			set -- $line
84
			shift
88
			shift
85
			sample_file=$1
89
			sample_file=$1
Lines 101-114 parse_plist() { Link Here
101
		;;
105
		;;
102
		# Handle [dir] Keywords
106
		# Handle [dir] Keywords
103
		@fc\ *|@fcfontsdir\ *|@fontsdir\ *)
107
		@fc\ *|@fcfontsdir\ *|@fontsdir\ *)
108
			# shellcheck disable=SC2086
109
			# We want splitting.
104
			set -- $line
110
			set -- $line
105
			shift
111
			shift
106
			case "$@" in
112
			case "$*" in
107
			/*)
113
			/*)
108
			echo >&3 "${comment}$@"
114
			echo >&3 "${comment}$*"
109
			;;
115
			;;
110
			*)
116
			*)
111
			echo >&3 "${comment}${cwd}/$@"
117
			echo >&3 "${comment}${cwd}/$*"
112
			;;
118
			;;
113
			esac
119
			esac
114
		;;
120
		;;
Lines 125-130 parse_plist() { Link Here
125
			fi
131
			fi
126
			;;
132
			;;
127
		@cwd*|@cd*)
133
		@cwd*|@cd*)
134
			# shellcheck disable=SC2086
135
			# We want splitting.
128
			set -- $line
136
			set -- $line
129
			newcwd=$2
137
			newcwd=$2
130
			# Don't set cwd=/ as it causes // in plist and
138
			# Don't set cwd=/ as it causes // in plist and
Lines 160-166 validate_env() { Link Here
160
}
168
}
161
169
162
export_ports_env() {
170
export_ports_env() {
163
	local export_vars make_cmd make_env var results value uses
171
	local export_vars make_cmd make_env var value uses
164
172
165
	if [ -n "${HAVE_PORTS_ENV:-}" ]; then
173
	if [ -n "${HAVE_PORTS_ENV:-}" ]; then
166
		return 0
174
		return 0
Lines 180-186 export_ports_env() { Link Here
180
188
181
	make_cmd="${make_env}"
189
	make_cmd="${make_env}"
182
190
183
	export_vars="$(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk \
191
	# Don't quote make_env, we want splitting.
192
	export_vars="$(${MAKE} -f "${PORTSDIR}/Mk/bsd.port.mk" \
184
	    -V PORTS_ENV_VARS ${make_env} USES="${uses}")"
193
	    -V PORTS_ENV_VARS ${make_env} USES="${uses}")"
185
194
186
	for var in ${export_vars}; do
195
	for var in ${export_vars}; do
Lines 188-203 export_ports_env() { Link Here
188
	done
197
	done
189
198
190
	# Bring in all the vars, but not empty ones.
199
	# Bring in all the vars, but not empty ones.
191
	eval $(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk ${make_cmd} \
200
	# Don't quote make_cmd, we want splitting.
192
	    USES="${uses}" | grep -v '=$' | sed -e 's,\\ $,,')
201
	eval "$(${MAKE} -f "${PORTSDIR}/Mk/bsd.port.mk" ${make_cmd} \
202
		USES="${uses}" | grep -v '=$' | sed -e 's,\\ $,,')"
193
	for var in ${export_vars}; do
203
	for var in ${export_vars}; do
194
		# Export and display non-empty ones.  This is not redundant
204
		# Export and display non-empty ones.  This is not redundant
195
		# with above since we're looping on all vars here; do not
205
		# with above since we're looping on all vars here; do not
196
		# export a var we didn't eval in.
206
		# export a var we didn't eval in.
197
		value="$(eval echo \$${var})"
207
		value="$(eval echo \$"${var}")"
198
208
199
		if [ -n "${value}" ]; then
209
		if [ -n "${value}" ]; then
200
			export ${var}
210
			# shellcheck disable=SC2163
211
			# We want to export the variable which name is in var.
212
			export "${var}"
201
			echo "export ${var}=\"${value}\""
213
			echo "export ${var}=\"${value}\""
202
		fi
214
		fi
203
	done
215
	done
Lines 211-217 distinfo_data() { Link Here
211
	alg=$1
223
	alg=$1
212
	file=$2
224
	file=$2
213
225
214
	if [ \( -n "${dp_DISABLE_SIZE}" -a -n "${dp_NO_CHECKSUM}" \) -o ! -f "${dp_DISTINFO_FILE}" ]; then
226
	if ( [ -n "${dp_DISABLE_SIZE}" ] && [ -n "${dp_NO_CHECKSUM}" ] ) || [ ! -f "${dp_DISTINFO_FILE}" ]; then
215
		exit
227
		exit
216
	fi
228
	fi
217
	awk -v alg="$alg" -v file="${file}" \
229
	awk -v alg="$alg" -v file="${file}" \
Lines 259-265 port_var_fetch() { Link Here
259
		_vars="${_vars}${_vars:+ }${_var}"
271
		_vars="${_vars}${_vars:+ }${_var}"
260
		shift 2
272
		shift 2
261
	done
273
	done
274
	# shellcheck disable=SC2086
275
	# We want splitting.
262
	set -- ${_vars}
276
	set -- ${_vars}
277
	# shellcheck disable=SC2086
278
	# We want splitting in the heredoc.
263
	while read -r _line; do
279
	while read -r _line; do
264
		setvar "$1" "${_line}"
280
		setvar "$1" "${_line}"
265
		shift
281
		shift
(-)Mk/Scripts/generate-symbols.sh (-9 / +9 lines)
Lines 3-9 Link Here
3
# Maintainer: portmgr@FreeBSD.org
3
# Maintainer: portmgr@FreeBSD.org
4
4
5
msg() {
5
msg() {
6
        echo "====> $@"
6
        echo "====> $*"
7
}
7
}
8
8
9
msg "Finding symbols"
9
msg "Finding symbols"
Lines 12-34 msg "Finding symbols" Link Here
12
ELF_FILES=$(mktemp -t elf_files)
12
ELF_FILES=$(mktemp -t elf_files)
13
LF=$(printf '\nX')
13
LF=$(printf '\nX')
14
LF=${LF%X}
14
LF=${LF%X}
15
find ${STAGEDIR} -type f \
15
find "${STAGEDIR}" -type f \
16
    -exec /usr/bin/file -nNF "${LF}" {} + | while read f; do
16
    -exec /usr/bin/file -nNF "${LF}" {} + | while read -r f; do
17
	read output
17
	read -r output
18
	case "${output}" in
18
	case "${output}" in
19
	ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|\
19
	ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|\
20
	ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*)
20
	ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*)
21
		echo "${f}"
21
		echo "${f}"
22
		;;
22
		;;
23
	esac
23
	esac
24
done > ${ELF_FILES}
24
done > "${ELF_FILES}"
25
25
26
# Create all of the /usr/local/lib/* dirs
26
# Create all of the /usr/local/lib/* dirs
27
lib_dir="${STAGEDIR}.debug${PREFIX}/lib/debug"
27
lib_dir="${STAGEDIR}.debug${PREFIX}/lib/debug"
28
sed -e "s,^${STAGEDIR}${PREFIX}/,${lib_dir}/," -e 's,/[^/]*$,,' \
28
sed -e "s,^${STAGEDIR}${PREFIX}/,${lib_dir}/," -e 's,/[^/]*$,,' \
29
    ${ELF_FILES} | sort -u | xargs mkdir -p
29
    "${ELF_FILES}" | sort -u | xargs mkdir -p
30
30
31
while read staged_elf_file; do
31
while read -r staged_elf_file; do
32
	elf_file_name="${staged_elf_file##*/}"
32
	elf_file_name="${staged_elf_file##*/}"
33
	lib_dir_dest="${lib_dir}/${staged_elf_file#${STAGEDIR}${PREFIX}/}"
33
	lib_dir_dest="${lib_dir}/${staged_elf_file#${STAGEDIR}${PREFIX}/}"
34
	# Strip off filename
34
	# Strip off filename
Lines 41-46 while read staged_elf_file; do Link Here
41
	    --add-gnu-debuglink="${lib_dir_dest}/${elf_file_name}.debug" \
41
	    --add-gnu-debuglink="${lib_dir_dest}/${elf_file_name}.debug" \
42
	    "${staged_elf_file}"
42
	    "${staged_elf_file}"
43
	msg "Saved symbols for ${staged_elf_file}"
43
	msg "Saved symbols for ${staged_elf_file}"
44
done < ${ELF_FILES}
44
done < "${ELF_FILES}"
45
45
46
rm -f ${ELF_FILES}
46
rm -f "${ELF_FILES}"
(-)Mk/Scripts/makesum.sh (-6 / +6 lines)
Lines 10-16 set -e Link Here
10
validate_env dp_CHECKSUM_ALGORITHMS dp_CKSUMFILES dp_DISTDIR dp_DISTINFO_FILE \
10
validate_env dp_CHECKSUM_ALGORITHMS dp_CKSUMFILES dp_DISTDIR dp_DISTINFO_FILE \
11
	dp_ECHO_MSG
11
	dp_ECHO_MSG
12
12
13
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_MAKESUM}" ] && set -x
13
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_MAKESUM}" ] && set -x
14
14
15
set -u
15
set -u
16
16
Lines 27-34 cd "${dp_DISTDIR}" Link Here
27
# the first run.
27
# the first run.
28
# So, we extract the content of the distinfo file minus the TIMESTAMP, if it
28
# So, we extract the content of the distinfo file minus the TIMESTAMP, if it
29
# contains a TIMESTAMP.
29
# contains a TIMESTAMP.
30
if [ -f "${dp_DISTINFO_FILE}" ] && grep -q "^TIMESTAMP " ${dp_DISTINFO_FILE}; then
30
if [ -f "${dp_DISTINFO_FILE}" ] && grep -q "^TIMESTAMP " "${dp_DISTINFO_FILE}"; then
31
	grep -v "^TIMESTAMP " ${dp_DISTINFO_FILE} > ${DISTINFO_OLD}
31
	grep -v "^TIMESTAMP " "${dp_DISTINFO_FILE}" > "${DISTINFO_OLD}"
32
fi
32
fi
33
33
34
for file in ${dp_CKSUMFILES}; do
34
for file in ${dp_CKSUMFILES}; do
Lines 47-53 done Link Here
47
#   need to add one.
47
#   need to add one.
48
# - If the old and new distinfo content minus the TIMESTAMP differ, it means
48
# - If the old and new distinfo content minus the TIMESTAMP differ, it means
49
#   something was updated or changed, it is time to generate a new timestamp.
49
#   something was updated or changed, it is time to generate a new timestamp.
50
if [ ! -s ${DISTINFO_OLD} ] || ! cmp -s ${DISTINFO_OLD} ${DISTINFO_NEW}; then
50
if [ ! -s "${DISTINFO_OLD}" ] || ! cmp -s "${DISTINFO_OLD}" "${DISTINFO_NEW}"; then
51
	echo "TIMESTAMP = $(date '+%s')" > ${dp_DISTINFO_FILE}
51
	echo "TIMESTAMP = $(date '+%s')" > "${dp_DISTINFO_FILE}"
52
	cat ${DISTINFO_NEW} >> ${dp_DISTINFO_FILE}
52
	cat "${DISTINFO_NEW}" >> "${dp_DISTINFO_FILE}"
53
fi
53
fi
(-)Mk/Scripts/plist_sub_sed_sort.sh (-1 / +1 lines)
Lines 5-11 Link Here
5
#
5
#
6
# PLIST_SUB_SED helper to sort by longest value first.
6
# PLIST_SUB_SED helper to sort by longest value first.
7
7
8
exec awk '{
8
awk '{
9
	while (match($0, /s![^!]*![^!]*!g;/)) {
9
	while (match($0, /s![^!]*![^!]*!g;/)) {
10
		sedp=substr($0, RSTART, RLENGTH)
10
		sedp=substr($0, RSTART, RLENGTH)
11
		$0=substr($0, RSTART+RLENGTH)
11
		$0=substr($0, RSTART+RLENGTH)
(-)Mk/Scripts/ports_env.sh (-1 / +1 lines)
Lines 8-13 if [ -z "${SCRIPTSDIR}" ]; then Link Here
8
	exit 1
8
	exit 1
9
fi
9
fi
10
10
11
. ${SCRIPTSDIR}/functions.sh
11
. "${SCRIPTSDIR}"/functions.sh
12
12
13
export_ports_env
13
export_ports_env
(-)Mk/Scripts/qa.sh (-279 / +285 lines)
Lines 2-37 Link Here
2
# MAINTAINER: portmgr@FreeBSD.org
2
# MAINTAINER: portmgr@FreeBSD.org
3
# $FreeBSD$
3
# $FreeBSD$
4
4
5
if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then
5
if [ -z "${STAGEDIR}" ] || [ -z "${PREFIX}" ] || [ -z "${LOCALBASE}" ]; then
6
	echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2
6
	echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2
7
	exit 1
7
	exit 1
8
fi
8
fi
9
9
10
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
10
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
11
11
12
LF=$(printf '\nX')
12
LF=$(printf '\nX')
13
LF=${LF%X}
13
LF=${LF%X}
14
SOH=$(printf '\1')
14
15
15
notice() {
16
notice() {
16
	echo "Notice: $@" >&2
17
	echo "Notice: $*" >&2
17
}
18
}
18
19
19
warn() {
20
warn() {
20
	echo "Warning: $@" >&2
21
	echo "Warning: $*" >&2
21
}
22
}
22
23
23
err() {
24
err() {
24
	echo "Error: $@" >&2
25
	echo "Error: $*" >&2
25
}
26
}
26
27
27
list_stagedir_elfs() {
28
list_stagedir_elfs() {
28
	cd ${STAGEDIR} && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@"
29
	cd "${STAGEDIR}" && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@"
29
}
30
}
30
31
31
shebangonefile() {
32
shebangonefile() {
32
	local f interp interparg badinterp rc
33
	local f interp interparg badinterp rc
33
34
34
	f="$@"
35
	f="$*"
35
	rc=0
36
	rc=0
36
37
37
	# whitelist some files
38
	# whitelist some files
Lines 54-60 shebangonefile() { Link Here
54
	${LINUXBASE}/*) ;;
55
	${LINUXBASE}/*) ;;
55
	${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*)
56
	${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*)
56
		# lang/perl5* are allowed to have these shebangs.
57
		# lang/perl5* are allowed to have these shebangs.
57
		if ! expr ${PKGORIGIN} : '^lang/perl5.*' > /dev/null; then
58
		if ! expr "${PKGORIGIN}" : '^lang/perl5.*' > /dev/null; then
58
			err "'${interp}' is an invalid shebang for '${f#${STAGEDIR}${PREFIX}/}' you must use ${LOCALBASE}/bin/perl."
59
			err "'${interp}' is an invalid shebang for '${f#${STAGEDIR}${PREFIX}/}' you must use ${LOCALBASE}/bin/perl."
59
			err "Either pass \${PERL} to the build or use USES=shebangfix"
60
			err "Either pass \${PERL} to the build or use USES=shebangfix"
60
			rc=1
61
			rc=1
Lines 95-107 shebang() { Link Here
95
96
96
	rc=0
97
	rc=0
97
98
98
	while read f; do
99
	while read -r f; do
99
		# No results presents a blank line from heredoc.
100
		# No results presents a blank line from heredoc.
100
		[ -z "${f}" ] && continue
101
		[ -z "${f}" ] && continue
101
		shebangonefile "${f}" || rc=1
102
		shebangonefile "${f}" || rc=1
102
	# Use heredoc to avoid losing rc from find|while subshell
103
	# Use heredoc to avoid losing rc from find|while subshell
103
	done <<-EOF
104
	done <<-EOF
104
	$(find ${STAGEDIR}${PREFIX} \
105
	$(find "${STAGEDIR}${PREFIX}" \
105
	    -type f -perm +111 2>/dev/null)
106
	    -type f -perm +111 2>/dev/null)
106
	EOF
107
	EOF
107
108
Lines 112-119 baselibs() { Link Here
112
	local rc
113
	local rc
113
	local found_openssl
114
	local found_openssl
114
	local file
115
	local file
115
	[ "${PKGBASE}" = "pkg" -o "${PKGBASE}" = "pkg-devel" ] && return
116
	[ "${PKGBASE}" = "pkg" ] || [ "${PKGBASE}" = "pkg-devel" ] && return
116
	while read f; do
117
	while read -r f; do
117
		case ${f} in
118
		case ${f} in
118
		File:\ .*)
119
		File:\ .*)
119
			file=${f#File: .}
120
			file=${f#File: .}
Lines 133-141 baselibs() { Link Here
133
	done <<-EOF
134
	done <<-EOF
134
	$(list_stagedir_elfs -exec readelf -d {} + 2>/dev/null)
135
	$(list_stagedir_elfs -exec readelf -d {} + 2>/dev/null)
135
	EOF
136
	EOF
136
	if [ -z "${USESSSL}" -a -n "${found_openssl}" ]; then
137
	if [ -z "${USESSSL}" ] && [ -n "${found_openssl}" ]; then
137
		warn "you need USES=ssl"
138
		warn "you need USES=ssl"
138
	elif [ -n "${USESSSL}" -a -z "${found_openssl}" ]; then
139
	elif [ -n "${USESSSL}" ] && [ -z "${found_openssl}" ]; then
139
		warn "you may not need USES=ssl"
140
		warn "you may not need USES=ssl"
140
	fi
141
	fi
141
	return ${rc}
142
	return ${rc}
Lines 148-157 symlinks() { Link Here
148
149
149
	# Split stat(1) result into 2 lines and read each line separately to
150
	# Split stat(1) result into 2 lines and read each line separately to
150
	# retain spaces in filenames.
151
	# retain spaces in filenames.
151
	while read l; do
152
	while read -r l; do
152
		# No results presents a blank line from heredoc.
153
		# No results presents a blank line from heredoc.
153
		[ -z "${l}" ] && continue
154
		[ -z "${l}" ] && continue
154
		read link
155
		read -r link
155
		case "${link}" in
156
		case "${link}" in
156
			${STAGEDIR}*)
157
			${STAGEDIR}*)
157
				err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory"
158
				err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory"
Lines 163-176 symlinks() { Link Here
163
					warn "Bad symlink '${l#${STAGEDIR}}' pointing to an absolute pathname '${link}'"
164
					warn "Bad symlink '${l#${STAGEDIR}}' pointing to an absolute pathname '${link}'"
164
				fi
165
				fi
165
				# Also warn if the symlink exists nowhere.
166
				# Also warn if the symlink exists nowhere.
166
				if [ ! -e "${STAGEDIR}${link}" -a ! -e "${link}" ]; then
167
				if [ ! -e "${STAGEDIR}${link}" ] && [ ! -e "${link}" ]; then
167
					warn "Symlink '${l#${STAGEDIR}}' pointing to '${link}' which does not exist in the stage directory or in localbase"
168
					warn "Symlink '${l#${STAGEDIR}}' pointing to '${link}' which does not exist in the stage directory or in localbase"
168
				fi
169
				fi
169
				;;
170
				;;
170
		esac
171
		esac
171
	# Use heredoc to avoid losing rc from find|while subshell.
172
	# Use heredoc to avoid losing rc from find|while subshell.
172
	done <<-EOF
173
	done <<-EOF
173
	$(find ${STAGEDIR} -type l -exec stat -f "%N${LF}%Y" {} +)
174
	$(find "${STAGEDIR}" -type l -exec stat -f "%N${LF}%Y" {} +)
174
	EOF
175
	EOF
175
176
176
	return ${rc}
177
	return ${rc}
Lines 181-187 paths() { Link Here
181
182
182
	rc=0
183
	rc=0
183
184
184
	while read f; do
185
	while read -r f; do
185
		# No results presents a blank line from heredoc.
186
		# No results presents a blank line from heredoc.
186
		[ -z "${f}" ] && continue
187
		[ -z "${f}" ] && continue
187
		# Ignore false-positive/harmless files
188
		# Ignore false-positive/harmless files
Lines 194-200 paths() { Link Here
194
		rc=1
195
		rc=1
195
	# Use heredoc to avoid losing rc from find|while subshell
196
	# Use heredoc to avoid losing rc from find|while subshell
196
	done <<-EOF
197
	done <<-EOF
197
	$(find ${TMPPLIST} ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +)
198
	$(find "${TMPPLIST}" "${STAGEDIR}" -type f -exec grep -l "${STAGEDIR}" {} +)
198
	EOF
199
	EOF
199
200
200
	return ${rc}
201
	return ${rc}
Lines 207-227 stripped() { Link Here
207
	# Split file and result into 2 lines and read separately to ensure
208
	# Split file and result into 2 lines and read separately to ensure
208
	# files with spaces are kept intact.
209
	# files with spaces are kept intact.
209
	# Using readelf -h ... /ELF Header:/ will match on all ELF files.
210
	# Using readelf -h ... /ELF Header:/ will match on all ELF files.
210
	find ${STAGEDIR} -type f ! -name '*.a' ! -name '*.o' \
211
	find "${STAGEDIR}" -type f ! -name '*.a' ! -name '*.o' \
211
	    -exec readelf -S {} + 2>/dev/null | awk '\
212
	    -exec readelf -S {} + 2>/dev/null | awk '
212
	    /File:/ {sub(/File: /, "", $0); file=$0} \
213
	    /File:/ {sub(/File: /, "", $0); file=$0}
213
	    /[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' |
214
	    /[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' |
214
	    while read f; do
215
	    while read -r f; do
215
		warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
216
		warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
216
	done
217
	done
217
}
218
}
218
219
219
desktopfileutils() {
220
desktopfileutils() {
220
	if [ -z "${USESDESKTOPFILEUTILS}" ]; then
221
	if [ -z "${USESDESKTOPFILEUTILS}" ]; then
221
		grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null &&
222
		grep -q MimeType= "${STAGEDIR}${PREFIX}"/share/applications/*.desktop 2>/dev/null &&
222
		warn "you need USES=desktop-file-utils"
223
		warn "you need USES=desktop-file-utils"
223
	else
224
	else
224
		grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null ||
225
		grep -q MimeType= "${STAGEDIR}${PREFIX}"/share/applications/*.desktop 2>/dev/null ||
225
		warn "you may not need USES=desktop-file-utils"
226
		warn "you may not need USES=desktop-file-utils"
226
	fi
227
	fi
227
	return 0
228
	return 0
Lines 237-245 sharedmimeinfo() { Link Here
237
		found=1
238
		found=1
238
		break
239
		break
239
	done
240
	done
240
	if [ -z "${USESSHAREDMIMEINFO}" -a ${found} -eq 1 ]; then
241
	if [ -z "${USESSHAREDMIMEINFO}" ] && [ ${found} -eq 1 ]; then
241
		warn "you need USES=shared-mime-info"
242
		warn "you need USES=shared-mime-info"
242
	elif [ -n "${USESSHAREDMIMEINFO}" -a ${found} -eq 0 ]; then
243
	elif [ -n "${USESSHAREDMIMEINFO}" ] && [ ${found} -eq 0 ]; then
243
		warn "you may not need USES=shared-mime-info"
244
		warn "you may not need USES=shared-mime-info"
244
	fi
245
	fi
245
	return 0
246
	return 0
Lines 248-269 sharedmimeinfo() { Link Here
248
suidfiles() {
249
suidfiles() {
249
	local filelist
250
	local filelist
250
251
251
	filelist=`find ${STAGEDIR} -type f \
252
	filelist=$(find "${STAGEDIR}" -type f \
252
		\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
253
		\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
253
		\( -perm -u+s -or -perm -g+s \)`
254
		\( -perm -u+s -or -perm -g+s \))
254
	if [ -n "${filelist}" ]; then
255
	if [ -n "${filelist}" ]; then
255
		warn "setuid files in the stage directory (are these necessary?):"
256
		warn "setuid files in the stage directory (are these necessary?):"
256
		ls -liTd ${filelist}
257
		ls -liTd "${filelist}"
257
	fi
258
	fi
258
	return 0
259
	return 0
259
}
260
}
260
261
261
libtool() {
262
libtool() {
262
	if [ -z "${USESLIBTOOL}" ]; then
263
	if [ -z "${USESLIBTOOL}" ]; then
263
		find ${STAGEDIR} -name '*.la' | while read f; do
264
		find "${STAGEDIR}" -name '*.la' | while read -r f; do
264
			grep -q 'libtool library' "${f}" &&
265
			if grep -q 'libtool library' "${f}"; then
265
				err ".la libraries found, port needs USES=libtool" &&
266
				err ".la libraries found, port needs USES=libtool"
266
				return 1 || true
267
				return 1
268
			fi
267
		done
269
		done
268
		# The return above continues here.
270
		# The return above continues here.
269
	fi
271
	fi
Lines 271-289 libtool() { Link Here
271
273
272
libperl() {
274
libperl() {
273
	local has_some_libperl_so files found
275
	local has_some_libperl_so files found
274
	if [ -n "${SITE_ARCH_REL}" -a -d "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" ]; then
276
	if [ -n "${SITE_ARCH_REL}" ] && [ -d "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" ]; then
275
		has_some_libperl_so=0
277
		has_some_libperl_so=0
276
		files=0
278
		files=0
277
		while read f; do
279
		while read -r f; do
278
			# No results presents a blank line from heredoc.
280
			# No results presents a blank line from heredoc.
279
			[ -z "${f}" ] && continue
281
			[ -z "${f}" ] && continue
280
			files=$((files+1))
282
			files=$((files+1))
281
			found=`readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100}
283
			found=$(readelf -d "${f}" | awk "BEGIN {libperl=1; rpath=10; runpath=100}
282
				/NEEDED.*${LIBPERL}/  { libperl = 0 }
284
				/NEEDED.*${LIBPERL}/  { libperl = 0 }
283
				/RPATH.*perl.*CORE/   { rpath   = 0 }
285
				/RPATH.*perl.*CORE/   { rpath   = 0 }
284
				/RUNPATH.*perl.*CORE/ { runpath = 0 }
286
				/RUNPATH.*perl.*CORE/ { runpath = 0 }
285
				END {print libperl+rpath+runpath}
287
				END {print libperl+rpath+runpath}
286
				"`
288
				")
287
			case "${found}" in
289
			case "${found}" in
288
				*1)
290
				*1)
289
					warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"
291
					warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"
Lines 291-297 libperl() { Link Here
291
				*0)
293
				*0)
292
					has_some_libperl_so=1
294
					has_some_libperl_so=1
293
					# Older Perl did not USE_LDCONFIG.
295
					# Older Perl did not USE_LDCONFIG.
294
					if [ ! -f ${LOCALBASE}/${LDCONFIG_DIR}/perl5 ]; then
296
					if [ ! -f "${LOCALBASE}/${LDCONFIG_DIR}/perl5" ]; then
295
						case "${found}" in
297
						case "${found}" in
296
							*1?)
298
							*1?)
297
								warn "${f} does not have a rpath to ${LIBPERL}, not respecting lddlflags?"
299
								warn "${f} does not have a rpath to ${LIBPERL}, not respecting lddlflags?"
Lines 307-316 libperl() { Link Here
307
			esac
309
			esac
308
		# Use heredoc to avoid losing rc from find|while subshell
310
		# Use heredoc to avoid losing rc from find|while subshell
309
		done <<-EOT
311
		done <<-EOT
310
		$(find ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} -name '*.so')
312
		$(find "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" -name '*.so')
311
		EOT
313
		EOT
312
314
313
		if [ ${files} -gt 0 -a ${has_some_libperl_so} -eq 0 ]; then
315
		if [ ${files} -gt 0 ] && [ ${has_some_libperl_so} -eq 0 ]; then
314
			err "None of the .so in ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} are linked with ${LIBPERL}, see above for the full list."
316
			err "None of the .so in ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} are linked with ${LIBPERL}, see above for the full list."
315
			return 1
317
			return 1
316
		else
318
		else
Lines 320-326 libperl() { Link Here
320
}
322
}
321
323
322
prefixvar() {
324
prefixvar() {
323
	if [ ${PREFIX} != ${LINUXBASE} -a -d ${STAGEDIR}${PREFIX}/var ]; then
325
	if [ "${PREFIX}" != "${LINUXBASE}" ] && [ -d "${STAGEDIR}${PREFIX}/var" ]; then
324
		warn "port uses ${PREFIX}/var instead of /var"
326
		warn "port uses ${PREFIX}/var instead of /var"
325
	fi
327
	fi
326
}
328
}
Lines 338-346 terminfo() { Link Here
338
		found=1
340
		found=1
339
		break
341
		break
340
	done
342
	done
341
	if [ -z "${USESTERMINFO}" -a -n "${found}" ]; then
343
	if [ -z "${USESTERMINFO}" ] && [ -n "${found}" ]; then
342
		warn "you need USES=terminfo"
344
		warn "you need USES=terminfo"
343
	elif [ -n "${USESTERMINFO}" -a -z "${found}" ]; then
345
	elif [ -n "${USESTERMINFO}" ] && [ -z "${found}" ]; then
344
		warn "you may not need USES=terminfo"
346
		warn "you may not need USES=terminfo"
345
	fi
347
	fi
346
	return 0
348
	return 0
Lines 352-358 listcontains() { Link Here
352
	lst=$2
354
	lst=$2
353
355
354
	for elt in ${lst} ; do
356
	for elt in ${lst} ; do
355
		if [ ${elt} = ${str} ]; then
357
		if [ "${elt}" = "${str}" ]; then
356
			return 0
358
			return 0
357
		fi
359
		fi
358
	done
360
	done
Lines 364-639 proxydeps_suggest_uses() { Link Here
364
	local lib_file=$2
366
	local lib_file=$2
365
367
366
	# miscellaneous USE clauses
368
	# miscellaneous USE clauses
367
	if [ ${pkg} = 'devel/gettext-runtime' ]; then
369
	if [ "${pkg}" = 'devel/gettext-runtime' ]; then
368
		warn "you need USES+=gettext-runtime"
370
		warn "you need USES+=gettext-runtime"
369
	elif [ ${pkg} = 'databases/sqlite3' ]; then
371
	elif [ "${pkg}" = 'databases/sqlite3' ]; then
370
		warn "you need USES+=sqlite"
372
		warn "you need USES+=sqlite"
371
	elif [ ${pkg} = 'databases/sqlite2' ]; then
373
	elif [ "${pkg}" = 'databases/sqlite2' ]; then
372
		warn "you need USES+=sqlite:2"
374
		warn "you need USES+=sqlite:2"
373
	# Gnome -> same as port
375
	# Gnome -> same as port
374
	# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \&\& echo "\\${pkg} = \\\"\2/\3\\\" -o \\\\"|'|sort|sh
376
	# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\([^[:space:]]*\).*|[ "\1" = "\3" ] \&\& echo "[ \\\"\\${pkg}\\\" = \\\"\2/\3\\\" ] \|\| \\\\"|'|env LANG=C sort|sh
375
	elif [ ${pkg} = "accessibility/atk" -o \
377
	elif [ "${pkg}" = "accessibility/atk" ] || \
376
		${pkg} = "accessibility/atkmm" -o \
378
		[ "${pkg}" = "accessibility/atkmm" ] || \
377
		${pkg} = "graphics/cairo" -o \
379
		[ "${pkg}" = "graphics/cairo" ] || \
378
		${pkg} = "graphics/cairomm" -o \
380
		[ "${pkg}" = "graphics/cairomm" ] || \
379
		${pkg} = "devel/dconf" -o \
381
		[ "${pkg}" = "devel/dconf" ] || \
380
		${pkg} = "audio/esound" -o \
382
		[ "${pkg}" = "audio/esound" ] || \
381
		${pkg} = "devel/gconf2" -o \
383
		[ "${pkg}" = "devel/gconf2" ] || \
382
		${pkg} = "devel/gconfmm26" -o \
384
		[ "${pkg}" = "devel/gconfmm26" ] || \
383
		${pkg} = "devel/glib12" -o \
385
		[ "${pkg}" = "devel/glib12" ] || \
384
		${pkg} = "devel/glib20" -o \
386
		[ "${pkg}" = "devel/glib20" ] || \
385
		${pkg} = "devel/glibmm" -o \
387
		[ "${pkg}" = "devel/glibmm" ] || \
386
		${pkg} = "audio/gsound" -o \
388
		[ "${pkg}" = "audio/gsound" ] || \
387
		${pkg} = "x11-toolkits/gtk12" -o \
389
		[ "${pkg}" = "x11-toolkits/gtk12" ] || \
388
		${pkg} = "x11-toolkits/gtk20" -o \
390
		[ "${pkg}" = "x11-toolkits/gtk20" ] || \
389
		${pkg} = "x11-toolkits/gtk30" -o \
391
		[ "${pkg}" = "x11-toolkits/gtk30" ] || \
390
		${pkg} = "www/gtkhtml3" -o \
392
		[ "${pkg}" = "www/gtkhtml3" ] || \
391
		${pkg} = "www/gtkhtml4" -o \
393
		[ "${pkg}" = "www/gtkhtml4" ] || \
392
		${pkg} = "x11-toolkits/gtkmm20" -o \
394
		[ "${pkg}" = "x11-toolkits/gtkmm20" ] || \
393
		${pkg} = "x11-toolkits/gtkmm24" -o \
395
		[ "${pkg}" = "x11-toolkits/gtkmm24" ] || \
394
		${pkg} = "x11-toolkits/gtkmm30" -o \
396
		[ "${pkg}" = "x11-toolkits/gtkmm30" ] || \
395
		${pkg} = "x11-toolkits/gtksourceview" -o \
397
		[ "${pkg}" = "x11-toolkits/gtksourceview" ] || \
396
		${pkg} = "x11-toolkits/gtksourceview2" -o \
398
		[ "${pkg}" = "x11-toolkits/gtksourceview2" ] || \
397
		${pkg} = "x11-toolkits/gtksourceview3" -o \
399
		[ "${pkg}" = "x11-toolkits/gtksourceview3" ] || \
398
		${pkg} = "x11-toolkits/gtksourceviewmm3" -o \
400
		[ "${pkg}" = "x11-toolkits/gtksourceviewmm3" ] || \
399
		${pkg} = "devel/libbonobo" -o \
401
		[ "${pkg}" = "devel/libbonobo" ] || \
400
		${pkg} = "x11-toolkits/libbonoboui" -o \
402
		[ "${pkg}" = "x11-toolkits/libbonoboui" ] || \
401
		${pkg} = "databases/libgda5" -o \
403
		[ "${pkg}" = "databases/libgda5" ] || \
402
		${pkg} = "databases/libgda5-ui" -o \
404
		[ "${pkg}" = "databases/libgda5-ui" ] || \
403
		${pkg} = "databases/libgdamm5" -o \
405
		[ "${pkg}" = "databases/libgdamm5" ] || \
404
		${pkg} = "devel/libglade2" -o \
406
		[ "${pkg}" = "devel/libglade2" ] || \
405
		${pkg} = "x11/libgnome" -o \
407
		[ "${pkg}" = "x11/libgnome" ] || \
406
		${pkg} = "graphics/libgnomecanvas" -o \
408
		[ "${pkg}" = "graphics/libgnomecanvas" ] || \
407
		${pkg} = "x11/libgnomekbd" -o \
409
		[ "${pkg}" = "x11/libgnomekbd" ] || \
408
		${pkg} = "print/libgnomeprint" -o \
410
		[ "${pkg}" = "print/libgnomeprint" ] || \
409
		${pkg} = "x11-toolkits/libgnomeprintui" -o \
411
		[ "${pkg}" = "x11-toolkits/libgnomeprintui" ] || \
410
		${pkg} = "x11-toolkits/libgnomeui" -o \
412
		[ "${pkg}" = "x11-toolkits/libgnomeui" ] || \
411
		${pkg} = "devel/libgsf" -o \
413
		[ "${pkg}" = "devel/libgsf" ] || \
412
		${pkg} = "www/libgtkhtml" -o \
414
		[ "${pkg}" = "www/libgtkhtml" ] || \
413
		${pkg} = "x11-toolkits/libgtksourceviewmm" -o \
415
		[ "${pkg}" = "x11-toolkits/libgtksourceviewmm" ] || \
414
		${pkg} = "graphics/librsvg2" -o \
416
		[ "${pkg}" = "graphics/librsvg2" ] || \
415
		${pkg} = "devel/libsigc++12" -o \
417
		[ "${pkg}" = "devel/libsigc++12" ] || \
416
		${pkg} = "devel/libsigc++20" -o \
418
		[ "${pkg}" = "devel/libsigc++20" ] || \
417
		${pkg} = "x11-toolkits/libwnck" -o \
419
		[ "${pkg}" = "x11-toolkits/libwnck" ] || \
418
		${pkg} = "x11-toolkits/libwnck3" -o \
420
		[ "${pkg}" = "x11-toolkits/libwnck3" ] || \
419
		${pkg} = "textproc/libxml++26" -o \
421
		[ "${pkg}" = "textproc/libxml++26" ] || \
420
		${pkg} = "textproc/libxml2" -o \
422
		[ "${pkg}" = "textproc/libxml2" ] || \
421
		${pkg} = "textproc/libxslt" -o \
423
		[ "${pkg}" = "textproc/libxslt" ] || \
422
		${pkg} = "x11-wm/metacity" -o \
424
		[ "${pkg}" = "x11-wm/metacity" ] || \
423
		${pkg} = "x11-toolkits/pango" -o \
425
		[ "${pkg}" = "x11-toolkits/pango" ] || \
424
		${pkg} = "x11-toolkits/pangomm" -o \
426
		[ "${pkg}" = "x11-toolkits/pangomm" ] || \
425
		${pkg} = "x11-toolkits/pangox-compat" -o \
427
		[ "${pkg}" = "x11-toolkits/pangox-compat" ] || \
426
		${pkg} = "x11-toolkits/vte" -o \
428
		[ "${pkg}" = "x11-toolkits/vte" ] || \
427
		${pkg} = "x11-toolkits/vte3" ]; then
429
		[ "${pkg}" = "x11-toolkits/vte3" ]; then
428
		warn "you need USE_GNOME+=${pkg#*/}"
430
		warn "you need USE_GNOME+=${pkg#*/}"
429
	# Gnome different as port
431
	# Gnome different as port
430
	# 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
432
	# 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
431
	elif [ ${pkg} = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3"
433
	elif [ "${pkg}" = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3"
432
	elif [ ${pkg} = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf"
434
	elif [ "${pkg}" = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf"
433
	elif [ ${pkg} = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf2"
435
	elif [ "${pkg}" = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf2"
434
	elif [ ${pkg} = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3"
436
	elif [ "${pkg}" = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3"
435
	elif [ ${pkg} = "devel/gnome-vfs" ]; then warn "you need USE_GNOME+=gnomevfs2"
437
	elif [ "${pkg}" = "devel/gnome-vfs" ]; then warn "you need USE_GNOME+=gnomevfs2"
436
	elif [ ${pkg} = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection"
438
	elif [ "${pkg}" = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection"
437
	elif [ ${pkg} = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2"
439
	elif [ "${pkg}" = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2"
438
	elif [ ${pkg} = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl"
440
	elif [ "${pkg}" = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl"
439
	elif [ ${pkg} = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus3"
441
	elif [ "${pkg}" = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus3"
440
	elif [ ${pkg} = "devel/ORBit2" ]; then warn "you need USE_GNOME+=orbit2"
442
	elif [ "${pkg}" = "devel/ORBit2" ]; then warn "you need USE_GNOME+=orbit2"
441
	# mate
443
	# mate
442
	# grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_MATE+=\1"|'
444
	# grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ "${pkg}" = "\2/\3" ]; then warn "you need USE_MATE+=\1"|'
443
	elif [ ${pkg} = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja"
445
	elif [ "${pkg}" = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja"
444
	elif [ ${pkg} = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter"
446
	elif [ "${pkg}" = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter"
445
	elif [ ${pkg} = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop"
447
	elif [ "${pkg}" = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop"
446
	elif [ ${pkg} = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd"
448
	elif [ "${pkg}" = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd"
447
	elif [ ${pkg} = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather"
449
	elif [ "${pkg}" = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather"
448
	elif [ ${pkg} = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco"
450
	elif [ "${pkg}" = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco"
449
	elif [ ${pkg} = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus"
451
	elif [ "${pkg}" = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus"
450
	elif [ ${pkg} = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel"
452
	elif [ "${pkg}" = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel"
451
	elif [ ${pkg} = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit"
453
	elif [ "${pkg}" = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit"
452
	# KDE
454
	# KDE
453
	# grep -B1 _LIB= Mk/Uses/kde.mk | grep _PORT=|sed -e 's/^\(.*\)_PORT=[[:space:]]*\([^[:space:]]*\).*/elif [ ${pkg} = "\2" ]; then warn "you need to use USE_KDE+=\1"/'
455
	# grep -B1 _LIB= Mk/Uses/kde.mk | grep _PORT=|sed -e 's/^\(.*\)_PORT=[[:space:]]*\([^[:space:]]*\).*/elif [ "${pkg}" = "\2" ]; then warn "you need to use USE_KDE+=\1"/'
454
	elif [ ${pkg} = "sysutils/baloo" ]; then warn "you need to use USE_KDE+=baloo"
456
	elif [ "${pkg}" = "sysutils/baloo" ]; then warn "you need to use USE_KDE+=baloo"
455
	elif [ ${pkg} = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets"
457
	elif [ "${pkg}" = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets"
456
	elif [ ${pkg} = "x11/kactivities" ]; then warn "you need to use USE_KDE+=kactivities"
458
	elif [ "${pkg}" = "x11/kactivities" ]; then warn "you need to use USE_KDE+=kactivities"
457
	elif [ ${pkg} = "editors/kate" ]; then warn "you need to use USE_KDE+=kate"
459
	elif [ "${pkg}" = "editors/kate" ]; then warn "you need to use USE_KDE+=kate"
458
	elif [ ${pkg} = "x11/kdelibs4" ]; then warn "you need to use USE_KDE+=kdelibs"
460
	elif [ "${pkg}" = "x11/kdelibs4" ]; then warn "you need to use USE_KDE+=kdelibs"
459
	elif [ ${pkg} = "sysutils/kfilemetadata" ]; then warn "you need to use USE_KDE+=kfilemetadata"
461
	elif [ "${pkg}" = "sysutils/kfilemetadata" ]; then warn "you need to use USE_KDE+=kfilemetadata"
460
	elif [ ${pkg} = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb"
462
	elif [ "${pkg}" = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb"
461
	elif [ ${pkg} = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc"
463
	elif [ "${pkg}" = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc"
462
	elif [ ${pkg} = "graphics/libkdcraw-kde4" ]; then warn "you need to use USE_KDE+=libkdcraw"
464
	elif [ "${pkg}" = "graphics/libkdcraw-kde4" ]; then warn "you need to use USE_KDE+=libkdcraw"
463
	elif [ ${pkg} = "misc/libkdeedu" ]; then warn "you need to use USE_KDE+=libkdeedu"
465
	elif [ "${pkg}" = "misc/libkdeedu" ]; then warn "you need to use USE_KDE+=libkdeedu"
464
	elif [ ${pkg} = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames"
466
	elif [ "${pkg}" = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames"
465
	elif [ ${pkg} = "graphics/libkexiv2-kde4" ]; then warn "you need to use USE_KDE+=libkexiv2"
467
	elif [ "${pkg}" = "graphics/libkexiv2-kde4" ]; then warn "you need to use USE_KDE+=libkexiv2"
466
	elif [ ${pkg} = "graphics/libkipi-kde4" ]; then warn "you need to use USE_KDE+=libkipi"
468
	elif [ "${pkg}" = "graphics/libkipi-kde4" ]; then warn "you need to use USE_KDE+=libkipi"
467
	elif [ ${pkg} = "x11/libkonq" ]; then warn "you need to use USE_KDE+=libkonq"
469
	elif [ "${pkg}" = "x11/libkonq" ]; then warn "you need to use USE_KDE+=libkonq"
468
	elif [ ${pkg} = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane"
470
	elif [ "${pkg}" = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane"
469
	elif [ ${pkg} = "astro/marble" ]; then warn "you need to use USE_KDE+=marble"
471
	elif [ "${pkg}" = "astro/marble" ]; then warn "you need to use USE_KDE+=marble"
470
	elif [ ${pkg} = "sysutils/nepomuk-core" ]; then warn "you need to use USE_KDE+=nepomuk-core"
472
	elif [ "${pkg}" = "sysutils/nepomuk-core" ]; then warn "you need to use USE_KDE+=nepomuk-core"
471
	elif [ ${pkg} = "sysutils/nepomuk-widgets" ]; then warn "you need to use USE_KDE+=nepomuk-widgets"
473
	elif [ "${pkg}" = "sysutils/nepomuk-widgets" ]; then warn "you need to use USE_KDE+=nepomuk-widgets"
472
	elif [ ${pkg} = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular"
474
	elif [ "${pkg}" = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular"
473
	elif [ ${pkg} = "deskutils/kdepimlibs4" ]; then warn "you need to use USE_KDE+=pimlibs"
475
	elif [ "${pkg}" = "deskutils/kdepimlibs4" ]; then warn "you need to use USE_KDE+=pimlibs"
474
	elif [ ${pkg} = "devel/ruby-qtruby" ]; then warn "you need to use USE_KDE+=qtruby"
476
	elif [ "${pkg}" = "devel/ruby-qtruby" ]; then warn "you need to use USE_KDE+=qtruby"
475
	elif [ ${pkg} = "devel/smokegen" ]; then warn "you need to use USE_KDE+=smokegen"
477
	elif [ "${pkg}" = "devel/smokegen" ]; then warn "you need to use USE_KDE+=smokegen"
476
	elif [ ${pkg} = "devel/smokekde" ]; then warn "you need to use USE_KDE+=smokekde"
478
	elif [ "${pkg}" = "devel/smokekde" ]; then warn "you need to use USE_KDE+=smokekde"
477
	elif [ ${pkg} = "devel/smokeqt" ]; then warn "you need to use USE_KDE+=smokeqt"
479
	elif [ "${pkg}" = "devel/smokeqt" ]; then warn "you need to use USE_KDE+=smokeqt"
478
	elif [ ${pkg} = "x11/kde4-workspace" ]; then warn "you need to use USE_KDE+=workspace"
480
	elif [ "${pkg}" = "x11/kde4-workspace" ]; then warn "you need to use USE_KDE+=workspace"
479
	elif [ ${pkg} = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi"
481
	elif [ "${pkg}" = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi"
480
	elif [ ${pkg} = "x11-toolkits/attica" ]; then warn "you need to use USE_KDE+=attica"
482
	elif [ "${pkg}" = "x11-toolkits/attica" ]; then warn "you need to use USE_KDE+=attica"
481
	elif [ ${pkg} = "x11/qimageblitz" ]; then warn "you need to use USE_KDE+=qimageblitz"
483
	elif [ "${pkg}" = "x11/qimageblitz" ]; then warn "you need to use USE_KDE+=qimageblitz"
482
	elif [ ${pkg} = "textproc/soprano" ]; then warn "you need to use USE_KDE+=soprano"
484
	elif [ "${pkg}" = "textproc/soprano" ]; then warn "you need to use USE_KDE+=soprano"
483
	elif [ ${pkg} = "deskutils/libstreamanalyzer" ]; then warn "you need to use USE_KDE+=strigi"
485
	elif [ "${pkg}" = "deskutils/libstreamanalyzer" ]; then warn "you need to use USE_KDE+=strigi"
484
	# KDE Frameworks
486
	# KDE Frameworks
485
	elif [ ${pkg} = "devel/kf5-extra-cmake-modules" ]; then warn "you need to use USE_KDE+=ecm"
487
	elif [ "${pkg}" = "devel/kf5-extra-cmake-modules" ]; then warn "you need to use USE_KDE+=ecm"
486
	elif [ ${pkg} = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils"
488
	elif [ "${pkg}" = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils"
487
	elif [ ${pkg} = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative"
489
	elif [ "${pkg}" = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative"
488
	elif [ ${pkg} = "devel/kf5-kfilemetadata" ]; then warn "you need to use USE_KDE+=filemetadata5"
490
	elif [ "${pkg}" = "devel/kf5-kfilemetadata" ]; then warn "you need to use USE_KDE+=filemetadata5"
489
	elif [ ${pkg} = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio"
491
	elif [ "${pkg}" = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio"
490
	elif [ ${pkg} = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid"
492
	elif [ "${pkg}" = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid"
491
	elif [ ${pkg} = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver"
493
	elif [ "${pkg}" = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver"
492
	elif [ ${pkg} = "devel/kio-extras-kf5" ]; then warn "you need to use USE_KDE+=kio-extras"
494
	elif [ "${pkg}" = "devel/kio-extras-kf5" ]; then warn "you need to use USE_KDE+=kio-extras"
493
	elif [ ${pkg} = "graphics/kf5-kimageformats" ]; then warn "you need to use USE_KDE+=kimageformats"
495
	elif [ "${pkg}" = "graphics/kf5-kimageformats" ]; then warn "you need to use USE_KDE+=kimageformats"
494
	elif [ ${pkg} = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross"
496
	elif [ "${pkg}" = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross"
495
	elif [ ${pkg} = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu"
497
	elif [ "${pkg}" = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu"
496
	elif [ ${pkg} = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo5"
498
	elif [ "${pkg}" = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo5"
497
	elif [ ${pkg} = "sysutils/kf5-bluez-qt" ]; then warn "you need to use USE_KDE+=bluez-qt"
499
	elif [ "${pkg}" = "sysutils/kf5-bluez-qt" ]; then warn "you need to use USE_KDE+=bluez-qt"
498
	elif [ ${pkg} = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet"
500
	elif [ "${pkg}" = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet"
499
	elif [ ${pkg} = "www/kf5-kdewebkit" ]; then warn "you need to use USE_KDE+=kdewebkit"
501
	elif [ "${pkg}" = "www/kf5-kdewebkit" ]; then warn "you need to use USE_KDE+=kdewebkit"
500
	elif [ ${pkg} = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml"
502
	elif [ "${pkg}" = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml"
501
	elif [ ${pkg} = "x11-themes/kf5-breeze-icons" ]; then warn "you need to use USE_KDE+=breeze-icons"
503
	elif [ "${pkg}" = "x11-themes/kf5-breeze-icons" ]; then warn "you need to use USE_KDE+=breeze-icons"
502
	elif [ ${pkg} = "x11-themes/kf5-oxygen-icons5" ]; then warn "you need to use USE_KDE+=oxygen-icons5"
504
	elif [ "${pkg}" = "x11-themes/kf5-oxygen-icons5" ]; then warn "you need to use USE_KDE+=oxygen-icons5"
503
	elif [ ${pkg} = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica5"
505
	elif [ "${pkg}" = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica5"
504
	elif [ ${pkg} = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration"
506
	elif [ "${pkg}" = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration"
505
	elif [ ${pkg} = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded"
507
	elif [ "${pkg}" = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded"
506
	elif [ ${pkg} = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support"
508
	elif [ "${pkg}" = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support"
507
	elif [ ${pkg} = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework"
509
	elif [ "${pkg}" = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework"
508
	elif expr ${pkg} : '.*/kf5-.*' > /dev/null; then
510
	elif expr "${pkg}" : '.*/kf5-.*' > /dev/null; then
509
		warn "you need USE_KDE+=$(echo ${pkg} | sed -E 's|.*/kf5-k||')"
511
		warn "you need USE_KDE+=$(echo "${pkg}" | sed -E 's|.*/kf5-k||')"
510
	# GStreamer 0.10
512
	# GStreamer 0.10
511
	elif [ ${pkg} = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes"
513
	elif [ "${pkg}" = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes"
512
	elif [ ${pkg} = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes"
514
	elif [ "${pkg}" = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes"
513
	elif [ ${pkg} = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad"
515
	elif [ "${pkg}" = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad"
514
	# GStreamer 1
516
	# GStreamer 1
515
	elif [ ${pkg} = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes"
517
	elif [ "${pkg}" = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes"
516
	elif [ ${pkg} = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes"
518
	elif [ "${pkg}" = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes"
517
	elif [ ${pkg} = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad"
519
	elif [ "${pkg}" = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad"
518
	# boost related
520
	# boost related
519
	elif [ ${pkg} = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python"
521
	elif [ "${pkg}" = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python"
520
	# sdl-related
522
	# sdl-related
521
	elif [ ${pkg} = 'devel/sdl12' ]; then
523
	elif [ "${pkg}" = 'devel/sdl12' ]; then
522
		warn "you need USE_SDL+=sdl"
524
		warn "you need USE_SDL+=sdl"
523
	elif echo ${pkg} | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then
525
	elif echo "${pkg}" | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then
524
		warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl_||')"
526
		warn "you need USE_SDL+=$(echo "${pkg}" | sed -E 's|.*/sdl_||')"
525
	elif [ ${pkg} = 'devel/sdl20' ]; then
527
	elif [ "${pkg}" = 'devel/sdl20' ]; then
526
		warn "you need USE_SDL+=sdl2"
528
		warn "you need USE_SDL+=sdl2"
527
	elif echo ${pkg} | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then
529
	elif echo "${pkg}" | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then
528
		warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl2_||')2"
530
		warn "you need USE_SDL+=$(echo "${pkg}" | sed -E 's|.*/sdl2_||')2"
529
	# gl-related
531
	# gl-related
530
	elif expr ${lib_file} : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then
532
	elif expr "${lib_file}" : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then
531
		warn "you need USE_GL+=gl"
533
		warn "you need USE_GL+=gl"
532
	elif expr ${lib_file} : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then
534
	elif expr "${lib_file}" : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then
533
		warn "you need USE_GL+=gbm"
535
		warn "you need USE_GL+=gbm"
534
	elif expr ${lib_file} : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then
536
	elif expr "${lib_file}" : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then
535
		warn "you need USE_GL+=glesv2"
537
		warn "you need USE_GL+=glesv2"
536
	elif expr ${lib_file} : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then
538
	elif expr "${lib_file}" : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then
537
		warn "you need USE_GL+=egl"
539
		warn "you need USE_GL+=egl"
538
	elif [ ${pkg} = 'graphics/glew' ]; then
540
	elif [ "${pkg}" = 'graphics/glew' ]; then
539
		warn "you need USE_GL+=glew"
541
		warn "you need USE_GL+=glew"
540
	elif [ ${pkg} = 'graphics/libGLU' ]; then
542
	elif [ "${pkg}" = 'graphics/libGLU' ]; then
541
		warn "you need USE_GL+=glu"
543
		warn "you need USE_GL+=glu"
542
	elif [ ${pkg} = 'graphics/libGLw' ]; then
544
	elif [ "${pkg}" = 'graphics/libGLw' ]; then
543
		warn "you need USE_GL+=glw"
545
		warn "you need USE_GL+=glw"
544
	elif [ ${pkg} = 'graphics/freeglut' ]; then
546
	elif [ "${pkg}" = 'graphics/freeglut' ]; then
545
		warn "you need USE_GL+=glut"
547
		warn "you need USE_GL+=glut"
546
	# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk
548
	# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk
547
	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
549
	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
548
		warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')"
550
		warn "you need USE_XORG+=$(echo "${pkg}" | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')"
549
	elif [ ${pkg} = 'x11/pixman' ]; then
551
	elif [ "${pkg}" = 'x11/pixman' ]; then
550
		warn "you need USE_XORG+=pixman"
552
		warn "you need USE_XORG+=pixman"
551
	# Qt4
553
	# Qt4
552
	elif expr ${pkg} : '.*/qt4-.*' > /dev/null; then
554
	elif expr "${pkg}" : '.*/qt4-.*' > /dev/null; then
553
		warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's|.*/qt4-||')"
555
		warn "you need USE_QT4+=$(echo "${pkg}" | sed -E 's|.*/qt4-||')"
554
	elif expr ${pkg} : '.*/.*-qt4' > /dev/null; then
556
	elif expr "${pkg}" : '.*/.*-qt4' > /dev/null; then
555
		warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's|.*/(.*)-qt4|\1|')"
557
		warn "you need USE_QT4+=$(echo "${pkg}" | sed -E 's|.*/(.*)-qt4|\1|')"
556
	# Qt5
558
	# Qt5
557
	elif expr ${pkg} : '.*/qt5-.*' > /dev/null; then
559
	elif expr "${pkg}" : '.*/qt5-.*' > /dev/null; then
558
		warn "you need USE_QT5+=$(echo ${pkg} | sed -E 's|.*/qt5-||')"
560
		warn "you need USE_QT5+=$(echo "${pkg}" | sed -E 's|.*/qt5-||')"
559
	# MySQL
561
	# MySQL
560
	elif expr ${lib_file} : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then
562
	elif expr "${lib_file}" : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then
561
		warn "you need USES+=mysql"
563
		warn "you need USES+=mysql"
562
	# postgresql
564
	# postgresql
563
	elif expr ${pkg} : "^databases/postgresql.*-client" > /dev/null; then
565
	elif expr "${pkg}" : "^databases/postgresql.*-client" > /dev/null; then
564
		warn "you need USES+=pgsql"
566
		warn "you need USES+=pgsql"
565
	# bdb
567
	# bdb
566
	elif expr ${pkg} : "^databases/db[456]" > /dev/null; then
568
	elif expr "${pkg}" : "^databases/db[456]" > /dev/null; then
567
		warn "you need USES+=bdb"
569
		warn "you need USES+=bdb"
568
	# fam/gamin
570
	# fam/gamin
569
	elif [ ${pkg} = "devel/fam" -o ${pkg} = "devel/gamin" ]; then
571
	elif [ "${pkg}" = "devel/fam" ] || [ "${pkg}" = "devel/gamin" ]; then
570
		warn "you need USES+=fam"
572
		warn "you need USES+=fam"
571
	# firebird
573
	# firebird
572
	elif [ ${pkg} = "databases/firebird25-client" ]; then
574
	elif [ "${pkg}" = "databases/firebird25-client" ]; then
573
		warn "you need USES+=firebird"
575
		warn "you need USES+=firebird"
574
	# fuse
576
	# fuse
575
	elif [ ${pkg} = "sysutils/fusefs-libs" ]; then
577
	elif [ "${pkg}" = "sysutils/fusefs-libs" ]; then
576
		warn "you need USES+=fuse"
578
		warn "you need USES+=fuse"
577
	# gnustep
579
	# gnustep
578
	elif [ ${pkg} = "lang/gnustep-base" ]; then
580
	elif [ "${pkg}" = "lang/gnustep-base" ]; then
579
		warn "you need USES+=gnustep and USE_GNUSTEP+=base"
581
		warn "you need USES+=gnustep and USE_GNUSTEP+=base"
580
	elif [ ${pkg} = "x11-toolkits/gnustep-gui" ]; then
582
	elif [ "${pkg}" = "x11-toolkits/gnustep-gui" ]; then
581
		warn "you need USES+=gnustep and USE_GNUSTEP+=gui"
583
		warn "you need USES+=gnustep and USE_GNUSTEP+=gui"
582
	# iconv
584
	# iconv
583
	elif [ ${pkg} = "converters/libiconv" ]; then
585
	elif [ "${pkg}" = "converters/libiconv" ]; then
584
		warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs"
586
		warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs"
585
	# jpeg
587
	# jpeg
586
	elif [ ${pkg} = "graphics/jpeg" -o ${pkg} = "graphics/jpeg-turbo" ]; then
588
	elif [ "${pkg}" = "graphics/jpeg" ] || [ "${pkg}" = "graphics/jpeg-turbo" ]; then
587
		warn "you need USES+=jpeg"
589
		warn "you need USES+=jpeg"
588
	# libarchive
590
	# libarchive
589
	elif [ ${pkg} = "archivers/libarchive" ]; then
591
	elif [ "${pkg}" = "archivers/libarchive" ]; then
590
		warn "you need USES+=libarchive"
592
		warn "you need USES+=libarchive"
591
	elif [ ${pkg} = "devel/libedit" ]; then
593
	elif [ "${pkg}" = "devel/libedit" ]; then
592
		warn "you need USES+=libedit"
594
		warn "you need USES+=libedit"
593
	# lua
595
	# lua
594
	elif expr ${pkg} : "^lang/lua" > /dev/null; then
596
	elif expr "${pkg}" : "^lang/lua" > /dev/null; then
595
		warn "you need USES+=lua"
597
		warn "you need USES+=lua"
596
	# motif
598
	# motif
597
	elif [ ${pkg} = "x11-toolkits/lesstif" -o ${pkg} = "x11-toolkits/open-motif" ]; then
599
	elif [ "${pkg}" = "x11-toolkits/lesstif" ] || [ "${pkg}" = "x11-toolkits/open-motif" ]; then
598
		warn "you need USES+=motif"
600
		warn "you need USES+=motif"
599
	# ncurses
601
	# ncurses
600
	elif [ ${pkg} = "devel/ncurses" ]; then
602
	elif [ "${pkg}" = "devel/ncurses" ]; then
601
		warn "you need USES+=ncurses"
603
		warn "you need USES+=ncurses"
602
	# objc
604
	# objc
603
	elif [ ${pkg} = "lang/libobjc2" ]; then
605
	elif [ "${pkg}" = "lang/libobjc2" ]; then
604
		warn "you need USES+=objc"
606
		warn "you need USES+=objc"
605
	# openal
607
	# openal
606
	elif [ ${pkg} = "audio/openal" -o ${pkg} = "audio/openal-soft" -o ${pkg} = "audio/freealut" ]; then
608
	elif [ "${pkg}" = "audio/openal" ] || [ "${pkg}" = "audio/openal-soft" ] || [ "${pkg}" = "audio/freealut" ]; then
607
		warn "you need USES+=openal"
609
		warn "you need USES+=openal"
608
	# pure
610
	# pure
609
	elif [ ${pkg} = "lang/pure" ]; then
611
	elif [ "${pkg}" = "lang/pure" ]; then
610
		warn "you need USES+=pure"
612
		warn "you need USES+=pure"
611
	# readline
613
	# readline
612
	elif [ ${pkg} = "devel/readline" ]; then
614
	elif [ "${pkg}" = "devel/readline" ]; then
613
		warn "you need USES+=readline"
615
		warn "you need USES+=readline"
614
	# ssl
616
	# ssl
615
	elif [ ${pkg} = "security/openssl" -o ${pkg} = "security/openssl-devel" \
617
	elif [ "${pkg}" = "security/openssl" ] || [ "${pkg}" = "security/openssl-devel" ] || \
616
	  -o ${pkg} = "security/libressl" -o ${pkg} = "security/libressl-devel" \
618
	  [ "${pkg}" = "security/libressl" ] || [ "${pkg}" = "security/libressl-devel" ]; then
617
	  ]; then
618
		warn "you need USES=ssl"
619
		warn "you need USES=ssl"
619
	# Tcl
620
	# Tcl
620
	elif expr ${pkg} : "^lang/tcl" > /dev/null; then
621
	elif expr "${pkg}" : "^lang/tcl" > /dev/null; then
621
		warn "you need USES+=tcl"
622
		warn "you need USES+=tcl"
622
	# Tk
623
	# Tk
623
	elif expr ${pkg} : "^x11-toolkits/tk" > /dev/null; then
624
	elif expr "${pkg}" : "^x11-toolkits/tk" > /dev/null; then
624
		warn "you need USES+=tk"
625
		warn "you need USES+=tk"
625
	# Xfce
626
	# Xfce
626
	# grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|'
627
	# grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ "${pkg}" = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|'
627
	elif [ ${pkg} = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon"
628
	elif [ "${pkg}" = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon"
628
	elif [ ${pkg} = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo"
629
	elif [ "${pkg}" = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo"
629
	elif [ ${pkg} = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui"
630
	elif [ "${pkg}" = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui"
630
	elif [ ${pkg} = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu"
631
	elif [ "${pkg}" = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu"
631
	elif [ ${pkg} = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil"
632
	elif [ "${pkg}" = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil"
632
	elif [ ${pkg} = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel"
633
	elif [ "${pkg}" = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel"
633
	elif [ ${pkg} = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar"
634
	elif [ "${pkg}" = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar"
634
	elif [ ${pkg} = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf"
635
	elif [ "${pkg}" = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf"
635
	# default
636
	# default
636
	elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then
637
	elif expr "${lib_file}" : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then
637
		lib_file=${lib_file#${LOCALBASE}/lib/}
638
		lib_file=${lib_file#${LOCALBASE}/lib/}
638
		lib_file=${lib_file%.so*}.so
639
		lib_file=${lib_file%.so*}.so
639
		warn "you need LIB_DEPENDS+=${lib_file}:${pkg}"
640
		warn "you need LIB_DEPENDS+=${lib_file}:${pkg}"
Lines 647-664 proxydeps() { Link Here
647
648
648
	# Check all dynamicaly linked ELF files
649
	# Check all dynamicaly linked ELF files
649
	# Some .so are not executable, but we want to check them too.
650
	# Some .so are not executable, but we want to check them too.
650
	while read file; do
651
	while read -r file; do
651
		# No results presents a blank line from heredoc.
652
		# No results presents a blank line from heredoc.
652
		[ -z "${file}" ] && continue
653
		[ -z "${file}" ] && continue
653
		while read dep_file; do
654
		while read -r dep_file; do
654
			# No results presents a blank line from heredoc.
655
			# No results presents a blank line from heredoc.
655
			[ -z "${dep_file}" ] && continue
656
			[ -z "${dep_file}" ] && continue
656
			# Skip files we already checked.
657
			# Skip files we already checked.
657
			if listcontains ${dep_file} "${already}"; then
658
			if listcontains "${dep_file}" "${already}"; then
658
				continue
659
				continue
659
			fi
660
			fi
660
			if $(pkg which -q ${dep_file} > /dev/null 2>&1); then
661
			if pkg which -q "${dep_file}" > /dev/null 2>&1; then
661
				dep_file_pkg=$(pkg which -qo ${dep_file})
662
				dep_file_pkg=$(pkg which -qo "${dep_file}")
662
663
663
				# Check that the .so we need has a SONAME
664
				# Check that the .so we need has a SONAME
664
				if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then
665
				if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then
Lines 668-683 proxydeps() { Link Here
668
				fi
669
				fi
669
670
670
				# If we don't already depend on it, and we don't provide it
671
				# If we don't already depend on it, and we don't provide it
671
				if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
672
				if ! listcontains "${dep_file_pkg}" "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
672
					# If the package has a flavor, check that the dependency is not on that particular flavor.
673
					# If the package has a flavor, check that the dependency is not on that particular flavor.
673
					flavor=$(pkg annotate -q -S "${dep_file_pkg}" flavor)
674
					flavor=$(pkg annotate -q -S "${dep_file_pkg}" flavor)
674
					if [ -n "${flavor}" ]; then
675
					if [ -n "${flavor}" ]; then
675
						if listcontains ${dep_file_pkg}@${flavor} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
676
						if listcontains "${dep_file_pkg}@${flavor}" "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
676
							continue
677
							continue
677
						fi
678
						fi
678
					fi
679
					fi
679
					err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency"
680
					err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency"
680
					proxydeps_suggest_uses ${dep_file_pkg} ${dep_file}
681
					proxydeps_suggest_uses "${dep_file_pkg}" "${dep_file}"
681
					rc=1
682
					rc=1
682
				fi
683
				fi
683
			else
684
			else
Lines 687-702 proxydeps() { Link Here
687
			already="${already} ${dep_file}"
688
			already="${already} ${dep_file}"
688
		done <<-EOT
689
		done <<-EOT
689
		$(env LD_LIBMAP_DISABLE=1 ldd -a "${STAGEDIR}${file}" | \
690
		$(env LD_LIBMAP_DISABLE=1 ldd -a "${STAGEDIR}${file}" | \
690
			awk '\
691
			awk '
691
			BEGIN {section=0}\
692
			BEGIN {section=0}
692
			/^\// {section++}\
693
			/^\// {section++}
693
			!/^\// && section<=1 && ($3 ~ "^'${PREFIX}'" || $3 ~ "^'${LOCALBASE}'") {print $3}')
694
			!/^\// && section<=1 && ($3 ~ "^'"${PREFIX}"'" || $3 ~ "^'"${LOCALBASE}"'") {print $3}')
694
		EOT
695
		EOT
695
	done <<-EOT
696
	done <<-EOT
696
	$(list_stagedir_elfs | \
697
	$(list_stagedir_elfs | \
697
		file -F $'\1' -f - | \
698
		file -F "${SOH}" -f - | \
698
		grep -a 'ELF.*FreeBSD.*dynamically linked' | \
699
		grep -a 'ELF.*FreeBSD.*dynamically linked' | \
699
		cut -f 1 -d $'\1'| \
700
		cut -f 1 -d "${SOH}"| \
700
		sed -e 's/^\.//')
701
		sed -e 's/^\.//')
701
	EOT
702
	EOT
702
703
Lines 706-718 proxydeps() { Link Here
706
}
707
}
707
708
708
sonames() {
709
sonames() {
709
	[ ! -d ${STAGEDIR}${PREFIX}/lib -o -n "${BUNDLE_LIBS}" ] && return 0
710
	[ ! -d "${STAGEDIR}${PREFIX}/lib" ] || [ -n "${BUNDLE_LIBS}" ] && return 0
710
	while read f; do
711
	while read -r f; do
711
		# No results presents a blank line from heredoc.
712
		# No results presents a blank line from heredoc.
712
		[ -z "${f}" ] && continue
713
		[ -z "${f}" ] && continue
713
		# Ignore symlinks
714
		# Ignore symlinks
714
		[ -f "${f}" -a ! -L "${f}" ] || continue
715
		if [ -f "${f}" ] && [ ! -L "${f}" ]; then
715
		if ! readelf -d ${f} | grep -q SONAME; then
716
			continue
717
		fi
718
		if ! readelf -d "${f}" | grep -q SONAME; then
716
			warn "${f} doesn't have a SONAME."
719
			warn "${f} doesn't have a SONAME."
717
			warn "pkg(8) will not register it as being provided by the port."
720
			warn "pkg(8) will not register it as being provided by the port."
718
			warn "If another port depend on it, pkg will not be able to know where it comes from."
721
			warn "If another port depend on it, pkg will not be able to know where it comes from."
Lines 727-733 sonames() { Link Here
727
		fi
730
		fi
728
	# Use heredoc to avoid losing rc from find|while subshell
731
	# Use heredoc to avoid losing rc from find|while subshell
729
	done <<-EOT
732
	done <<-EOT
730
	$(find ${STAGEDIR}${PREFIX}/lib -name '*.so.*')
733
	$(find "${STAGEDIR}${PREFIX}/lib" -name '*.so.*')
731
	EOT
734
	EOT
732
}
735
}
733
736
Lines 749-761 perlcore() { Link Here
749
	local portname version module gotsome
752
	local portname version module gotsome
750
	[ -x "${LOCALBASE}/bin/corelist" ] || return 0
753
	[ -x "${LOCALBASE}/bin/corelist" ] || return 0
751
	for dep in ${UNIFIED_DEPENDS}; do
754
	for dep in ${UNIFIED_DEPENDS}; do
752
		portname=$(expr "${dep}" : ".*/p5-\(.*\)")
755
		portname=$(expr "${dep}" : ".*/p5-\\(.*\\)")
753
		if [ -n "${portname}" ]; then
756
		if [ -n "${portname}" ]; then
754
			gotsome=1
757
			gotsome=1
755
			module=$(perlcore_port_module_mapping "${portname}")
758
			module=$(perlcore_port_module_mapping "${portname}")
756
			version=$(expr "${dep}" : ".*>=*\([^:<]*\)")
759
			version=$(expr "${dep}" : ".*>=*\\([^:<]*\\)")
757
760
758
			while read l; do
761
			while read -r l; do
759
				case "${l}" in
762
				case "${l}" in
760
					*was\ not\ in\ CORE*)
763
					*was\ not\ in\ CORE*)
761
						# This never was with Perl
764
						# This never was with Perl
Lines 780-786 perlcore() { Link Here
780
						err "This line is not handled: \"${l}\""
783
						err "This line is not handled: \"${l}\""
781
				esac
784
				esac
782
			done <<-EOT
785
			done <<-EOT
783
			$(${LOCALBASE}/bin/corelist "${module}"|tail -1)
786
			$("${LOCALBASE}"/bin/corelist "${module}"|tail -1)
784
			EOT
787
			EOT
785
		fi
788
		fi
786
	done
789
	done
Lines 792-798 perlcore() { Link Here
792
no_arch() {
795
no_arch() {
793
	[ -z "$NO_ARCH" ] && return
796
	[ -z "$NO_ARCH" ] && return
794
	rc=0
797
	rc=0
795
	while read f; do
798
	while read -r f; do
796
		[ -z "$f" ] && continue
799
		[ -z "$f" ] && continue
797
		if [ -n "$NO_ARCH_IGNORE" ]; then
800
		if [ -n "$NO_ARCH_IGNORE" ]; then
798
			skip=
801
			skip=
Lines 803-815 no_arch() { Link Here
803
			done
806
			done
804
			[ "$skip" ] && continue
807
			[ "$skip" ] && continue
805
		fi
808
		fi
806
		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."
809
		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."
807
		rc=1
810
		rc=1
808
	done <<-EOF
811
	done <<-EOF
809
	$(list_stagedir_elfs  \
812
	$(list_stagedir_elfs  \
810
		| file -F $'\1' -f - -N \
813
		| file -F "${SOH}" -f - -N \
811
		| grep -aE 'ELF .* [LM]SB .*, .*, version [0-9]+ \(FreeBSD\)' \
814
		| grep -aE 'ELF .* [LM]SB .*, .*, version [0-9]+ \(FreeBSD\)' \
812
		| cut -f 1 -d $'\1')
815
		| cut -f 1 -d "${SOH}")
813
	EOF
816
	EOF
814
	return $rc
817
	return $rc
815
}
818
}
Lines 818-836 gemdeps() Link Here
818
{
821
{
819
	rc=0
822
	rc=0
820
	if [ "${PKGBASE%%-*}" = "rubygem" ]; then
823
	if [ "${PKGBASE%%-*}" = "rubygem" ]; then
824
		# shellcheck disable=SC2153
825
		# In the heredoc, ${PORTNAME} comes from the environment, not
826
		# to be confused with ${portname}
821
		while read -r l; do
827
		while read -r l; do
822
			if [ -n "${l}" ]; then
828
			if [ -n "${l}" ]; then
823
				name=${l%% *}
829
				name=${l%% *}
824
				vers=${l#* }
830
				vers=${l#* }
825
				while read -r v; do
831
				while read -r v; do
826
					if ! while read -r p; do
832
					if ! while read -r p; do
827
						${LOCALBASE}/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')"
833
						"${LOCALBASE}"/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')"
828
					done | grep -qFx OK; then
834
					done | grep -qFx OK; then
829
						err RubyGem dependency ${name} ${v} is not satisfied.
835
						err RubyGem dependency "${name}" "${v}" is not satisfied.
830
						rc=1
836
						rc=1
831
					fi <<-EOF
837
					fi <<-EOF
832
					$(${LOCALBASE}/bin/gem list -e "${name}" \
838
					$("${LOCALBASE}"/bin/gem list -e "${name}" \
833
						| sed "s|.*(\(.*\))|\1|" \
839
						| sed "s|.*(\\(.*\\))|\\1|" \
834
						| tr -d ' ' \
840
						| tr -d ' ' \
835
						| tr , '\n')
841
						| tr , '\n')
836
					EOF
842
					EOF
Lines 842-848 gemdeps() Link Here
842
				EOF
848
				EOF
843
			fi
849
			fi
844
		done <<-EOF
850
		done <<-EOF
845
		$(grep -a 'add_runtime_dependency' ${STAGEDIR}${PREFIX}/lib/ruby/gems/*/specifications/${PORTNAME}-*.gemspec \
851
		$(grep -a 'add_runtime_dependency' "${STAGEDIR}${PREFIX}"/lib/ruby/gems/*/specifications/"${PORTNAME}"-*.gemspec \
846
			| sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \
852
			| sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \
847
			| sort -u)
853
			| sort -u)
848
		EOF
854
		EOF
Lines 868-874 gemfiledeps() Link Here
868
	fi
874
	fi
869
	
875
	
870
	# advise install of bundler if its not present for check
876
	# advise install of bundler if its not present for check
871
	if ! type bundle > /dev/null 2>&1; then
877
	if ! command -v bundle > /dev/null 2>&1; then
872
		notice "Please install sysutils/rubygem-bundler for additional Gemfile-checks"
878
		notice "Please install sysutils/rubygem-bundler for additional Gemfile-checks"
873
		return 0
879
		return 0
874
	fi
880
	fi
Lines 885-896 gemfiledeps() Link Here
885
		# use bundle to check if Gemfile is satisfied
891
		# use bundle to check if Gemfile is satisfied
886
		# if bundle returns 1 the Gemfile is not satisfied
892
		# if bundle returns 1 the Gemfile is not satisfied
887
		# and so stage-qa isn't also
893
		# and so stage-qa isn't also
888
		if ! bundle check --dry-run --gemfile $f > /dev/null 2>&1; then
894
		if ! bundle check --dry-run --gemfile "$f" > /dev/null 2>&1; then
889
			warn "Dependencies defined in ${f} are not satisfied"
895
			warn "Dependencies defined in ${f} are not satisfied"
890
		fi
896
		fi
891
      
897
      
892
	done <<-EOF
898
	done <<-EOF
893
		$(find ${STAGEDIR} -name Gemfile)
899
		$(find "${STAGEDIR}" -name Gemfile)
894
		EOF
900
		EOF
895
	return 0
901
	return 0
896
}
902
}
Lines 917-923 checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" Link Here
917
checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors"
923
checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors"
918
924
919
ret=0
925
ret=0
920
cd ${STAGEDIR}
926
cd "${STAGEDIR}" || exit 1
921
for check in ${checks}; do
927
for check in ${checks}; do
922
	${check} || ret=1
928
	${check} || ret=1
923
done
929
done
(-)Mk/Scripts/smart_makepatch.sh (-94 / +96 lines)
Lines 25-33 Link Here
25
# if those targets modify source files (e.g. with sed).  You may also
25
# if those targets modify source files (e.g. with sed).  You may also
26
# want to disable EXTRA_PATCHES as well if that is being used.
26
# want to disable EXTRA_PATCHES as well if that is being used.
27
27
28
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_SMART_MAKEPATCH}" ] && set -x
28
[ -n "${DEBUG_MK_SCRIPTS}" ] || [ -n "${DEBUG_MK_SCRIPTS_SMART_MAKEPATCH}" ] && set -x
29
29
30
if [ -z "${PATCHDIR}" -o -z "${PATCH_WRKSRC}" -o -z "${WRKDIR}" ]; then
30
if [ -z "${PATCHDIR}" ] || [ -z "${PATCH_WRKSRC}" ] || [ -z "${WRKDIR}" ]; then
31
	echo "WRKDIR, PATCHDIR, and PATCH_WRKSRC required in environment." >&2
31
	echo "WRKDIR, PATCHDIR, and PATCH_WRKSRC required in environment." >&2
32
	exit 1
32
	exit 1
33
fi
33
fi
Lines 48-59 esac Link Here
48
strip_path() {
48
strip_path() {
49
	local raw_name=$1
49
	local raw_name=$1
50
	if [ "${STRIP_COMPONENTS}" = "0" ]; then
50
	if [ "${STRIP_COMPONENTS}" = "0" ]; then
51
		echo ${raw_name}
51
		echo "${raw_name}"
52
	else
52
	else
53
		echo ${raw_name} | awk -v sc=${STRIP_COMPONENTS} -F "/" \
53
		echo "${raw_name}" | awk -v sc="${STRIP_COMPONENTS}" -F "/" \
54
		'{ for (x = sc + 1; x <= NF; x++) { \
54
		'{ for (x = sc + 1; x <= NF; x++) {
55
			slash = (x>sc+1) ? "/" : ""; \
55
			slash = (x>sc+1) ? "/" : "";
56
			printf ("%s%s", slash, $x); \
56
			printf ("%s%s", slash, $x);
57
		   }}'
57
		   }}'
58
	fi
58
	fi
59
}
59
}
Lines 61-76 strip_path() { Link Here
61
std_patch_filename() {
61
std_patch_filename() {
62
	local sans_cwd
62
	local sans_cwd
63
	local raw_name
63
	local raw_name
64
	sans_cwd=$(echo $1 | sed 's|^\.\/||')
64
	sans_cwd=$(echo "$1" | sed 's|^\.\/||')
65
	raw_name=$(strip_path ${sans_cwd})
65
	raw_name=$(strip_path "${sans_cwd}")
66
	echo patch-$(echo ${raw_name} | sed -e 's|_|&&|g; s|/|_|g')
66
	echo "patch-$(echo "${raw_name}" | sed -e 's|_|&&|g; s|/|_|g')"
67
}
67
}
68
68
69
patchdir_files_list() {
69
patchdir_files_list() {
70
	if [ -d "${PATCHDIR}" ]; then
70
	if [ -d "${PATCHDIR}" ]; then
71
		(cd ${PATCHDIR} && \
71
		(cd "${PATCHDIR}" && \
72
			find * -type f -name "patch-*" -maxdepth 0 \
72
			find ./* -type f -name "patch-*" -maxdepth 0 \
73
			2>/dev/null | sed -e '/\.orig$/d'
73
			2>/dev/null | sed -e 's,^\./,,; /\.orig$/d'
74
		)
74
		)
75
	fi;
75
	fi;
76
}
76
}
Lines 81-108 valid_name() { Link Here
81
	local first_target
81
	local first_target
82
	local testres
82
	local testres
83
	local lps
83
	local lps
84
	first_target=$(echo $2 | sed 's|^\.\/||')
84
	first_target=$(echo "$2" | sed 's|^\.\/||')
85
	for lps in __ - + ; do
85
	for lps in __ - + ; do
86
		testres=patch-$(echo ${first_target} | sed -e "s|/|${lps}|g")
86
		testres=patch-$(echo "${first_target}" | sed -e "s|/|${lps}|g")
87
		if [ "${testres}" = "${current_patch_name}" ]; then
87
		if [ "${testres}" = "${current_patch_name}" ]; then
88
			result=${testres}
88
			result=${testres}
89
			break
89
			break
90
		fi
90
		fi
91
	done
91
	done
92
	echo ${result}
92
	echo "${result}"
93
}
93
}
94
94
95
map_existing_patches() {
95
map_existing_patches() {
96
	mkdir -p ${WORKAREA}
96
	mkdir -p "${WORKAREA}"
97
	: > ${PATCHMAP}
97
	: > "${PATCHMAP}"
98
	local target
98
	local target
99
	local future_name
99
	local future_name
100
	local std_target
100
	local std_target
101
	local P
101
	local P
102
	local t
102
	local t
103
	for P in ${old_patch_list}; do
103
	for P in ${old_patch_list}; do
104
		target=$(cd ${PATCHDIR} && \
104
		target=$(cd "${PATCHDIR}" && \
105
			grep "^+++ " ${P} | awk '{print $2}'
105
			grep "^+++ " "${P}" | awk '{print $2}'
106
		)
106
		)
107
		# For single patches, we honor previous separators, but use
107
		# For single patches, we honor previous separators, but use
108
		# a standard patch name if the current patch name does not
108
		# a standard patch name if the current patch name does not
Lines 114-125 map_existing_patches() { Link Here
114
				future_name=${P}
114
				future_name=${P}
115
				break;
115
				break;
116
			fi
116
			fi
117
			std_target=$(std_patch_filename ${t})
117
			std_target=$(std_patch_filename "${t}")
118
			future_name=$(valid_name ${P} ${t} ${std_target})
118
			future_name=$(valid_name "${P}" "${t}" "${std_target}")
119
		done
119
		done
120
		for t in ${target}; do
120
		for t in ${target}; do
121
			std_target=$(std_patch_filename ${t})
121
			std_target=$(std_patch_filename "${t}")
122
			echo "${future_name}	${std_target}" >> ${PATCHMAP}
122
			echo "${future_name}	${std_target}" >> "${PATCHMAP}"
123
		done
123
		done
124
	done
124
	done
125
}
125
}
Lines 130-183 extract_comment_from_patch() { Link Here
130
	local rawname
130
	local rawname
131
	local fname
131
	local fname
132
	local num
132
	local num
133
	contains=$(grep "^+++ " ${existing_patch} | awk '{x++; print x}')
133
	contains=$(grep "^+++ " "${existing_patch}" | awk '{x++; print x}')
134
	for num in ${contains}; do
134
	for num in ${contains}; do
135
		rawname=$(grep "^+++ " ${existing_patch} | \
135
		rawname=$(grep "^+++ " "${existing_patch}" | \
136
			awk -v num=${num} '{x++; if (x==num) print $2}')
136
			awk -v num="${num}" '{x++; if (x==num) print $2}')
137
		fname=$(std_patch_filename $rawname)
137
		fname=$(std_patch_filename "$rawname")
138
		awk -v num=${num} '\
138
		awk -v num="${num}" '
139
		BEGIN { done=0; x=0; hunk=0; looking=(num==1) } \
139
		BEGIN { done=0; x=0; hunk=0; looking=(num==1) }
140
		{ \
140
		{
141
		    if (!done) { \
141
		    if (!done) {
142
		        if ($1 == "@@") { \
142
		        if ($1 == "@@") {
143
		            split ($2,a,","); \
143
		            split ($2,a,",");
144
		            split ($3,b,","); \
144
		            split ($3,b,",");
145
		            hca = a[2];
145
		            hca = a[2];
146
		            hcb = a[3];
146
		            hcb = a[3];
147
		            hunk = 1;
147
		            hunk = 1;
148
		        } else if (hunk) { \
148
		        } else if (hunk) {
149
		            first=substr($1,1,1); \
149
		            first=substr($1,1,1);
150
		            if (first == "-") { hca-- } \
150
		            if (first == "-") { hca-- }
151
		            else if (first == "+") { hcb-- } \
151
		            else if (first == "+") { hcb-- }
152
		            else {hca--; hcb--} \
152
		            else {hca--; hcb--}
153
		            if (hca == 0 && hcb == 0) {hunk = 0} \
153
		            if (hca == 0 && hcb == 0) {hunk = 0}
154
		        } \
154
		        }
155
			if ($1 == "---") { \
155
			if ($1 == "---") {
156
			   x++; \
156
			   x++;
157
			   if (x == num) { done = 1 } \
157
			   if (x == num) { done = 1 }
158
			   if (x + 1 == num) { looking = 1 } \
158
			   if (x + 1 == num) { looking = 1 }
159
			} else if (!hunk && looking) { \
159
			} else if (!hunk && looking) {
160
		            if ($1!="diff" && $1!="index" && $1!="+++") {\
160
		            if ($1!="diff" && $1!="index" && $1!="+++") {
161
		                print $0 \
161
		                print $0
162
		            } \
162
		            }
163
		        } \
163
		        }
164
		    } \
164
		    }
165
		}' ${existing_patch} > ${COMMENTS}/${fname}
165
		}' "${existing_patch}" > "${COMMENTS}/${fname}"
166
	done
166
	done
167
}
167
}
168
168
169
extract_comments() {
169
extract_comments() {
170
	mkdir -p ${COMMENTS}
170
	mkdir -p "${COMMENTS}"
171
	rm -f ${COMMENTS}/*
171
	rm -f "${COMMENTS}"/*
172
	local P
172
	local P
173
	for P in ${old_patch_list}; do
173
	for P in ${old_patch_list}; do
174
		extract_comment_from_patch ${P}
174
		extract_comment_from_patch "${P}"
175
	done
175
	done
176
}
176
}
177
177
178
regenerate_patches() {
178
regenerate_patches() {
179
	mkdir -p ${REGENNED}
179
	mkdir -p "${REGENNED}"
180
	rm -f ${REGENNED}/*
180
	rm -f "${REGENNED}"/*
181
	[ ! -d "${PATCH_WRKSRC}" ] && return
181
	[ ! -d "${PATCH_WRKSRC}" ] && return
182
182
183
	local F
183
	local F
Lines 186-232 regenerate_patches() { Link Here
186
	local ORIG
186
	local ORIG
187
	local new_list
187
	local new_list
188
	new_list=$(cd "${PATCH_WRKSRC}" && \
188
	new_list=$(cd "${PATCH_WRKSRC}" && \
189
		find -s * -type f -name '*.orig' 2>/dev/null)
189
		find -s ./* -type f -name '*.orig' 2>/dev/null)
190
	(cd "${PATCH_WRKSRC}" && for F in ${new_list}; do
190
	(cd "${PATCH_WRKSRC}" && for F in ${new_list}; do
191
		ORIG=${F#./}
191
		ORIG=${F#./}
192
		NEW=${ORIG%.orig}
192
		NEW=${ORIG%.orig}
193
		cmp -s ${ORIG} ${NEW} && continue
193
		cmp -s "${ORIG}" "${NEW}" && continue
194
		OUT=${REGENNED}/$(std_patch_filename ${NEW})
194
		OUT=${REGENNED}/$(std_patch_filename "${NEW}")
195
		TZ=UTC diff -udp ${ORIG} ${NEW} | sed \
195
		TZ=UTC diff -udp "${ORIG}" "${NEW}" | sed \
196
			-e '/^---/s|\.[0-9]* +0000$| UTC|' \
196
			-e '/^---/s|\.[0-9]* +0000$| UTC|' \
197
			-e '/^+++/s|\([[:blank:]][-0-9:.+]*\)*$||' \
197
			-e '/^+++/s|\([[:blank:]][-0-9:.+]*\)*$||' \
198
			> ${OUT} || true
198
			> "${OUT}" || true
199
	done)
199
	done)
200
}
200
}
201
201
202
get_patch_name() {
202
get_patch_name() {
203
	awk -v name=$1 '\
203
	awk -v name="$1" '
204
	{ if ($2 == name) \
204
	{ if ($2 == name)
205
	  { \
205
	  {
206
	      if (!done) { print $1 }; \
206
	      if (!done) { print $1 };
207
	      done = 1; \
207
	      done = 1;
208
	  } \
208
	  }
209
	} \
209
	}
210
	END { if (!done) print name }' ${PATCHMAP}
210
	END { if (!done) print name }' "${PATCHMAP}"
211
}
211
}
212
212
213
stage_patches() {
213
stage_patches() {
214
	mkdir -p ${DESTDIR}
214
	mkdir -p "${DESTDIR}"
215
	rm -f ${DESTDIR}/*
215
	rm -f "${DESTDIR}"/*
216
	local P
216
	local P
217
	local name
217
	local name
218
	local patch_list
218
	local patch_list
219
	patch_list=$(cd ${REGENNED} && find * -name "patch-*" 2>/dev/null)
219
	patch_list=$(cd "${REGENNED}" && find ./* -name "patch-*" 2>/dev/null)
220
	for P in ${patch_list}; do
220
	for P in ${patch_list}; do
221
		name=$(get_patch_name ${P})
221
		P=${P#./}
222
		[ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \
222
		name=$(get_patch_name "${P}")
223
			>> ${DESTDIR}/${name}
223
		[ -e "${COMMENTS}/${P}" ] && cat "${COMMENTS}/${P}" \
224
			>> "${DESTDIR}/${name}"
224
		if [ "${P}" = "${name}" ]; then
225
		if [ "${P}" = "${name}" ]; then
225
			echo "Generated ${P}"
226
			echo "Generated ${P}"
226
		else
227
		else
227
			echo "Generated ${P} >> ${name} (legacy)"
228
			echo "Generated ${P} >> ${name} (legacy)"
228
		fi
229
		fi
229
		cat ${REGENNED}/${P} >> ${DESTDIR}/${name}
230
		cat "${REGENNED}/${P}" >> "${DESTDIR}/${name}"
230
	done
231
	done
231
}
232
}
232
233
Lines 239-285 compare_common_patches() { Link Here
239
	local cpatch
240
	local cpatch
240
	local cpatch_stripped
241
	local cpatch_stripped
241
	for P in ${old_patch_list}; do
242
	for P in ${old_patch_list}; do
242
		if [ -e ${DESTDIR}/${P} ]; then
243
		if [ -e "${DESTDIR}/${P}" ]; then
243
			ppatch=${PATCHDIR}/${P}
244
			ppatch=${PATCHDIR}/${P}
244
			cpatch=${DESTDIR}/${P}
245
			cpatch=${DESTDIR}/${P}
245
			ppatch_stripped=$(mktemp -t portpatch)
246
			ppatch_stripped=$(mktemp -t portpatch)
246
			cpatch_stripped=$(mktemp -t portpatch)
247
			cpatch_stripped=$(mktemp -t portpatch)
247
			egrep -v -- '--- .+ UTC$' ${ppatch} \
248
			grep -E -v -- '--- .+ UTC$' "${ppatch}" \
248
				> ${ppatch_stripped}
249
				> "${ppatch_stripped}"
249
			egrep -v -- '--- .+ UTC$' ${cpatch} \
250
			grep -E -v -- '--- .+ UTC$' "${cpatch}" \
250
				> ${cpatch_stripped}
251
				> "${cpatch_stripped}"
251
			# Don't replace patches with only metadata changes
252
			# Don't replace patches with only metadata changes
252
			if ! cmp -s ${ppatch_stripped} ${cpatch_stripped}; then
253
			if ! cmp -s "${ppatch_stripped}" "${cpatch_stripped}"; then
253
				archive_patch_list="${archive_patch_list} ${P}"
254
				archive_patch_list="${archive_patch_list} ${P}"
254
			else
255
			else
255
				echo "${P} only contains metadata changes; not replacing"
256
				echo "${P} only contains metadata changes; not replacing"
256
				rm ${cpatch}
257
				rm "${cpatch}"
257
			fi
258
			fi
258
			rm ${ppatch_stripped}
259
			rm "${ppatch_stripped}"
259
			rm ${cpatch_stripped}
260
			rm "${cpatch_stripped}"
260
		fi
261
		fi
261
	done
262
	done
262
	old_patch_list=${archive_patch_list}
263
	old_patch_list=${archive_patch_list}
263
}
264
}
264
265
265
conserve_old_patches() {
266
conserve_old_patches() {
266
	mkdir -p ${SAVEDIR}
267
	mkdir -p "${SAVEDIR}"
267
	rm -f ${SAVEDIR}/*
268
	rm -f "${SAVEDIR}"/*
268
	[ -z "${old_patch_list}" ] && return
269
	[ -z "${old_patch_list}" ] && return
269
270
270
	local P
271
	local P
271
	for P in ${old_patch_list}; do
272
	for P in ${old_patch_list}; do
272
		mv ${PATCHDIR}/${P} ${SAVEDIR}/${P}
273
		mv "${PATCHDIR}/${P}" "${SAVEDIR}/${P}"
273
	done
274
	done
274
	echo "The previous patches have been placed here:"
275
	echo "The previous patches have been placed here:"
275
	echo ${SAVEDIR}
276
	echo "${SAVEDIR}"
276
}
277
}
277
278
278
install_regenerated_patches() {
279
install_regenerated_patches() {
279
	local testdir=$(find ${DESTDIR} -empty)
280
	local testdir
281
	testdir=$(find "${DESTDIR}" -empty)
280
	if [ -z "${testdir}" ]; then
282
	if [ -z "${testdir}" ]; then
281
		mkdir -p ${PATCHDIR}
283
		mkdir -p "${PATCHDIR}"
282
		find ${DESTDIR} -type f -exec mv {} ${PATCHDIR}/ \;
284
		find "${DESTDIR}" -type f -exec mv {} "${PATCHDIR}"/ \;
283
	fi
285
	fi
284
}
286
}
285
287

Return to bug 227109