FreeBSD Bugzilla – Attachment 194078 Details for
Bug 227109
Mk/Scripts, cleanup using devel/hs-ShellCheck
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
base commit: r471994
0001-SC2086-Double-quote-to-prevent-globbing-and-word-spl.patch (text/plain), 80.03 KB, created by
Mathieu Arnold
on 2018-06-08 09:31:10 UTC
(
hide
)
Description:
base commit: r471994
Filename:
MIME Type:
Creator:
Mathieu Arnold
Created:
2018-06-08 09:31:10 UTC
Size:
80.03 KB
patch
obsolete
>From eac95bcb8f31b6e61c404d93cc1478e515253419 Mon Sep 17 00:00:00 2001 >From: Mathieu Arnold <mat@mat.cc> >Date: Thu, 18 Jan 2018 18:10:00 +0100 >Subject: SC2086: Double quote to prevent globbing and word splitting. > >Quoting variables prevents word splitting and glob expansion, and >prevents the script from breaking when input contains spaces, line >feeds, glob characters and such. > >Disable the check when using set -- where we want splitting. >--- > Mk/Scripts/actual-package-depends.sh | 20 ++-- > Mk/Scripts/check-stagedir.sh | 112 ++++++++++----------- > Mk/Scripts/check_leftovers.sh | 14 +-- > Mk/Scripts/checksum.sh | 2 + > Mk/Scripts/create-manifest.sh | 24 ++--- > Mk/Scripts/depends-list.sh | 8 +- > Mk/Scripts/dialog4ports.sh | 20 ++-- > Mk/Scripts/do-depends.sh | 28 +++--- > Mk/Scripts/do-fetch.sh | 4 +- > Mk/Scripts/do-patch.sh | 10 +- > Mk/Scripts/do-users-groups.sh | 18 ++++ > Mk/Scripts/find-lib.sh | 8 +- > Mk/Scripts/functions.sh | 24 ++++- > Mk/Scripts/generate-symbols.sh | 10 +- > Mk/Scripts/makesum.sh | 10 +- > Mk/Scripts/ports_env.sh | 2 +- > Mk/Scripts/qa.sh | 460 +++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- > Mk/Scripts/smart_makepatch.sh | 114 +++++++++++----------- > 18 files changed, 471 insertions(+), 417 deletions(-) > >diff --git Mk/Scripts/actual-package-depends.sh Mk/Scripts/actual-package-depends.sh >index d773efa96a84..ac3683577121 100644 >--- Mk/Scripts/actual-package-depends.sh >+++ Mk/Scripts/actual-package-depends.sh >@@ -12,21 +12,21 @@ fi > resolv_symlink() { > local file tgt > file=${1} >- if [ ! -L ${file} ] ; then >- echo ${file} >+ if [ ! -L "${file}" ] ; then >+ echo "${file}" > return > fi > >- tgt=$(readlink ${file}) >+ tgt=$(readlink "${file}") > case $tgt in > /*) >- echo $tgt >+ echo "$tgt" > return > ;; > esac > > file=${file%/*}/${tgt} >- absolute_path ${file} >+ absolute_path "${file}" > } > > absolute_path() { >@@ -35,6 +35,8 @@ absolute_path() { > > myifs=${IFS} > IFS='/' >+ # shellcheck disable=SC2086 >+ # we want splitting here. > set -- ${file} > IFS=${myifs} > for el; do >@@ -45,7 +47,7 @@ absolute_path() { > *) target="${target}/${el}" ;; > esac > done >- echo ${target} >+ echo "${target}" > } > > find_dep() { >@@ -60,15 +62,15 @@ find_dep() { > searchfile=$pattern > ;; > *) >- searchfile=$(/usr/bin/which ${pattern} 2>/dev/null) >+ searchfile=$(/usr/bin/which "${pattern}" 2>/dev/null) > ;; > esac > if [ -n "${searchfile}" ]; then >- ${PKG_BIN} which -q ${searchfile} || ${PKG_BIN} which -q "$(resolv_symlink ${searchfile} 2>/dev/null)" || >+ ${PKG_BIN} which -q "${searchfile}" || ${PKG_BIN} which -q "$(resolv_symlink "${searchfile}" 2>/dev/null)" || > echo "actual-package-depends: dependency on ${searchfile} not registered (normal if it belongs to base)" >&2 > fi > } > > for lookup; do >- ${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep ${lookup})" || : >+ ${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep "${lookup}")" || : > done >diff --git Mk/Scripts/check-stagedir.sh Mk/Scripts/check-stagedir.sh >index 5c85f2c1cbf2..5136b0475d4f 100644 >--- Mk/Scripts/check-stagedir.sh >+++ Mk/Scripts/check-stagedir.sh >@@ -13,13 +13,13 @@ > > set -e > >-. ${SCRIPTSDIR}/functions.sh >+. "${SCRIPTSDIR}"/functions.sh > > # lists an mtree file's contents, prefixed to dir. > listmtree() { # mtreefile prefix > { > echo '#mtree' >- sed 's/nochange$//;' $1 >+ sed 's/nochange$//;' "$1" > } | tar -tf- | sed "s,^,$2/,;s,^$2/\.$,$2,;s,^$,/," > } > >@@ -45,27 +45,27 @@ parse_mtree() { > # Add LOCALBASE > a=${LOCALBASE} > while :; do >- echo ${a} >+ echo "${a}" > a=${a%/*} > [ -z "${a}" ] && break > done > > # Add in PREFIX if this port wants it >- if [ ${NO_PREFIX_RMDIR} -eq 0 ]; then >+ if [ "${NO_PREFIX_RMDIR}" -eq 0 ]; then > a=${PREFIX} > while :; do >- echo ${a} >+ echo "${a}" > a=${a%/*} > [ -z "${a}" ] && break > done > fi >- } >${WRKDIR}/.mtree >+ } >"${WRKDIR}"/.mtree > } > > # Sort a directory list by the order of the dfs-sorted file (from find -d -s) > sort_dfs() { > while read -r dir; do >- grep "^[0-9]* ${dir}$" ${WRKDIR}/.staged-dirs-dfs-sorted >+ grep "^[0-9]* ${dir}$" "${WRKDIR}"/.staged-dirs-dfs-sorted > done | sort -n | cut -d ' ' -f2- > } > >@@ -73,7 +73,7 @@ sort_dfs() { > setup_plist_seds() { > ### HANDLE PORTDOCS/PORTEXAMPLES > sed_portdocsexamples="/%%DOCSDIR%%/s!^!%%PORTDOCS%%!g; /%%EXAMPLESDIR%%/s!^!%%PORTEXAMPLES%%!g;" >- if [ ${makeplist} -eq 0 ]; then >+ if [ "${makeplist}" -eq 0 ]; then > # echo "=====> Using OPTIONS: ${PORT_OPTIONS}" | /usr/bin/fmt -w 79 | \ > # sed -e '2,$s/^/ /' > # Handle magical PORT* features >@@ -88,7 +88,7 @@ setup_plist_seds() { > unset PORT_OPTIONS > fi > >- sed_plist_sub=$(echo "${PLIST_SUB_SED}" | /bin/sh ${SCRIPTSDIR}/plist_sub_sed_sort.sh) >+ sed_plist_sub=$(echo "${PLIST_SUB_SED}" | /bin/sh "${SCRIPTSDIR}"/plist_sub_sed_sort.sh) > unset PLIST_SUB_SED > # Used for generate_plist > sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \ >@@ -108,31 +108,31 @@ setup_plist_seds() { > > # Generate plist from staged files > generate_plist() { >- : >${WRKDIR}/.staged-plist >+ : >"${WRKDIR}"/.staged-plist > > ### HANDLE FILES >- find ${STAGEDIR} -type f -o -type l | sort | \ >- sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files >- comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files | \ >+ find "${STAGEDIR}" -type f -o -type l | sort | \ >+ sed -e "s,${STAGEDIR},," >"${WRKDIR}"/.staged-files >+ comm -13 "${WRKDIR}"/.plist-files "${WRKDIR}"/.staged-files | \ > sed -e "${sed_files_gen}" \ >- >>${WRKDIR}/.staged-plist || : >+ >>"${WRKDIR}"/.staged-plist || : > > ### HANDLE DIRS >- cat ${WRKDIR}/.plist-dirs-unsorted ${WRKDIR}/.mtree \ >- | sort -u >${WRKDIR}/.traced-dirs >- find ${STAGEDIR} -type d | sed -e "s,^${STAGEDIR},,;/^$/d" | sort \ >- >${WRKDIR}/.staged-dirrms-sorted >- find -s -d ${STAGEDIR}${PREFIX} -type d -empty | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \ >- >${WRKDIR}/.staged-dirs-dfs >- find -s -d ${STAGEDIR} -type d ! -path "${STAGEDIR}${PREFIX}/*" | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \ >- >>${WRKDIR}/.staged-dirs-dfs >- sort ${WRKDIR}/.staged-dirs-dfs >${WRKDIR}/.staged-dirs-sorted >- awk '{print FNR, $0}' ${WRKDIR}/.staged-dirs-dfs \ >- >${WRKDIR}/.staged-dirs-dfs-sorted >+ cat "${WRKDIR}"/.plist-dirs-unsorted "${WRKDIR}"/.mtree \ >+ | sort -u >"${WRKDIR}"/.traced-dirs >+ find "${STAGEDIR}" -type d | sed -e "s,^${STAGEDIR},,;/^$/d" | sort \ >+ >"${WRKDIR}"/.staged-dirrms-sorted >+ find -s -d "${STAGEDIR}${PREFIX}" -type d -empty | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \ >+ >"${WRKDIR}"/.staged-dirs-dfs >+ find -s -d "${STAGEDIR}" -type d ! -path "${STAGEDIR}${PREFIX}/*" | sed -e "s,^${STAGEDIR},,;\,^${PREFIX}$,d;/^$/d" \ >+ >>"${WRKDIR}"/.staged-dirs-dfs >+ sort "${WRKDIR}"/.staged-dirs-dfs >"${WRKDIR}"/.staged-dirs-sorted >+ awk '{print FNR, $0}' "${WRKDIR}"/.staged-dirs-dfs \ >+ >"${WRKDIR}"/.staged-dirs-dfs-sorted > # Find all staged dirs and then sort them by depth-first (find -d -s) >- comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs-sorted \ >+ comm -13 "${WRKDIR}"/.traced-dirs "${WRKDIR}"/.staged-dirs-sorted \ > | sort_dfs | sed "${sed_dirs_gen}" \ >- >>${WRKDIR}/.staged-plist || : >+ >>"${WRKDIR}"/.staged-plist || : > } > > # Check for files in STAGEDIR missing from plist >@@ -175,7 +175,7 @@ check_orphans_from_plist() { > echo "Error: Orphaned: ${path}" >&2 > ;; > esac >- done < ${WRKDIR}/.staged-plist >+ done < "${WRKDIR}"/.staged-plist > return ${ret} > } > >@@ -183,34 +183,34 @@ check_orphans_from_plist() { > check_missing_plist_items() { > local ret=0 > echo "===> Checking for items in pkg-plist which are not in STAGEDIR" >- : >${WRKDIR}/.invalid-plist-missing >- comm -23 ${WRKDIR}/.plist-files-no-comments ${WRKDIR}/.staged-files | \ >+ : >"${WRKDIR}"/.invalid-plist-missing >+ comm -23 "${WRKDIR}"/.plist-files-no-comments "${WRKDIR}"/.staged-files | \ > sed -e "${sed_files}" \ >- >>${WRKDIR}/.invalid-plist-missing || : >+ >>"${WRKDIR}"/.invalid-plist-missing || : > > # Look for directories, then sort them by DFS. Must create the dirs > # so find -ds can be used to sort them. >- rm -rf ${WRKDIR}/.missing-dirs > /dev/null 2>&1 || : >- mkdir ${WRKDIR}/.missing-dirs >- comm -23 ${WRKDIR}/.plist-dirs-sorted-no-comments \ >- ${WRKDIR}/.staged-dirrms-sorted > ${WRKDIR}/.missing-plist-dirs >+ rm -rf "${WRKDIR}"/.missing-dirs > /dev/null 2>&1 || : >+ mkdir "${WRKDIR}"/.missing-dirs >+ comm -23 "${WRKDIR}"/.plist-dirs-sorted-no-comments \ >+ "${WRKDIR}"/.staged-dirrms-sorted > "${WRKDIR}"/.missing-plist-dirs > # Creates the dirs in WRKDIR/.missing-dirs and ensure spaces are > # quoted. > sed -e "s,^,${WRKDIR}/.missing-dirs," \ > -e 's,^\(.*\)$,"\1",' \ >- ${WRKDIR}/.missing-plist-dirs | xargs mkdir -p >- find -d -s ${WRKDIR}/.missing-dirs | \ >+ "${WRKDIR}"/.missing-plist-dirs | xargs mkdir -p >+ find -d -s "${WRKDIR}"/.missing-dirs | \ > sed -e "s,^${WRKDIR}/.missing-dirs,," | \ > while read -r dir; do \ >- grep -x "${dir}" ${WRKDIR}/.missing-plist-dirs || :; done | \ >+ grep -x "${dir}" "${WRKDIR}"/.missing-plist-dirs || :; done | \ > sed "${sed_dirs}" \ >- >>${WRKDIR}/.invalid-plist-missing || : >- rm -rf ${WRKDIR}/.missing-dirs >+ >>"${WRKDIR}"/.invalid-plist-missing || : >+ rm -rf "${WRKDIR}"/.missing-dirs > if [ -s "${WRKDIR}/.invalid-plist-missing" ]; then > ret=1 > while read -r line; do > echo "Error: Missing: ${line}" >&2 >- done < ${WRKDIR}/.invalid-plist-missing >+ done < "${WRKDIR}"/.invalid-plist-missing > fi > return ${ret} > } >@@ -234,23 +234,23 @@ set -u > > if [ $makeplist = 0 ] ; then > echo "===> Parsing plist" >- parse_plist "${PREFIX}" 1 < ${TMPPLIST} \ >- 3>${WRKDIR}/.plist-dirs-unsorted \ >- >${WRKDIR}/.plist-files-unsorted >+ parse_plist "${PREFIX}" 1 < "${TMPPLIST}" \ >+ 3>"${WRKDIR}"/.plist-dirs-unsorted \ >+ >"${WRKDIR}"/.plist-files-unsorted > unset TMPPLIST > # Create the -no-comments files and trim out @comment from the plists. > # This is used for various tests later. >- sed -e '/^@comment/d' ${WRKDIR}/.plist-dirs-unsorted \ >- >${WRKDIR}/.plist-dirs-unsorted-no-comments >- sed -i '' -e 's/^@comment //' ${WRKDIR}/.plist-dirs-unsorted >- sed -e '/^@comment/d' ${WRKDIR}/.plist-files-unsorted | sort \ >- >${WRKDIR}/.plist-files-no-comments >- sed -e 's/^@comment //' ${WRKDIR}/.plist-files-unsorted | sort \ >- >${WRKDIR}/.plist-files >+ sed -e '/^@comment/d' "${WRKDIR}"/.plist-dirs-unsorted \ >+ >"${WRKDIR}"/.plist-dirs-unsorted-no-comments >+ sed -i '' -e 's/^@comment //' "${WRKDIR}"/.plist-dirs-unsorted >+ sed -e '/^@comment/d' "${WRKDIR}"/.plist-files-unsorted | sort \ >+ >"${WRKDIR}"/.plist-files-no-comments >+ sed -e 's/^@comment //' "${WRKDIR}"/.plist-files-unsorted | sort \ >+ >"${WRKDIR}"/.plist-files > else > # generate plist - pretend the plist had been empty >- : >${WRKDIR}/.plist-dirs-unsorted >- : >${WRKDIR}/.plist-files >+ : >"${WRKDIR}"/.plist-dirs-unsorted >+ : >"${WRKDIR}"/.plist-files > echo '/you/have/to/check/what/makeplist/gives/you' > fi > >@@ -261,15 +261,15 @@ generate_plist > > # If just making plist, show results and exit successfully. > if [ ${makeplist} -eq 1 ]; then >- cat ${WRKDIR}/.staged-plist >+ cat "${WRKDIR}"/.staged-plist > exit 0 > fi > > check_orphans_from_plist || ret=1 > > # Prepare plist-dirs for directory checks >-sort -u ${WRKDIR}/.plist-dirs-unsorted-no-comments \ >- >${WRKDIR}/.plist-dirs-sorted-no-comments >+sort -u "${WRKDIR}"/.plist-dirs-unsorted-no-comments \ >+ >"${WRKDIR}"/.plist-dirs-sorted-no-comments > > check_missing_plist_items || ret=1 > >diff --git Mk/Scripts/check_leftovers.sh Mk/Scripts/check_leftovers.sh >index 3db2290403a5..5ed8a1b10dea 100644 >--- Mk/Scripts/check_leftovers.sh >+++ Mk/Scripts/check_leftovers.sh >@@ -35,19 +35,19 @@ portdir="${PORTSDIR}/${origin}" > if [ -n "${PREFIX}" ]; then > PORT_FLAGS="${PORT_FLAGS} PREFIX=${PREFIX}" > else >- PREFIX=$(make -C ${portdir} -VPREFIX) >+ PREFIX=$(make -C "${portdir}" -VPREFIX) > fi > if [ -n "${LOCALBASE}" ]; then > PORT_FLAGS="${PORT_FLAGS} LOCALBASE=${LOCALBASE}" > else >- LOCALBASE=$(make -C ${portdir} -VLOCALBASE) >+ LOCALBASE=$(make -C "${portdir}" -VLOCALBASE) > fi > if [ -z "${CCACHE_DIR}" ]; then >- CCACHE_DIR=$(make -C ${portdir} -VCCACHE_DIR) >+ CCACHE_DIR=$(make -C "${portdir}" -VCCACHE_DIR) > fi >-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" " ") >-plistsub_sed=$(make -C ${portdir} -VPLIST_SUB_SED | /bin/sh ${PORTSDIR}/Mk/Scripts/plist_sub_sed_sort.sh) >-tmpplist=$(make -C ${portdir} -VTMPPLIST) >+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" " ") >+plistsub_sed=$(make -C "${portdir}" -VPLIST_SUB_SED | /bin/sh "${PORTSDIR}"/Mk/Scripts/plist_sub_sed_sort.sh) >+tmpplist=$(make -C "${portdir}" -VTMPPLIST) > > while read -r modtype path extra; do > # Ignore everything from these files/directories >@@ -95,7 +95,7 @@ while read -r modtype path extra; do > # Don't show dirs already in plist (due to parents) > grep -qE \ > "^@(unexec rmdir \"?(%D/|${PREFIX})?${path#${PREFIX}/}[ \"]|dir(rm|rmtry)? ${path#${PREFIX}/}\$)" \ >- ${tmpplist} && continue >+ "${tmpplist}" && continue > fi > > # Check absolute paths >diff --git Mk/Scripts/checksum.sh Mk/Scripts/checksum.sh >index cde14a831999..c3d0a633d522 100644 >--- Mk/Scripts/checksum.sh >+++ Mk/Scripts/checksum.sh >@@ -70,6 +70,8 @@ if [ -f "${dp_DISTINFO_FILE}" ]; then > > if [ "${OK:=true}" = "retry" ] && [ "${dp_FETCH_REGET}" -gt 0 ]; then > ${dp_ECHO_MSG} "===> Refetch for ${dp_FETCH_REGET} more times files: $refetchlist" >+ # shellcheck disable=SC2086 >+ # dp_MAKEFLAGS contains arguments, needs splitting. > if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FORCE_FETCH_LIST="$refetchlist" FETCH_REGET="$((dp_FETCH_REGET - 1))" fetch; then > if ${dp_MAKE} -C "${dp_CURDIR}" ${dp_MAKEFLAGS} FETCH_REGET="$((dp_FETCH_REGET - 1))" checksum ; then > OK="true" >diff --git Mk/Scripts/create-manifest.sh Mk/Scripts/create-manifest.sh >index 974198cf7928..df2880323c4b 100644 >--- Mk/Scripts/create-manifest.sh >+++ Mk/Scripts/create-manifest.sh >@@ -26,17 +26,17 @@ listcontains() { > lst=$2 > > for elt in ${lst} ; do >- if [ ${elt} = ${str} ]; then >+ if [ "${elt}" = "${str}" ]; then > return 0 > fi > done > return 1 > } > >-mkdir -p ${dp_METADIR} >+mkdir -p "${dp_METADIR}" > > # Save stdout and redirect it to the manifest file. >-exec 3>&1 >${dp_METADIR}/+MANIFEST >+exec 3>&1 >"${dp_METADIR}"/+MANIFEST > > # First, all the required bits > cat <<EOT >@@ -62,12 +62,12 @@ EOT > > # Then the key/values sections > echo "deps: { " >-eval ${dp_ACTUAL_PACKAGE_DEPENDS} | grep -v -E ${dp_PKG_IGNORE_DEPENDS} | sort -u >+eval "${dp_ACTUAL_PACKAGE_DEPENDS}" | grep -v -E "${dp_PKG_IGNORE_DEPENDS}" | sort -u > echo "}" > > echo "options: {" > for opt in ${dp_COMPLETE_OPTIONS_LIST}; do >- if listcontains ${opt} "${dp_PORT_OPTIONS}"; then >+ if listcontains "${opt}" "${dp_PORT_OPTIONS}"; then > echo " ${opt}: on," > else > echo " ${opt}: off," >@@ -86,7 +86,7 @@ if [ -n "${dp_PKG_NOTES}" ]; then > fi > > # Copy the pkg-descr file >-cp ${dp_DESCR} ${dp_METADIR}/+DESC >+cp "${dp_DESCR}" "${dp_METADIR}/+DESC" > > # Concatenate all the scripts > output_files= >@@ -96,28 +96,28 @@ for stage in INSTALL DEINSTALL UPGRADE; do > [ -f "${output}" ] && output_files="${output_files:+${output_files} }${output}" > done > done >-[ -n "${output_files}" ] && rm -f ${output_files} >+[ -n "${output_files}" ] && rm -f "${output_files}" > > for stage in INSTALL DEINSTALL UPGRADE; do > for prepost in '' PRE POST; do > eval files="\${dp_PKG${prepost}${stage}}" > output=${dp_METADIR}/+${prepost:+${prepost}_}${stage} > for input in ${files}; do >- [ -f "${input}" ] && cat ${input} >> ${output} >+ [ -f "${input}" ] && cat "${input}" >> "${output}" > done > done > done > > # *** STARTING NOW, STDOUT is +DISPLAY *** > >-exec >${dp_METADIR}/+DISPLAY >+exec >"${dp_METADIR}/+DISPLAY" > > for message in ${dp_PKGMESSAGES}; do > [ -f "${message}" ] && cat "${message}" > done > > # Try and keep these messages in sync with check-deprecated >-if [ ${dp_MAINTAINER} = "ports@FreeBSD.org" ]; then >+if [ "${dp_MAINTAINER}" = "ports@FreeBSD.org" ]; then > if [ -f "${dp_METADIR}/+DISPLAY" ]; then echo; fi > cat <<-EOT > ===> NOTICE: >@@ -153,6 +153,6 @@ if [ -n "${dp_DEPRECATED}" ]; then > fi > fi > >-if [ ! -s ${dp_METADIR}/+DISPLAY ]; then >- rm -f ${dp_METADIR}/+DISPLAY >+if [ ! -s "${dp_METADIR}/+DISPLAY" ]; then >+ rm -f "${dp_METADIR}/+DISPLAY" > fi >diff --git Mk/Scripts/depends-list.sh Mk/Scripts/depends-list.sh >index ce4f4b75a094..de84d55a84ab 100644 >--- Mk/Scripts/depends-list.sh >+++ Mk/Scripts/depends-list.sh >@@ -4,7 +4,7 @@ > > set -e > >-. ${dp_SCRIPTSDIR}/functions.sh >+. "${dp_SCRIPTSDIR}"/functions.sh > > flavors=0 > recursive=0 >@@ -60,6 +60,8 @@ check_dep() { > unset FLAVOR > myifs=${IFS} > IFS=: >+ # shellcheck disable=SC2086 >+ # we need splitting here. > set -- ${_dep} > IFS=${myifs} > >@@ -103,13 +105,13 @@ check_dep() { > if [ ${requires_wrkdir} -eq 1 ]; then > # shellcheck disable=SC2046 > # We want word splitting here. >- set -- $(${dp_MAKE} -C ${d} -VWRKDIR -V_UNIFIED_DEPENDS) >+ set -- $(${dp_MAKE} -C "${d}" -VWRKDIR -V_UNIFIED_DEPENDS) > wrkdir="$1" > shift > elif [ ${recursive} -eq 1 ]; then > # shellcheck disable=SC2046 > # We want word splitting here. >- set -- $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS) >+ set -- $(${dp_MAKE} -C "${d}" -V_UNIFIED_DEPENDS) > fi > > # If a WRKDIR is required to show the dependency, check for it. >diff --git Mk/Scripts/dialog4ports.sh Mk/Scripts/dialog4ports.sh >index 61b855ee44b8..cf01e27efa27 100644 >--- Mk/Scripts/dialog4ports.sh >+++ Mk/Scripts/dialog4ports.sh >@@ -10,12 +10,12 @@ if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then > exit 1 > fi > >-: ${DIALOGPORT:=ports-mgmt/dialog4ports} >-: ${DIALOGNAME:=dialog4ports} >+: "${DIALOGPORT:=ports-mgmt/dialog4ports}" >+: "${DIALOGNAME:=dialog4ports}" > > OPTIONSFILE="$1" > >-if ! [ -e $DIALOG4PORTS ]; then >+if ! [ -e "$DIALOG4PORTS" ]; then > # If INSTALL_AS_USER is set then just build and use the WRKDIR version > # Also do this if PREFIX!=LOCALBASE to avoid missing file or double > # installs >@@ -24,27 +24,27 @@ if ! [ -e $DIALOG4PORTS ]; then > echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&2 > exit 1 > fi >- DIALOG4PORTS=$(${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -V DIALOG4PORTS) >+ DIALOG4PORTS=$(${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -V DIALOG4PORTS) > if ! [ -e "${DIALOG4PORTS}" ]; then > echo "===> Building ${DIALOGNAME} as it is required for the config dialog" >- ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean build >+ ${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean build > fi > else > # Build+install through su-install as normal > echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog" >- ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean install >+ ${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean install > # Need to clean again as it can't run twice in 1 call above >- ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean >+ ${MAKE} -C "${PORTSDIR}/${DIALOGPORT}" -D NO_DIALOG clean > fi > fi > > # Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]). > # Clear environment of PKGNAME or the dialog will show on older versions > # that do not understand -v. >-if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then >- exec $DIALOG4PORTS > $OPTIONSFILE 2>&1 >+if ! env -u PKGNAME "${DIALOG4PORTS}" -v > /dev/null 2>&1; then >+ exec "$DIALOG4PORTS" > "$OPTIONSFILE" 2>&1 > fi > > # Newer versions use stderr to work around a jail issue > # http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html >-exec $DIALOG4PORTS 2> $OPTIONSFILE >+exec "$DIALOG4PORTS" 2> "$OPTIONSFILE" >diff --git Mk/Scripts/do-depends.sh Mk/Scripts/do-depends.sh >index 5469bff33337..8581db2ac41e 100644 >--- Mk/Scripts/do-depends.sh >+++ Mk/Scripts/do-depends.sh >@@ -5,7 +5,7 @@ > > set -e > >-. ${dp_SCRIPTSDIR}/functions.sh >+. "${dp_SCRIPTSDIR}"/functions.sh > > validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \ > dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \ >@@ -23,7 +23,9 @@ install_depends() > target=$2 > depends_args=$3 > if [ -z "${dp_USE_PACKAGE_DEPENDS}" -a -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then >- MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} >+ # shellcheck disable=SC2086 >+ # depends_args contains arguments, needs splitting. >+ MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C "${origin}" -DINSTALLS_DEPENDS "${target}" ${depends_args} > return 0 > fi > >@@ -34,19 +36,21 @@ install_depends() > if [ -r "${pkgfile}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then > echo "===> Installing existing package ${pkgfile}" > if [ "${pkgbase}" = "pkg" ]; then >- [ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR} >- tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static" >- ${dp_WRKDIR}/pkg-static add ${pkgfile} >- rm -f ${dp_WRKDIR}/pkg-static >+ [ -d "${dp_WRKDIR}" ] || mkdir -p "${dp_WRKDIR}" >+ tar xf "${pkgfile}" -C "${dp_WRKDIR}" -s ",/.*/,,g" "*/pkg-static" >+ "${dp_WRKDIR}"/pkg-static add "${pkgfile}" >+ rm -f "${dp_WRKDIR}"/pkg-static > else >- ${dp_PKG_ADD} -A ${pkgfile} >+ ${dp_PKG_ADD} -A "${pkgfile}" > fi > elif [ -n "${dp_USE_PACKAGE_DEPENDS_ONLY}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then > echo "===> ${dp_PKGNAME} depends on package: ${pkgfile} - not found" >&2 > echo "===> USE_PACKAGE_DEPENDS_ONLY set - not building missing dependency from source" >&2 > exit 1 > else >- MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} >+ # shellcheck disable=SC2086 >+ # depends_args contains arguments, needs splitting. >+ MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C "${origin}" -DINSTALLS_DEPENDS "${target}" ${depends_args} > fi > } > >@@ -72,7 +76,7 @@ find_file() > > find_file_path() > { >- if which -s $1 ; then >+ if which -s "$1" ; then > echo "===> ${dp_PKGNAME} depends on executable: $1 - found" > return 0 > fi >@@ -83,7 +87,7 @@ find_file_path() > find_lib() > { > echo -n "===> ${dp_PKGNAME} depends on shared library: $1" >- libfile=$(env -i PATH="${PATH}" LIB_DIRS="${dp_LIB_DIRS}" LOCALBASE="${dp_LOCALBASE}" ${dp_SH} ${dp_SCRIPTSDIR}/find-lib.sh $1) >+ libfile=$(env -i PATH="${PATH}" LIB_DIRS="${dp_LIB_DIRS}" LOCALBASE="${dp_LOCALBASE}" "${dp_SH}" "${dp_SCRIPTSDIR}"/find-lib.sh "$1") > if [ -z "${libfile}" ]; then > echo " - not found" > return 1 >@@ -98,6 +102,8 @@ for _line in ${dp_RAWDEPENDS} ; do > unset FLAVOR > myifs=${IFS} > IFS=: >+ # shellcheck disable=SC2086 >+ # we want splitting here. > set -- ${_line} > IFS=${myifs} > if [ $# -lt 2 -o $# -gt 3 ]; then >@@ -170,7 +176,7 @@ for _line in ${dp_RAWDEPENDS} ; do > if ${fct} "${pattern}" ; then > continue > fi >- [ ${pattern} = "/nonexistent" ] || anynotfound=1 >+ [ "${pattern}" = "/nonexistent" ] || anynotfound=1 > > if [ ! -f "${origin}/Makefile" ]; then > echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2 >diff --git Mk/Scripts/do-fetch.sh Mk/Scripts/do-fetch.sh >index bfeac4e69065..9927e6db8786 100644 >--- Mk/Scripts/do-fetch.sh >+++ Mk/Scripts/do-fetch.sh >@@ -141,6 +141,8 @@ for _file in "${@}"; do > case ${dp_TARGET} in > do-fetch|makesum) > ${dp_ECHO_MSG} "=> Attempting to fetch ${site}${file}" >+ # shellcheck disable=SC2086 >+ # _fetch_cmd contains arguments, with spaces, needs to be split. > if env -S "${dp_FETCH_ENV}" ${_fetch_cmd}; then > actual_size=$(stat -f %z "${file}") > if [ -n "${dp_DISABLE_SIZE}" ] || [ -z "${CKSIZE}" ] || [ "${actual_size}" -eq "${CKSIZE}" ]; then >@@ -158,7 +160,7 @@ for _file in "${@}"; do > echo -n "env $(escape "${_fetch_cmd}") || " > ;; > fetch-url-list-int) >- echo ${args} >+ echo "${args}" > ;; > esac > done >diff --git Mk/Scripts/do-patch.sh Mk/Scripts/do-patch.sh >index 10095f56847d..42d3467f7ad2 100644 >--- Mk/Scripts/do-patch.sh >+++ Mk/Scripts/do-patch.sh >@@ -51,6 +51,8 @@ apply_one_patch() { > ${dp_CAT} "${file}" > ;; > esac | do_patch "$@" ${patch_strip} >+ # Do not quote patch_strip, otherwise, it may generate an empty >+ # argument, which breaks patch. > } > > do_patch() { >@@ -79,7 +81,9 @@ patch_from_directory() { > if [ -n "${dp_PATCH_DEBUG_TMP}" ]; then > ${dp_ECHO_MSG} "===> Applying ${msg} patch ${i}" > fi >- if do_patch ${dp_PATCH_ARGS} < ${i}; then >+ # shellcheck disable=SC2086 >+ # dp_PATCH_ARGS contains arguments, with spaces, needs to be split. >+ if do_patch ${dp_PATCH_ARGS} < "${i}"; then > PATCHES_APPLIED="${PATCHES_APPLIED} ${i}" > else > ${dp_ECHO_MSG} "=> ${msg} patch ${i} failed to apply cleanly." >@@ -99,6 +103,8 @@ if [ -n "${dp_PATCHFILES}" ]; then > ${dp_ECHO_MSG} "===> Applying distribution patches for ${dp_PKGNAME}" > cd "${dp_DISTDIR}" > for i in ${dp_PATCHFILES}; do >+ # shellcheck disable=SC2086 >+ # dp_PATCH_DIST_ARGS contains arguments, with spaces, needs to be split. > apply_one_patch "${i}" \ > "${dp_PATCH_DEBUG_TMP:+ Applying distribution patch}" \ > ${dp_PATCH_DIST_ARGS} >@@ -111,6 +117,8 @@ if [ -n "${dp_EXTRA_PATCHES}" ]; then > patch_from_directory "${i}" \ > "extra patch" > else >+ # shellcheck disable=SC2086 >+ # dp_PATCH_ARGS contains arguments, with spaces, needs to be split. > apply_one_patch "${i}" \ > "Applying extra patch" \ > ${dp_PATCH_ARGS} >diff --git Mk/Scripts/do-users-groups.sh Mk/Scripts/do-users-groups.sh >index 45bf0e081f72..0f08e3727ea8 100644 >--- Mk/Scripts/do-users-groups.sh >+++ Mk/Scripts/do-users-groups.sh >@@ -56,15 +56,21 @@ if [ -n "${GROUPS}" ]; then > echo "echo \"===> Creating groups.\"" >> "${dp_UG_INSTALL}" > for group in ${GROUPS}; do > # _bgpd:*:130: >+ # shellcheck disable=SC2086 >+ # We need splitting. > if ! grep -q "^${group}:" ${dp_GID_FILES}; then \ > error "** Cannot find any information about group \`${group}' in ${dp_GID_FILES}." > fi >+ # shellcheck disable=SC2086 >+ # We need splitting in the heredoc. > while read -r line; do > # Do not change IFS for more than one command, if we > # changed IFS around the while read, it would mess up > # the string splitting in the heredoc command. > o_IFS=${IFS} > IFS=":" >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- ${line} > IFS=${o_IFS} > group=$1 >@@ -99,15 +105,21 @@ if [ -n "${USERS}" ]; then > > for user in ${USERS}; do > # _bgpd:*:130:130:BGP Daemon:/var/empty:/sbin/nologin >+ # shellcheck disable=SC2086 >+ # We need splitting. > if ! grep -q "^${user}:" ${dp_UID_FILES} ; then > error "** Cannot find any information about user \`${user}' in ${dp_UID_FILES}." > fi >+ # shellcheck disable=SC2086 >+ # We need splitting in the heredoc. > while read -r line; do > # Do not change IFS for more than one command, if we > # changed IFS around the while read, it would mess up > # the string splitting in the heredoc command. > o_IFS=${IFS} > IFS=":" >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- ${line} > IFS=${o_IFS} > login=$1 >@@ -151,6 +163,8 @@ fi > if [ -n "${GROUPS}" ]; then > for group in ${GROUPS}; do > # mail:*:6:postfix,clamav >+ # shellcheck disable=SC2086 >+ # We need splitting in the heredoc. > while read -r line; do > # Do not change IFS for more than one command, if we > # changed IFS around the while read, it would mess up >@@ -159,6 +173,8 @@ if [ -n "${GROUPS}" ]; then > IFS=":" > # As some lines do not have a fourth argument, provide > # one so $4 always exists. >+ # shellcheck disable=SC2086 >+ # We need splitting. > set -- ${line} "" > IFS=${o_IFS} > group=$1 >@@ -167,6 +183,8 @@ if [ -n "${GROUPS}" ]; then > gid=$((gid+dp_GID_OFFSET)) > o_IFS=${IFS} > IFS="," >+ # shellcheck disable=SC2086 >+ # We need splitting. > set -- ${members} > IFS=${o_IFS} > for login in "$@"; do >diff --git Mk/Scripts/find-lib.sh Mk/Scripts/find-lib.sh >index 6f96005a3a88..70eaeed31bde 100644 >--- Mk/Scripts/find-lib.sh >+++ Mk/Scripts/find-lib.sh >@@ -22,12 +22,12 @@ if [ $# -ne 1 ]; then > fi > > lib=$1 >-dirs="${LIB_DIRS} $(cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :)" >+dirs="${LIB_DIRS} $(cat "${LOCALBASE}"/libdata/ldconfig/* 2>/dev/null || :)" > > for libdir in ${dirs} ; do >- test -f ${libdir}/${lib} || continue >+ test -f "${libdir}/${lib}" || continue > libfile=${libdir}/${lib} >- [ "$(file -b -L --mime-type ${libfile})" = "application/x-sharedlib" ] || continue >- echo $libfile >+ [ "$(file -b -L --mime-type "${libfile}")" = "application/x-sharedlib" ] || continue >+ echo "$libfile" > break > done >diff --git Mk/Scripts/functions.sh Mk/Scripts/functions.sh >index 20affc692b03..47af7f6c2b65 100644 >--- Mk/Scripts/functions.sh >+++ Mk/Scripts/functions.sh >@@ -30,7 +30,7 @@ parse_plist() { > # the plist so it does not show up as an orphan. PLIST_SUB uses > # a @comment to deactive files. XXX: It would be better to > # make all ports use @ignore instead of @comment. >- if [ ${parse_comments} -eq 1 -a -z "${line%%@comment *}" ]; then >+ if [ "${parse_comments}" -eq 1 -a -z "${line%%@comment *}" ]; then > line="${line##*@comment }" > # Remove @comment so it can be parsed as a file, > # but later prepend it again to create a list of >@@ -72,6 +72,8 @@ parse_plist() { > ;; > # Handle [file] Keywords > @info\ *|@shell\ *|@xmlcatmgr\ *) >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- $line > shift > case "$*" in >@@ -80,6 +82,8 @@ parse_plist() { > esac > ;; > @sample\ *) >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- $line > shift > sample_file=$1 >@@ -101,6 +105,8 @@ parse_plist() { > ;; > # Handle [dir] Keywords > @fc\ *|@fcfontsdir\ *|@fontsdir\ *) >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- $line > shift > case "$*" in >@@ -125,6 +131,8 @@ parse_plist() { > fi > ;; > @cwd*|@cd*) >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- $line > newcwd=$2 > # Don't set cwd=/ as it causes // in plist and >@@ -180,7 +188,8 @@ export_ports_env() { > > make_cmd="${make_env}" > >- export_vars="$(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk \ >+ # Don't quote make_env, we want splitting. >+ export_vars="$(${MAKE} -f "${PORTSDIR}/Mk/bsd.port.mk" \ > -V PORTS_ENV_VARS ${make_env} USES="${uses}")" > > for var in ${export_vars}; do >@@ -188,18 +197,19 @@ export_ports_env() { > done > > # Bring in all the vars, but not empty ones. >- eval "$(${MAKE} -f ${PORTSDIR}/Mk/bsd.port.mk ${make_cmd} \ >+ # Don't quote make_cmd, we want splitting. >+ eval "$(${MAKE} -f "${PORTSDIR}/Mk/bsd.port.mk" ${make_cmd} \ > USES="${uses}" | grep -v '=$' | sed -e 's,\\ $,,')" > for var in ${export_vars}; do > # Export and display non-empty ones. This is not redundant > # with above since we're looping on all vars here; do not > # export a var we didn't eval in. >- value="$(eval echo \$${var})" >+ value="$(eval echo \$"${var}")" > > if [ -n "${value}" ]; then > # shellcheck disable=SC2163 > # We want to export the variable which name is in var. >- export ${var} >+ export "${var}" > echo "export ${var}=\"${value}\"" > fi > done >@@ -261,7 +271,11 @@ port_var_fetch() { > _vars="${_vars}${_vars:+ }${_var}" > shift 2 > done >+ # shellcheck disable=SC2086 >+ # We want splitting. > set -- ${_vars} >+ # shellcheck disable=SC2086 >+ # We want splitting in the heredoc. > while read -r _line; do > setvar "$1" "${_line}" > shift >diff --git Mk/Scripts/generate-symbols.sh Mk/Scripts/generate-symbols.sh >index c6074d4203ed..c93516b81ad6 100644 >--- Mk/Scripts/generate-symbols.sh >+++ Mk/Scripts/generate-symbols.sh >@@ -12,7 +12,7 @@ msg "Finding symbols" > ELF_FILES=$(mktemp -t elf_files) > LF=$(printf '\nX') > LF=${LF%X} >-find ${STAGEDIR} -type f \ >+find "${STAGEDIR}" -type f \ > -exec /usr/bin/file -nNF "${LF}" {} + | while read -r f; do > read -r output > case "${output}" in >@@ -21,12 +21,12 @@ find ${STAGEDIR} -type f \ > echo "${f}" > ;; > esac >-done > ${ELF_FILES} >+done > "${ELF_FILES}" > > # Create all of the /usr/local/lib/* dirs > lib_dir="${STAGEDIR}.debug${PREFIX}/lib/debug" > sed -e "s,^${STAGEDIR}${PREFIX}/,${lib_dir}/," -e 's,/[^/]*$,,' \ >- ${ELF_FILES} | sort -u | xargs mkdir -p >+ "${ELF_FILES}" | sort -u | xargs mkdir -p > > while read -r staged_elf_file; do > elf_file_name="${staged_elf_file##*/}" >@@ -41,6 +41,6 @@ while read -r staged_elf_file; do > --add-gnu-debuglink="${lib_dir_dest}/${elf_file_name}.debug" \ > "${staged_elf_file}" > msg "Saved symbols for ${staged_elf_file}" >-done < ${ELF_FILES} >+done < "${ELF_FILES}" > >-rm -f ${ELF_FILES} >+rm -f "${ELF_FILES}" >diff --git Mk/Scripts/makesum.sh Mk/Scripts/makesum.sh >index a4230905c647..c87bbdd0c6b8 100644 >--- Mk/Scripts/makesum.sh >+++ Mk/Scripts/makesum.sh >@@ -27,8 +27,8 @@ cd "${dp_DISTDIR}" > # the first run. > # So, we extract the content of the distinfo file minus the TIMESTAMP, if it > # contains a TIMESTAMP. >-if [ -f "${dp_DISTINFO_FILE}" ] && grep -q "^TIMESTAMP " ${dp_DISTINFO_FILE}; then >- grep -v "^TIMESTAMP " ${dp_DISTINFO_FILE} > ${DISTINFO_OLD} >+if [ -f "${dp_DISTINFO_FILE}" ] && grep -q "^TIMESTAMP " "${dp_DISTINFO_FILE}"; then >+ grep -v "^TIMESTAMP " "${dp_DISTINFO_FILE}" > "${DISTINFO_OLD}" > fi > > for file in ${dp_CKSUMFILES}; do >@@ -47,7 +47,7 @@ done > # need to add one. > # - If the old and new distinfo content minus the TIMESTAMP differ, it means > # something was updated or changed, it is time to generate a new timestamp. >-if [ ! -s ${DISTINFO_OLD} ] || ! cmp -s ${DISTINFO_OLD} ${DISTINFO_NEW}; then >- echo "TIMESTAMP = $(date '+%s')" > ${dp_DISTINFO_FILE} >- cat ${DISTINFO_NEW} >> ${dp_DISTINFO_FILE} >+if [ ! -s "${DISTINFO_OLD}" ] || ! cmp -s "${DISTINFO_OLD}" "${DISTINFO_NEW}"; then >+ echo "TIMESTAMP = $(date '+%s')" > "${dp_DISTINFO_FILE}" >+ cat "${DISTINFO_NEW}" >> "${dp_DISTINFO_FILE}" > fi >diff --git Mk/Scripts/ports_env.sh Mk/Scripts/ports_env.sh >index 7d1d861bf28e..051b3ea1d138 100644 >--- Mk/Scripts/ports_env.sh >+++ Mk/Scripts/ports_env.sh >@@ -8,6 +8,6 @@ if [ -z "${SCRIPTSDIR}" ]; then > exit 1 > fi > >-. ${SCRIPTSDIR}/functions.sh >+. "${SCRIPTSDIR}"/functions.sh > > export_ports_env >diff --git Mk/Scripts/qa.sh Mk/Scripts/qa.sh >index e01ed5ee18ae..6806e33b01a6 100644 >--- Mk/Scripts/qa.sh >+++ Mk/Scripts/qa.sh >@@ -25,7 +25,7 @@ err() { > } > > list_stagedir_elfs() { >- cd ${STAGEDIR} && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@" >+ cd "${STAGEDIR}" && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@" > } > > shebangonefile() { >@@ -54,7 +54,7 @@ shebangonefile() { > ${LINUXBASE}/*) ;; > ${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*) > # lang/perl5* are allowed to have these shebangs. >- if ! expr ${PKGORIGIN} : '^lang/perl5.*' > /dev/null; then >+ if ! expr "${PKGORIGIN}" : '^lang/perl5.*' > /dev/null; then > err "'${interp}' is an invalid shebang for '${f#${STAGEDIR}${PREFIX}/}' you must use ${LOCALBASE}/bin/perl." > err "Either pass \${PERL} to the build or use USES=shebangfix" > rc=1 >@@ -101,7 +101,7 @@ shebang() { > shebangonefile "${f}" || rc=1 > # Use heredoc to avoid losing rc from find|while subshell > done <<-EOF >- $(find ${STAGEDIR}${PREFIX} \ >+ $(find "${STAGEDIR}${PREFIX}" \ > -type f -perm +111 2>/dev/null) > EOF > >@@ -170,7 +170,7 @@ symlinks() { > esac > # Use heredoc to avoid losing rc from find|while subshell. > done <<-EOF >- $(find ${STAGEDIR} -type l -exec stat -f "%N${LF}%Y" {} +) >+ $(find "${STAGEDIR}" -type l -exec stat -f "%N${LF}%Y" {} +) > EOF > > return ${rc} >@@ -194,7 +194,7 @@ paths() { > rc=1 > # Use heredoc to avoid losing rc from find|while subshell > done <<-EOF >- $(find ${TMPPLIST} ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +) >+ $(find "${TMPPLIST}" "${STAGEDIR}" -type f -exec grep -l "${STAGEDIR}" {} +) > EOF > > return ${rc} >@@ -207,7 +207,7 @@ stripped() { > # Split file and result into 2 lines and read separately to ensure > # files with spaces are kept intact. > # Using readelf -h ... /ELF Header:/ will match on all ELF files. >- find ${STAGEDIR} -type f ! -name '*.a' ! -name '*.o' \ >+ find "${STAGEDIR}" -type f ! -name '*.a' ! -name '*.o' \ > -exec readelf -S {} + 2>/dev/null | awk ' > /File:/ {sub(/File: /, "", $0); file=$0} > /[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' | >@@ -218,10 +218,10 @@ stripped() { > > desktopfileutils() { > if [ -z "${USESDESKTOPFILEUTILS}" ]; then >- grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null && >+ grep -q MimeType= "${STAGEDIR}${PREFIX}"/share/applications/*.desktop 2>/dev/null && > warn "you need USES=desktop-file-utils" > else >- grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null || >+ grep -q MimeType= "${STAGEDIR}${PREFIX}"/share/applications/*.desktop 2>/dev/null || > warn "you may not need USES=desktop-file-utils" > fi > return 0 >@@ -248,19 +248,19 @@ sharedmimeinfo() { > suidfiles() { > local filelist > >- filelist=$(find ${STAGEDIR} -type f \ >+ filelist=$(find "${STAGEDIR}" -type f \ > \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ > \( -perm -u+s -or -perm -g+s \)) > if [ -n "${filelist}" ]; then > warn "setuid files in the stage directory (are these necessary?):" >- ls -liTd ${filelist} >+ ls -liTd "${filelist}" > fi > return 0 > } > > libtool() { > if [ -z "${USESLIBTOOL}" ]; then >- find ${STAGEDIR} -name '*.la' | while read -r f; do >+ find "${STAGEDIR}" -name '*.la' | while read -r f; do > if grep -q 'libtool library' "${f}"; then > err ".la libraries found, port needs USES=libtool" > return 1 >@@ -279,7 +279,7 @@ libperl() { > # No results presents a blank line from heredoc. > [ -z "${f}" ] && continue > files=$((files+1)) >- found=$(readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100} >+ found=$(readelf -d "${f}" | awk "BEGIN {libperl=1; rpath=10; runpath=100} > /NEEDED.*${LIBPERL}/ { libperl = 0 } > /RPATH.*perl.*CORE/ { rpath = 0 } > /RUNPATH.*perl.*CORE/ { runpath = 0 } >@@ -292,7 +292,7 @@ libperl() { > *0) > has_some_libperl_so=1 > # Older Perl did not USE_LDCONFIG. >- if [ ! -f ${LOCALBASE}/${LDCONFIG_DIR}/perl5 ]; then >+ if [ ! -f "${LOCALBASE}/${LDCONFIG_DIR}/perl5" ]; then > case "${found}" in > *1?) > warn "${f} does not have a rpath to ${LIBPERL}, not respecting lddlflags?" >@@ -308,7 +308,7 @@ libperl() { > esac > # Use heredoc to avoid losing rc from find|while subshell > done <<-EOT >- $(find ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} -name '*.so') >+ $(find "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" -name '*.so') > EOT > > if [ ${files} -gt 0 -a ${has_some_libperl_so} -eq 0 ]; then >@@ -321,7 +321,7 @@ libperl() { > } > > prefixvar() { >- if [ ${PREFIX} != ${LINUXBASE} -a -d ${STAGEDIR}${PREFIX}/var ]; then >+ if [ "${PREFIX}" != "${LINUXBASE}" -a -d "${STAGEDIR}${PREFIX}/var" ]; then > warn "port uses ${PREFIX}/var instead of /var" > fi > } >@@ -353,7 +353,7 @@ listcontains() { > lst=$2 > > for elt in ${lst} ; do >- if [ ${elt} = ${str} ]; then >+ if [ "${elt}" = "${str}" ]; then > return 0 > fi > done >@@ -365,276 +365,276 @@ proxydeps_suggest_uses() { > local lib_file=$2 > > # miscellaneous USE clauses >- if [ ${pkg} = 'devel/gettext-runtime' ]; then >+ if [ "${pkg}" = 'devel/gettext-runtime' ]; then > warn "you need USES+=gettext-runtime" >- elif [ ${pkg} = 'databases/sqlite3' ]; then >+ elif [ "${pkg}" = 'databases/sqlite3' ]; then > warn "you need USES+=sqlite" >- elif [ ${pkg} = 'databases/sqlite2' ]; then >+ elif [ "${pkg}" = 'databases/sqlite2' ]; then > warn "you need USES+=sqlite:2" > # Gnome -> same as port > # grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \&\& echo "\\${pkg} = \\\"\2/\3\\\" -o \\\\"|'|sort|sh >- elif [ ${pkg} = "accessibility/atk" -o \ >- ${pkg} = "accessibility/atkmm" -o \ >- ${pkg} = "graphics/cairo" -o \ >- ${pkg} = "graphics/cairomm" -o \ >- ${pkg} = "devel/dconf" -o \ >- ${pkg} = "audio/esound" -o \ >- ${pkg} = "devel/gconf2" -o \ >- ${pkg} = "devel/gconfmm26" -o \ >- ${pkg} = "devel/glib12" -o \ >- ${pkg} = "devel/glib20" -o \ >- ${pkg} = "devel/glibmm" -o \ >- ${pkg} = "audio/gsound" -o \ >- ${pkg} = "x11-toolkits/gtk12" -o \ >- ${pkg} = "x11-toolkits/gtk20" -o \ >- ${pkg} = "x11-toolkits/gtk30" -o \ >- ${pkg} = "www/gtkhtml3" -o \ >- ${pkg} = "www/gtkhtml4" -o \ >- ${pkg} = "x11-toolkits/gtkmm20" -o \ >- ${pkg} = "x11-toolkits/gtkmm24" -o \ >- ${pkg} = "x11-toolkits/gtkmm30" -o \ >- ${pkg} = "x11-toolkits/gtksourceview" -o \ >- ${pkg} = "x11-toolkits/gtksourceview2" -o \ >- ${pkg} = "x11-toolkits/gtksourceview3" -o \ >- ${pkg} = "x11-toolkits/gtksourceviewmm3" -o \ >- ${pkg} = "devel/libbonobo" -o \ >- ${pkg} = "x11-toolkits/libbonoboui" -o \ >- ${pkg} = "databases/libgda5" -o \ >- ${pkg} = "databases/libgda5-ui" -o \ >- ${pkg} = "databases/libgdamm5" -o \ >- ${pkg} = "devel/libglade2" -o \ >- ${pkg} = "x11/libgnome" -o \ >- ${pkg} = "graphics/libgnomecanvas" -o \ >- ${pkg} = "x11/libgnomekbd" -o \ >- ${pkg} = "print/libgnomeprint" -o \ >- ${pkg} = "x11-toolkits/libgnomeprintui" -o \ >- ${pkg} = "x11-toolkits/libgnomeui" -o \ >- ${pkg} = "devel/libgsf" -o \ >- ${pkg} = "www/libgtkhtml" -o \ >- ${pkg} = "x11-toolkits/libgtksourceviewmm" -o \ >- ${pkg} = "graphics/librsvg2" -o \ >- ${pkg} = "devel/libsigc++12" -o \ >- ${pkg} = "devel/libsigc++20" -o \ >- ${pkg} = "x11-toolkits/libwnck" -o \ >- ${pkg} = "x11-toolkits/libwnck3" -o \ >- ${pkg} = "textproc/libxml++26" -o \ >- ${pkg} = "textproc/libxml2" -o \ >- ${pkg} = "textproc/libxslt" -o \ >- ${pkg} = "x11-wm/metacity" -o \ >- ${pkg} = "x11-toolkits/pango" -o \ >- ${pkg} = "x11-toolkits/pangomm" -o \ >- ${pkg} = "x11-toolkits/pangox-compat" -o \ >- ${pkg} = "x11-toolkits/vte" -o \ >- ${pkg} = "x11-toolkits/vte3" ]; then >+ elif [ "${pkg}" = "accessibility/atk" -o \ >+ "${pkg}" = "accessibility/atkmm" -o \ >+ "${pkg}" = "graphics/cairo" -o \ >+ "${pkg}" = "graphics/cairomm" -o \ >+ "${pkg}" = "devel/dconf" -o \ >+ "${pkg}" = "audio/esound" -o \ >+ "${pkg}" = "devel/gconf2" -o \ >+ "${pkg}" = "devel/gconfmm26" -o \ >+ "${pkg}" = "devel/glib12" -o \ >+ "${pkg}" = "devel/glib20" -o \ >+ "${pkg}" = "devel/glibmm" -o \ >+ "${pkg}" = "audio/gsound" -o \ >+ "${pkg}" = "x11-toolkits/gtk12" -o \ >+ "${pkg}" = "x11-toolkits/gtk20" -o \ >+ "${pkg}" = "x11-toolkits/gtk30" -o \ >+ "${pkg}" = "www/gtkhtml3" -o \ >+ "${pkg}" = "www/gtkhtml4" -o \ >+ "${pkg}" = "x11-toolkits/gtkmm20" -o \ >+ "${pkg}" = "x11-toolkits/gtkmm24" -o \ >+ "${pkg}" = "x11-toolkits/gtkmm30" -o \ >+ "${pkg}" = "x11-toolkits/gtksourceview" -o \ >+ "${pkg}" = "x11-toolkits/gtksourceview2" -o \ >+ "${pkg}" = "x11-toolkits/gtksourceview3" -o \ >+ "${pkg}" = "x11-toolkits/gtksourceviewmm3" -o \ >+ "${pkg}" = "devel/libbonobo" -o \ >+ "${pkg}" = "x11-toolkits/libbonoboui" -o \ >+ "${pkg}" = "databases/libgda5" -o \ >+ "${pkg}" = "databases/libgda5-ui" -o \ >+ "${pkg}" = "databases/libgdamm5" -o \ >+ "${pkg}" = "devel/libglade2" -o \ >+ "${pkg}" = "x11/libgnome" -o \ >+ "${pkg}" = "graphics/libgnomecanvas" -o \ >+ "${pkg}" = "x11/libgnomekbd" -o \ >+ "${pkg}" = "print/libgnomeprint" -o \ >+ "${pkg}" = "x11-toolkits/libgnomeprintui" -o \ >+ "${pkg}" = "x11-toolkits/libgnomeui" -o \ >+ "${pkg}" = "devel/libgsf" -o \ >+ "${pkg}" = "www/libgtkhtml" -o \ >+ "${pkg}" = "x11-toolkits/libgtksourceviewmm" -o \ >+ "${pkg}" = "graphics/librsvg2" -o \ >+ "${pkg}" = "devel/libsigc++12" -o \ >+ "${pkg}" = "devel/libsigc++20" -o \ >+ "${pkg}" = "x11-toolkits/libwnck" -o \ >+ "${pkg}" = "x11-toolkits/libwnck3" -o \ >+ "${pkg}" = "textproc/libxml++26" -o \ >+ "${pkg}" = "textproc/libxml2" -o \ >+ "${pkg}" = "textproc/libxslt" -o \ >+ "${pkg}" = "x11-wm/metacity" -o \ >+ "${pkg}" = "x11-toolkits/pango" -o \ >+ "${pkg}" = "x11-toolkits/pangomm" -o \ >+ "${pkg}" = "x11-toolkits/pangox-compat" -o \ >+ "${pkg}" = "x11-toolkits/vte" -o \ >+ "${pkg}" = "x11-toolkits/vte3" ]; then > warn "you need USE_GNOME+=${pkg#*/}" > # Gnome different as port > # 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 >- elif [ ${pkg} = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3" >- elif [ ${pkg} = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf" >- elif [ ${pkg} = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf2" >- elif [ ${pkg} = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3" >- elif [ ${pkg} = "devel/gnome-vfs" ]; then warn "you need USE_GNOME+=gnomevfs2" >- elif [ ${pkg} = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection" >- elif [ ${pkg} = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2" >- elif [ ${pkg} = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl" >- elif [ ${pkg} = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus3" >- elif [ ${pkg} = "devel/ORBit2" ]; then warn "you need USE_GNOME+=orbit2" >+ elif [ "${pkg}" = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3" >+ elif [ "${pkg}" = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf" >+ elif [ "${pkg}" = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf2" >+ elif [ "${pkg}" = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3" >+ elif [ "${pkg}" = "devel/gnome-vfs" ]; then warn "you need USE_GNOME+=gnomevfs2" >+ elif [ "${pkg}" = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection" >+ elif [ "${pkg}" = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2" >+ elif [ "${pkg}" = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl" >+ elif [ "${pkg}" = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus3" >+ elif [ "${pkg}" = "devel/ORBit2" ]; then warn "you need USE_GNOME+=orbit2" > # mate >- # grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_MATE+=\1"|' >- elif [ ${pkg} = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja" >- elif [ ${pkg} = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter" >- elif [ ${pkg} = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop" >- elif [ ${pkg} = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd" >- elif [ ${pkg} = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather" >- elif [ ${pkg} = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco" >- elif [ ${pkg} = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus" >- elif [ ${pkg} = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel" >- elif [ ${pkg} = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit" >+ # grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ "${pkg}" = "\2/\3" ]; then warn "you need USE_MATE+=\1"|' >+ elif [ "${pkg}" = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja" >+ elif [ "${pkg}" = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter" >+ elif [ "${pkg}" = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop" >+ elif [ "${pkg}" = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd" >+ elif [ "${pkg}" = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather" >+ elif [ "${pkg}" = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco" >+ elif [ "${pkg}" = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus" >+ elif [ "${pkg}" = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel" >+ elif [ "${pkg}" = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit" > # KDE >- # 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"/' >- elif [ ${pkg} = "sysutils/baloo" ]; then warn "you need to use USE_KDE+=baloo" >- elif [ ${pkg} = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets" >- elif [ ${pkg} = "x11/kactivities" ]; then warn "you need to use USE_KDE+=kactivities" >- elif [ ${pkg} = "editors/kate" ]; then warn "you need to use USE_KDE+=kate" >- elif [ ${pkg} = "x11/kdelibs4" ]; then warn "you need to use USE_KDE+=kdelibs" >- elif [ ${pkg} = "sysutils/kfilemetadata" ]; then warn "you need to use USE_KDE+=kfilemetadata" >- elif [ ${pkg} = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb" >- elif [ ${pkg} = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc" >- elif [ ${pkg} = "graphics/libkdcraw-kde4" ]; then warn "you need to use USE_KDE+=libkdcraw" >- elif [ ${pkg} = "misc/libkdeedu" ]; then warn "you need to use USE_KDE+=libkdeedu" >- elif [ ${pkg} = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames" >- elif [ ${pkg} = "graphics/libkexiv2-kde4" ]; then warn "you need to use USE_KDE+=libkexiv2" >- elif [ ${pkg} = "graphics/libkipi-kde4" ]; then warn "you need to use USE_KDE+=libkipi" >- elif [ ${pkg} = "x11/libkonq" ]; then warn "you need to use USE_KDE+=libkonq" >- elif [ ${pkg} = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane" >- elif [ ${pkg} = "astro/marble" ]; then warn "you need to use USE_KDE+=marble" >- elif [ ${pkg} = "sysutils/nepomuk-core" ]; then warn "you need to use USE_KDE+=nepomuk-core" >- elif [ ${pkg} = "sysutils/nepomuk-widgets" ]; then warn "you need to use USE_KDE+=nepomuk-widgets" >- elif [ ${pkg} = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular" >- elif [ ${pkg} = "deskutils/kdepimlibs4" ]; then warn "you need to use USE_KDE+=pimlibs" >- elif [ ${pkg} = "devel/ruby-qtruby" ]; then warn "you need to use USE_KDE+=qtruby" >- elif [ ${pkg} = "devel/smokegen" ]; then warn "you need to use USE_KDE+=smokegen" >- elif [ ${pkg} = "devel/smokekde" ]; then warn "you need to use USE_KDE+=smokekde" >- elif [ ${pkg} = "devel/smokeqt" ]; then warn "you need to use USE_KDE+=smokeqt" >- elif [ ${pkg} = "x11/kde4-workspace" ]; then warn "you need to use USE_KDE+=workspace" >- elif [ ${pkg} = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi" >- elif [ ${pkg} = "x11-toolkits/attica" ]; then warn "you need to use USE_KDE+=attica" >- elif [ ${pkg} = "x11/qimageblitz" ]; then warn "you need to use USE_KDE+=qimageblitz" >- elif [ ${pkg} = "textproc/soprano" ]; then warn "you need to use USE_KDE+=soprano" >- elif [ ${pkg} = "deskutils/libstreamanalyzer" ]; then warn "you need to use USE_KDE+=strigi" >+ # 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"/' >+ elif [ "${pkg}" = "sysutils/baloo" ]; then warn "you need to use USE_KDE+=baloo" >+ elif [ "${pkg}" = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets" >+ elif [ "${pkg}" = "x11/kactivities" ]; then warn "you need to use USE_KDE+=kactivities" >+ elif [ "${pkg}" = "editors/kate" ]; then warn "you need to use USE_KDE+=kate" >+ elif [ "${pkg}" = "x11/kdelibs4" ]; then warn "you need to use USE_KDE+=kdelibs" >+ elif [ "${pkg}" = "sysutils/kfilemetadata" ]; then warn "you need to use USE_KDE+=kfilemetadata" >+ elif [ "${pkg}" = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb" >+ elif [ "${pkg}" = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc" >+ elif [ "${pkg}" = "graphics/libkdcraw-kde4" ]; then warn "you need to use USE_KDE+=libkdcraw" >+ elif [ "${pkg}" = "misc/libkdeedu" ]; then warn "you need to use USE_KDE+=libkdeedu" >+ elif [ "${pkg}" = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames" >+ elif [ "${pkg}" = "graphics/libkexiv2-kde4" ]; then warn "you need to use USE_KDE+=libkexiv2" >+ elif [ "${pkg}" = "graphics/libkipi-kde4" ]; then warn "you need to use USE_KDE+=libkipi" >+ elif [ "${pkg}" = "x11/libkonq" ]; then warn "you need to use USE_KDE+=libkonq" >+ elif [ "${pkg}" = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane" >+ elif [ "${pkg}" = "astro/marble" ]; then warn "you need to use USE_KDE+=marble" >+ elif [ "${pkg}" = "sysutils/nepomuk-core" ]; then warn "you need to use USE_KDE+=nepomuk-core" >+ elif [ "${pkg}" = "sysutils/nepomuk-widgets" ]; then warn "you need to use USE_KDE+=nepomuk-widgets" >+ elif [ "${pkg}" = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular" >+ elif [ "${pkg}" = "deskutils/kdepimlibs4" ]; then warn "you need to use USE_KDE+=pimlibs" >+ elif [ "${pkg}" = "devel/ruby-qtruby" ]; then warn "you need to use USE_KDE+=qtruby" >+ elif [ "${pkg}" = "devel/smokegen" ]; then warn "you need to use USE_KDE+=smokegen" >+ elif [ "${pkg}" = "devel/smokekde" ]; then warn "you need to use USE_KDE+=smokekde" >+ elif [ "${pkg}" = "devel/smokeqt" ]; then warn "you need to use USE_KDE+=smokeqt" >+ elif [ "${pkg}" = "x11/kde4-workspace" ]; then warn "you need to use USE_KDE+=workspace" >+ elif [ "${pkg}" = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi" >+ elif [ "${pkg}" = "x11-toolkits/attica" ]; then warn "you need to use USE_KDE+=attica" >+ elif [ "${pkg}" = "x11/qimageblitz" ]; then warn "you need to use USE_KDE+=qimageblitz" >+ elif [ "${pkg}" = "textproc/soprano" ]; then warn "you need to use USE_KDE+=soprano" >+ elif [ "${pkg}" = "deskutils/libstreamanalyzer" ]; then warn "you need to use USE_KDE+=strigi" > # KDE Frameworks >- elif [ ${pkg} = "devel/kf5-extra-cmake-modules" ]; then warn "you need to use USE_KDE+=ecm" >- elif [ ${pkg} = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils" >- elif [ ${pkg} = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative" >- elif [ ${pkg} = "devel/kf5-kfilemetadata" ]; then warn "you need to use USE_KDE+=filemetadata5" >- elif [ ${pkg} = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio" >- elif [ ${pkg} = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid" >- elif [ ${pkg} = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver" >- elif [ ${pkg} = "devel/kio-extras-kf5" ]; then warn "you need to use USE_KDE+=kio-extras" >- elif [ ${pkg} = "graphics/kf5-kimageformats" ]; then warn "you need to use USE_KDE+=kimageformats" >- elif [ ${pkg} = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross" >- elif [ ${pkg} = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu" >- elif [ ${pkg} = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo5" >- elif [ ${pkg} = "sysutils/kf5-bluez-qt" ]; then warn "you need to use USE_KDE+=bluez-qt" >- elif [ ${pkg} = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet" >- elif [ ${pkg} = "www/kf5-kdewebkit" ]; then warn "you need to use USE_KDE+=kdewebkit" >- elif [ ${pkg} = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml" >- elif [ ${pkg} = "x11-themes/kf5-breeze-icons" ]; then warn "you need to use USE_KDE+=breeze-icons" >- elif [ ${pkg} = "x11-themes/kf5-oxygen-icons5" ]; then warn "you need to use USE_KDE+=oxygen-icons5" >- elif [ ${pkg} = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica5" >- elif [ ${pkg} = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration" >- elif [ ${pkg} = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded" >- elif [ ${pkg} = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support" >- elif [ ${pkg} = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework" >- elif expr ${pkg} : '.*/kf5-.*' > /dev/null; then >- warn "you need USE_KDE+=$(echo ${pkg} | sed -E 's|.*/kf5-k||')" >+ elif [ "${pkg}" = "devel/kf5-extra-cmake-modules" ]; then warn "you need to use USE_KDE+=ecm" >+ elif [ "${pkg}" = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils" >+ elif [ "${pkg}" = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative" >+ elif [ "${pkg}" = "devel/kf5-kfilemetadata" ]; then warn "you need to use USE_KDE+=filemetadata5" >+ elif [ "${pkg}" = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio" >+ elif [ "${pkg}" = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid" >+ elif [ "${pkg}" = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver" >+ elif [ "${pkg}" = "devel/kio-extras-kf5" ]; then warn "you need to use USE_KDE+=kio-extras" >+ elif [ "${pkg}" = "graphics/kf5-kimageformats" ]; then warn "you need to use USE_KDE+=kimageformats" >+ elif [ "${pkg}" = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross" >+ elif [ "${pkg}" = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu" >+ elif [ "${pkg}" = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo5" >+ elif [ "${pkg}" = "sysutils/kf5-bluez-qt" ]; then warn "you need to use USE_KDE+=bluez-qt" >+ elif [ "${pkg}" = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet" >+ elif [ "${pkg}" = "www/kf5-kdewebkit" ]; then warn "you need to use USE_KDE+=kdewebkit" >+ elif [ "${pkg}" = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml" >+ elif [ "${pkg}" = "x11-themes/kf5-breeze-icons" ]; then warn "you need to use USE_KDE+=breeze-icons" >+ elif [ "${pkg}" = "x11-themes/kf5-oxygen-icons5" ]; then warn "you need to use USE_KDE+=oxygen-icons5" >+ elif [ "${pkg}" = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica5" >+ elif [ "${pkg}" = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration" >+ elif [ "${pkg}" = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded" >+ elif [ "${pkg}" = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support" >+ elif [ "${pkg}" = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework" >+ elif expr "${pkg}" : '.*/kf5-.*' > /dev/null; then >+ warn "you need USE_KDE+=$(echo "${pkg}" | sed -E 's|.*/kf5-k||')" > # GStreamer 0.10 >- elif [ ${pkg} = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes" >- elif [ ${pkg} = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes" >- elif [ ${pkg} = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad" >+ elif [ "${pkg}" = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes" >+ elif [ "${pkg}" = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes" >+ elif [ "${pkg}" = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad" > # GStreamer 1 >- elif [ ${pkg} = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes" >- elif [ ${pkg} = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes" >- elif [ ${pkg} = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad" >+ elif [ "${pkg}" = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes" >+ elif [ "${pkg}" = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes" >+ elif [ "${pkg}" = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad" > # boost related >- elif [ ${pkg} = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python" >+ elif [ "${pkg}" = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python" > # sdl-related >- elif [ ${pkg} = 'devel/sdl12' ]; then >+ elif [ "${pkg}" = 'devel/sdl12' ]; then > warn "you need USE_SDL+=sdl" >- elif echo ${pkg} | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then >- warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl_||')" >- elif [ ${pkg} = 'devel/sdl20' ]; then >+ elif echo "${pkg}" | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then >+ warn "you need USE_SDL+=$(echo "${pkg}" | sed -E 's|.*/sdl_||')" >+ elif [ "${pkg}" = 'devel/sdl20' ]; then > warn "you need USE_SDL+=sdl2" >- elif echo ${pkg} | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then >- warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl2_||')2" >+ elif echo "${pkg}" | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then >+ warn "you need USE_SDL+=$(echo "${pkg}" | sed -E 's|.*/sdl2_||')2" > # gl-related >- elif expr ${lib_file} : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then > warn "you need USE_GL+=gl" >- elif expr ${lib_file} : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then > warn "you need USE_GL+=gbm" >- elif expr ${lib_file} : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then > warn "you need USE_GL+=glesv2" >- elif expr ${lib_file} : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then > warn "you need USE_GL+=egl" >- elif [ ${pkg} = 'graphics/glew' ]; then >+ elif [ "${pkg}" = 'graphics/glew' ]; then > warn "you need USE_GL+=glew" >- elif [ ${pkg} = 'graphics/libGLU' ]; then >+ elif [ "${pkg}" = 'graphics/libGLU' ]; then > warn "you need USE_GL+=glu" >- elif [ ${pkg} = 'graphics/libGLw' ]; then >+ elif [ "${pkg}" = 'graphics/libGLw' ]; then > warn "you need USE_GL+=glw" >- elif [ ${pkg} = 'graphics/freeglut' ]; then >+ elif [ "${pkg}" = 'graphics/freeglut' ]; then > warn "you need USE_GL+=glut" > # Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk >- 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 >- warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')" >- elif [ ${pkg} = 'x11/pixman' ]; then >+ 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 >+ warn "you need USE_XORG+=$(echo "${pkg}" | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')" >+ elif [ "${pkg}" = 'x11/pixman' ]; then > warn "you need USE_XORG+=pixman" > # Qt4 >- elif expr ${pkg} : '.*/qt4-.*' > /dev/null; then >- warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's|.*/qt4-||')" >- elif expr ${pkg} : '.*/.*-qt4' > /dev/null; then >- warn "you need USE_QT4+=$(echo ${pkg} | sed -E 's|.*/(.*)-qt4|\1|')" >+ elif expr "${pkg}" : '.*/qt4-.*' > /dev/null; then >+ warn "you need USE_QT4+=$(echo "${pkg}" | sed -E 's|.*/qt4-||')" >+ elif expr "${pkg}" : '.*/.*-qt4' > /dev/null; then >+ warn "you need USE_QT4+=$(echo "${pkg}" | sed -E 's|.*/(.*)-qt4|\1|')" > # Qt5 >- elif expr ${pkg} : '.*/qt5-.*' > /dev/null; then >- warn "you need USE_QT5+=$(echo ${pkg} | sed -E 's|.*/qt5-||')" >+ elif expr "${pkg}" : '.*/qt5-.*' > /dev/null; then >+ warn "you need USE_QT5+=$(echo "${pkg}" | sed -E 's|.*/qt5-||')" > # MySQL >- elif expr ${lib_file} : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then > warn "you need USES+=mysql" > # postgresql >- elif expr ${pkg} : "^databases/postgresql.*-client" > /dev/null; then >+ elif expr "${pkg}" : "^databases/postgresql.*-client" > /dev/null; then > warn "you need USES+=pgsql" > # bdb >- elif expr ${pkg} : "^databases/db[456]" > /dev/null; then >+ elif expr "${pkg}" : "^databases/db[456]" > /dev/null; then > warn "you need USES+=bdb" > # fam/gamin >- elif [ ${pkg} = "devel/fam" -o ${pkg} = "devel/gamin" ]; then >+ elif [ "${pkg}" = "devel/fam" -o "${pkg}" = "devel/gamin" ]; then > warn "you need USES+=fam" > # firebird >- elif [ ${pkg} = "databases/firebird25-client" ]; then >+ elif [ "${pkg}" = "databases/firebird25-client" ]; then > warn "you need USES+=firebird" > # fuse >- elif [ ${pkg} = "sysutils/fusefs-libs" ]; then >+ elif [ "${pkg}" = "sysutils/fusefs-libs" ]; then > warn "you need USES+=fuse" > # gnustep >- elif [ ${pkg} = "lang/gnustep-base" ]; then >+ elif [ "${pkg}" = "lang/gnustep-base" ]; then > warn "you need USES+=gnustep and USE_GNUSTEP+=base" >- elif [ ${pkg} = "x11-toolkits/gnustep-gui" ]; then >+ elif [ "${pkg}" = "x11-toolkits/gnustep-gui" ]; then > warn "you need USES+=gnustep and USE_GNUSTEP+=gui" > # iconv >- elif [ ${pkg} = "converters/libiconv" ]; then >+ elif [ "${pkg}" = "converters/libiconv" ]; then > warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs" > # jpeg >- elif [ ${pkg} = "graphics/jpeg" -o ${pkg} = "graphics/jpeg-turbo" ]; then >+ elif [ "${pkg}" = "graphics/jpeg" -o "${pkg}" = "graphics/jpeg-turbo" ]; then > warn "you need USES+=jpeg" > # libarchive >- elif [ ${pkg} = "archivers/libarchive" ]; then >+ elif [ "${pkg}" = "archivers/libarchive" ]; then > warn "you need USES+=libarchive" >- elif [ ${pkg} = "devel/libedit" ]; then >+ elif [ "${pkg}" = "devel/libedit" ]; then > warn "you need USES+=libedit" > # lua >- elif expr ${pkg} : "^lang/lua" > /dev/null; then >+ elif expr "${pkg}" : "^lang/lua" > /dev/null; then > warn "you need USES+=lua" > # motif >- elif [ ${pkg} = "x11-toolkits/lesstif" -o ${pkg} = "x11-toolkits/open-motif" ]; then >+ elif [ "${pkg}" = "x11-toolkits/lesstif" -o "${pkg}" = "x11-toolkits/open-motif" ]; then > warn "you need USES+=motif" > # ncurses >- elif [ ${pkg} = "devel/ncurses" ]; then >+ elif [ "${pkg}" = "devel/ncurses" ]; then > warn "you need USES+=ncurses" > # objc >- elif [ ${pkg} = "lang/libobjc2" ]; then >+ elif [ "${pkg}" = "lang/libobjc2" ]; then > warn "you need USES+=objc" > # openal >- elif [ ${pkg} = "audio/openal" -o ${pkg} = "audio/openal-soft" -o ${pkg} = "audio/freealut" ]; then >+ elif [ "${pkg}" = "audio/openal" -o "${pkg}" = "audio/openal-soft" -o "${pkg}" = "audio/freealut" ]; then > warn "you need USES+=openal" > # pure >- elif [ ${pkg} = "lang/pure" ]; then >+ elif [ "${pkg}" = "lang/pure" ]; then > warn "you need USES+=pure" > # readline >- elif [ ${pkg} = "devel/readline" ]; then >+ elif [ "${pkg}" = "devel/readline" ]; then > warn "you need USES+=readline" > # ssl >- elif [ ${pkg} = "security/openssl" -o ${pkg} = "security/openssl-devel" \ >- -o ${pkg} = "security/libressl" -o ${pkg} = "security/libressl-devel" \ >+ elif [ "${pkg}" = "security/openssl" -o "${pkg}" = "security/openssl-devel" \ >+ -o "${pkg}" = "security/libressl" -o "${pkg}" = "security/libressl-devel" \ > ]; then > warn "you need USES=ssl" > # Tcl >- elif expr ${pkg} : "^lang/tcl" > /dev/null; then >+ elif expr "${pkg}" : "^lang/tcl" > /dev/null; then > warn "you need USES+=tcl" > # Tk >- elif expr ${pkg} : "^x11-toolkits/tk" > /dev/null; then >+ elif expr "${pkg}" : "^x11-toolkits/tk" > /dev/null; then > warn "you need USES+=tk" > # Xfce >- # grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|' >- elif [ ${pkg} = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon" >- elif [ ${pkg} = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo" >- elif [ ${pkg} = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui" >- elif [ ${pkg} = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu" >- elif [ ${pkg} = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil" >- elif [ ${pkg} = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel" >- elif [ ${pkg} = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar" >- elif [ ${pkg} = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf" >+ # grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ "${pkg}" = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|' >+ elif [ "${pkg}" = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon" >+ elif [ "${pkg}" = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo" >+ elif [ "${pkg}" = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui" >+ elif [ "${pkg}" = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu" >+ elif [ "${pkg}" = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil" >+ elif [ "${pkg}" = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel" >+ elif [ "${pkg}" = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar" >+ elif [ "${pkg}" = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf" > # default >- elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then >+ elif expr "${lib_file}" : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then > lib_file=${lib_file#${LOCALBASE}/lib/} > lib_file=${lib_file%.so*}.so > warn "you need LIB_DEPENDS+=${lib_file}:${pkg}" >@@ -655,11 +655,11 @@ proxydeps() { > # No results presents a blank line from heredoc. > [ -z "${dep_file}" ] && continue > # Skip files we already checked. >- if listcontains ${dep_file} "${already}"; then >+ if listcontains "${dep_file}" "${already}"; then > continue > fi >- if pkg which -q ${dep_file} > /dev/null 2>&1; then >- dep_file_pkg=$(pkg which -qo ${dep_file}) >+ if pkg which -q "${dep_file}" > /dev/null 2>&1; then >+ dep_file_pkg=$(pkg which -qo "${dep_file}") > > # Check that the .so we need has a SONAME > if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then >@@ -669,16 +669,16 @@ proxydeps() { > fi > > # If we don't already depend on it, and we don't provide it >- if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then >+ if ! listcontains "${dep_file_pkg}" "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then > # If the package has a flavor, check that the dependency is not on that particular flavor. > flavor=$(pkg annotate -q -S "${dep_file_pkg}" flavor) > if [ -n "${flavor}" ]; then >- if listcontains ${dep_file_pkg}@${flavor} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then >+ if listcontains "${dep_file_pkg}@${flavor}" "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then > continue > fi > fi > err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency" >- proxydeps_suggest_uses ${dep_file_pkg} ${dep_file} >+ proxydeps_suggest_uses "${dep_file_pkg}" "${dep_file}" > rc=1 > fi > else >@@ -691,7 +691,7 @@ proxydeps() { > awk ' > BEGIN {section=0} > /^\// {section++} >- !/^\// && section<=1 && ($3 ~ "^'${PREFIX}'" || $3 ~ "^'${LOCALBASE}'") {print $3}') >+ !/^\// && section<=1 && ($3 ~ "^'"${PREFIX}"'" || $3 ~ "^'"${LOCALBASE}"'") {print $3}') > EOT > done <<-EOT > $(list_stagedir_elfs | \ >@@ -707,13 +707,13 @@ proxydeps() { > } > > sonames() { >- [ ! -d ${STAGEDIR}${PREFIX}/lib -o -n "${BUNDLE_LIBS}" ] && return 0 >+ [ ! -d "${STAGEDIR}${PREFIX}/lib" -o -n "${BUNDLE_LIBS}" ] && return 0 > while read -r f; do > # No results presents a blank line from heredoc. > [ -z "${f}" ] && continue > # Ignore symlinks > [ -f "${f}" -a ! -L "${f}" ] || continue >- if ! readelf -d ${f} | grep -q SONAME; then >+ if ! readelf -d "${f}" | grep -q SONAME; then > warn "${f} doesn't have a SONAME." > warn "pkg(8) will not register it as being provided by the port." > warn "If another port depend on it, pkg will not be able to know where it comes from." >@@ -728,7 +728,7 @@ sonames() { > fi > # Use heredoc to avoid losing rc from find|while subshell > done <<-EOT >- $(find ${STAGEDIR}${PREFIX}/lib -name '*.so.*') >+ $(find "${STAGEDIR}${PREFIX}/lib" -name '*.so.*') > EOT > } > >@@ -781,7 +781,7 @@ perlcore() { > err "This line is not handled: \"${l}\"" > esac > done <<-EOT >- $(${LOCALBASE}/bin/corelist "${module}"|tail -1) >+ $("${LOCALBASE}"/bin/corelist "${module}"|tail -1) > EOT > fi > done >@@ -804,7 +804,7 @@ no_arch() { > done > [ "$skip" ] && continue > fi >- 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." >+ 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." > rc=1 > done <<-EOF > $(list_stagedir_elfs \ >@@ -828,12 +828,12 @@ gemdeps() > vers=${l#* } > while read -r v; do > if ! while read -r p; do >- ${LOCALBASE}/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')" >+ "${LOCALBASE}"/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')" > done | grep -qFx OK; then >- err RubyGem dependency ${name} ${v} is not satisfied. >+ err RubyGem dependency "${name}" "${v}" is not satisfied. > rc=1 > fi <<-EOF >- $(${LOCALBASE}/bin/gem list -e "${name}" \ >+ $("${LOCALBASE}"/bin/gem list -e "${name}" \ > | sed "s|.*(\(.*\))|\1|" \ > | tr -d ' ' \ > | tr , '\n') >@@ -846,7 +846,7 @@ gemdeps() > EOF > fi > done <<-EOF >- $(grep -a 'add_runtime_dependency' ${STAGEDIR}${PREFIX}/lib/ruby/gems/*/specifications/${PORTNAME}-*.gemspec \ >+ $(grep -a 'add_runtime_dependency' "${STAGEDIR}${PREFIX}"/lib/ruby/gems/*/specifications/"${PORTNAME}"-*.gemspec \ > | sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \ > | sort -u) > EOF >@@ -889,12 +889,12 @@ gemfiledeps() > # use bundle to check if Gemfile is satisfied > # if bundle returns 1 the Gemfile is not satisfied > # and so stage-qa isn't also >- if ! bundle check --dry-run --gemfile $f > /dev/null 2>&1; then >+ if ! bundle check --dry-run --gemfile "$f" > /dev/null 2>&1; then > warn "Dependencies defined in ${f} are not satisfied" > fi > > done <<-EOF >- $(find ${STAGEDIR} -name Gemfile) >+ $(find "${STAGEDIR}" -name Gemfile) > EOF > return 0 > } >@@ -921,7 +921,7 @@ checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" > checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors" > > ret=0 >-cd ${STAGEDIR} || exit 1 >+cd "${STAGEDIR}" || exit 1 > for check in ${checks}; do > ${check} || ret=1 > done >diff --git Mk/Scripts/smart_makepatch.sh Mk/Scripts/smart_makepatch.sh >index 653b59d7e0c1..155f9892f367 100644 >--- Mk/Scripts/smart_makepatch.sh >+++ Mk/Scripts/smart_makepatch.sh >@@ -48,9 +48,9 @@ esac > strip_path() { > local raw_name=$1 > if [ "${STRIP_COMPONENTS}" = "0" ]; then >- echo ${raw_name} >+ echo "${raw_name}" > else >- echo ${raw_name} | awk -v sc=${STRIP_COMPONENTS} -F "/" \ >+ echo "${raw_name}" | awk -v sc="${STRIP_COMPONENTS}" -F "/" \ > '{ for (x = sc + 1; x <= NF; x++) { > slash = (x>sc+1) ? "/" : ""; > printf ("%s%s", slash, $x); >@@ -61,14 +61,14 @@ strip_path() { > std_patch_filename() { > local sans_cwd > local raw_name >- sans_cwd=$(echo $1 | sed 's|^\.\/||') >- raw_name=$(strip_path ${sans_cwd}) >- echo "patch-$(echo ${raw_name} | sed -e 's|_|&&|g; s|/|_|g')" >+ sans_cwd=$(echo "$1" | sed 's|^\.\/||') >+ raw_name=$(strip_path "${sans_cwd}") >+ echo "patch-$(echo "${raw_name}" | sed -e 's|_|&&|g; s|/|_|g')" > } > > patchdir_files_list() { > if [ -d "${PATCHDIR}" ]; then >- (cd ${PATCHDIR} && \ >+ (cd "${PATCHDIR}" && \ > find ./* -type f -name "patch-*" -maxdepth 0 \ > 2>/dev/null | sed -e 's,^\./,,; /\.orig$/d' > ) >@@ -81,28 +81,28 @@ valid_name() { > local first_target > local testres > local lps >- first_target=$(echo $2 | sed 's|^\.\/||') >+ first_target=$(echo "$2" | sed 's|^\.\/||') > for lps in __ - + ; do >- testres=patch-$(echo ${first_target} | sed -e "s|/|${lps}|g") >+ testres=patch-$(echo "${first_target}" | sed -e "s|/|${lps}|g") > if [ "${testres}" = "${current_patch_name}" ]; then > result=${testres} > break > fi > done >- echo ${result} >+ echo "${result}" > } > > map_existing_patches() { >- mkdir -p ${WORKAREA} >- : > ${PATCHMAP} >+ mkdir -p "${WORKAREA}" >+ : > "${PATCHMAP}" > local target > local future_name > local std_target > local P > local t > for P in ${old_patch_list}; do >- target=$(cd ${PATCHDIR} && \ >- grep "^+++ " ${P} | awk '{print $2}' >+ target=$(cd "${PATCHDIR}" && \ >+ grep "^+++ " "${P}" | awk '{print $2}' > ) > # For single patches, we honor previous separators, but use > # a standard patch name if the current patch name does not >@@ -114,12 +114,12 @@ map_existing_patches() { > future_name=${P} > break; > fi >- std_target=$(std_patch_filename ${t}) >- future_name=$(valid_name ${P} ${t} ${std_target}) >+ std_target=$(std_patch_filename "${t}") >+ future_name=$(valid_name "${P}" "${t}" "${std_target}") > done > for t in ${target}; do >- std_target=$(std_patch_filename ${t}) >- echo "${future_name} ${std_target}" >> ${PATCHMAP} >+ std_target=$(std_patch_filename "${t}") >+ echo "${future_name} ${std_target}" >> "${PATCHMAP}" > done > done > } >@@ -130,12 +130,12 @@ extract_comment_from_patch() { > local rawname > local fname > local num >- contains=$(grep "^+++ " ${existing_patch} | awk '{x++; print x}') >+ contains=$(grep "^+++ " "${existing_patch}" | awk '{x++; print x}') > for num in ${contains}; do >- rawname=$(grep "^+++ " ${existing_patch} | \ >- awk -v num=${num} '{x++; if (x==num) print $2}') >- fname=$(std_patch_filename $rawname) >- awk -v num=${num} ' >+ rawname=$(grep "^+++ " "${existing_patch}" | \ >+ awk -v num="${num}" '{x++; if (x==num) print $2}') >+ fname=$(std_patch_filename "$rawname") >+ awk -v num="${num}" ' > BEGIN { done=0; x=0; hunk=0; looking=(num==1) } > { > if (!done) { >@@ -162,22 +162,22 @@ extract_comment_from_patch() { > } > } > } >- }' ${existing_patch} > ${COMMENTS}/${fname} >+ }' "${existing_patch}" > "${COMMENTS}/${fname}" > done > } > > extract_comments() { >- mkdir -p ${COMMENTS} >- rm -f ${COMMENTS}/* >+ mkdir -p "${COMMENTS}" >+ rm -f "${COMMENTS}"/* > local P > for P in ${old_patch_list}; do >- extract_comment_from_patch ${P} >+ extract_comment_from_patch "${P}" > done > } > > regenerate_patches() { >- mkdir -p ${REGENNED} >- rm -f ${REGENNED}/* >+ mkdir -p "${REGENNED}" >+ rm -f "${REGENNED}"/* > [ ! -d "${PATCH_WRKSRC}" ] && return > > local F >@@ -190,44 +190,44 @@ regenerate_patches() { > (cd "${PATCH_WRKSRC}" && for F in ${new_list}; do > ORIG=${F#./} > NEW=${ORIG%.orig} >- cmp -s ${ORIG} ${NEW} && continue >- OUT=${REGENNED}/$(std_patch_filename ${NEW}) >- TZ=UTC diff -udp ${ORIG} ${NEW} | sed \ >+ cmp -s "${ORIG}" "${NEW}" && continue >+ OUT=${REGENNED}/$(std_patch_filename "${NEW}") >+ TZ=UTC diff -udp "${ORIG}" "${NEW}" | sed \ > -e '/^---/s|\.[0-9]* +0000$| UTC|' \ > -e '/^+++/s|\([[:blank:]][-0-9:.+]*\)*$||' \ >- > ${OUT} || true >+ > "${OUT}" || true > done) > } > > get_patch_name() { >- awk -v name=$1 ' >+ awk -v name="$1" ' > { if ($2 == name) > { > if (!done) { print $1 }; > done = 1; > } > } >- END { if (!done) print name }' ${PATCHMAP} >+ END { if (!done) print name }' "${PATCHMAP}" > } > > stage_patches() { >- mkdir -p ${DESTDIR} >- rm -f ${DESTDIR}/* >+ mkdir -p "${DESTDIR}" >+ rm -f "${DESTDIR}"/* > local P > local name > local patch_list >- patch_list=$(cd ${REGENNED} && find ./* -name "patch-*" 2>/dev/null) >+ patch_list=$(cd "${REGENNED}" && find ./* -name "patch-*" 2>/dev/null) > for P in ${patch_list}; do > P=${P#./} >- name=$(get_patch_name ${P}) >- [ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \ >- >> ${DESTDIR}/${name} >+ name=$(get_patch_name "${P}") >+ [ -e "${COMMENTS}/${P}" ] && cat "${COMMENTS}/${P}" \ >+ >> "${DESTDIR}/${name}" > if [ "${P}" = "${name}" ]; then > echo "Generated ${P}" > else > echo "Generated ${P} >> ${name} (legacy)" > fi >- cat ${REGENNED}/${P} >> ${DESTDIR}/${name} >+ cat "${REGENNED}/${P}" >> "${DESTDIR}/${name}" > done > } > >@@ -240,48 +240,48 @@ compare_common_patches() { > local cpatch > local cpatch_stripped > for P in ${old_patch_list}; do >- if [ -e ${DESTDIR}/${P} ]; then >+ if [ -e "${DESTDIR}/${P}" ]; then > ppatch=${PATCHDIR}/${P} > cpatch=${DESTDIR}/${P} > ppatch_stripped=$(mktemp -t portpatch) > cpatch_stripped=$(mktemp -t portpatch) >- egrep -v -- '--- .+ UTC$' ${ppatch} \ >- > ${ppatch_stripped} >- egrep -v -- '--- .+ UTC$' ${cpatch} \ >- > ${cpatch_stripped} >+ egrep -v -- '--- .+ UTC$' "${ppatch}" \ >+ > "${ppatch_stripped}" >+ egrep -v -- '--- .+ UTC$' "${cpatch}" \ >+ > "${cpatch_stripped}" > # Don't replace patches with only metadata changes >- if ! cmp -s ${ppatch_stripped} ${cpatch_stripped}; then >+ if ! cmp -s "${ppatch_stripped}" "${cpatch_stripped}"; then > archive_patch_list="${archive_patch_list} ${P}" > else > echo "${P} only contains metadata changes; not replacing" >- rm ${cpatch} >+ rm "${cpatch}" > fi >- rm ${ppatch_stripped} >- rm ${cpatch_stripped} >+ rm "${ppatch_stripped}" >+ rm "${cpatch_stripped}" > fi > done > old_patch_list=${archive_patch_list} > } > > conserve_old_patches() { >- mkdir -p ${SAVEDIR} >- rm -f ${SAVEDIR}/* >+ mkdir -p "${SAVEDIR}" >+ rm -f "${SAVEDIR}"/* > [ -z "${old_patch_list}" ] && return > > local P > for P in ${old_patch_list}; do >- mv ${PATCHDIR}/${P} ${SAVEDIR}/${P} >+ mv "${PATCHDIR}/${P}" "${SAVEDIR}/${P}" > done > echo "The previous patches have been placed here:" >- echo ${SAVEDIR} >+ echo "${SAVEDIR}" > } > > install_regenerated_patches() { > local testdir >- testdir=$(find ${DESTDIR} -empty) >+ testdir=$(find "${DESTDIR}" -empty) > if [ -z "${testdir}" ]; then >- mkdir -p ${PATCHDIR} >- find ${DESTDIR} -type f -exec mv {} ${PATCHDIR}/ \; >+ mkdir -p "${PATCHDIR}" >+ find "${DESTDIR}" -type f -exec mv {} "${PATCHDIR}"/ \; > fi > } > > >base-commit: 3322229e665243f2ca8bcd04cb608c5e93177b0e >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 227109
:
191974
|
193646
|
193895
|
194078
|
201029
|
201756
|
201757