diff options
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/checksum.sh | 2 | ||||
-rw-r--r-- | Mk/Scripts/do-fetch.sh | 31 | ||||
-rw-r--r-- | Mk/bsd.port.mk | 15 |
3 files changed, 23 insertions, 25 deletions
diff --git a/Mk/Scripts/checksum.sh b/Mk/Scripts/checksum.sh index e9279b72e8bb..ba826ce9e9f3 100644 --- a/Mk/Scripts/checksum.sh +++ b/Mk/Scripts/checksum.sh @@ -28,7 +28,7 @@ if [ -f "${dp_DISTINFO_FILE}" ]; then eval "alg_executable=\$dp_${alg}" if [ "$alg_executable" != "NO" ]; then - MKSUM=$(eval $alg_executable \< "${file}") + MKSUM=$($alg_executable < "${file}") CKSUM=$(distinfo_data "${alg}" "${file}") else ignore="true" diff --git a/Mk/Scripts/do-fetch.sh b/Mk/Scripts/do-fetch.sh index ca28c86af120..c63fce5d81a6 100644 --- a/Mk/Scripts/do-fetch.sh +++ b/Mk/Scripts/do-fetch.sh @@ -22,7 +22,6 @@ cd "${dp_DISTDIR}" for _file in "${@}"; do file=${_file%%:*} - unescaped_file=$(unescape "${file}") # If this files has groups if [ "$_file" = "$file" ]; then @@ -43,7 +42,7 @@ for _file in "${@}"; do fi done fi - if [ ! -f "${unescaped_file}" -a ! -f "$filebasename" -o "$force_fetch" = "true" ]; then + if [ ! -f "${file}" -a ! -f "$filebasename" -o "$force_fetch" = "true" ]; then full_file="${dp_DIST_SUBDIR:+${dp_DIST_SUBDIR}/}${file}" if [ -L "$file" -o -L "$filebasename" ]; then ${dp_ECHO_MSG} "=> ${dp_DISTDIR}/$file is a broken symlink." @@ -71,7 +70,8 @@ for _file in "${@}"; do esac __MASTER_SITES_TMP= for group in $select; do - # Disable nounset for this, it may come up empty. + # Disable nounset for this, it may come up empty, but + # we don't want to fail with a strange error here. set +u eval ___MASTER_SITES_TMP="\${_${dp_SITE_FLAVOR}_SITES_${group}}" set -u @@ -104,32 +104,33 @@ for _file in "${@}"; do ;; esac sites_remaining=0 - sites="$(eval "${SORTED_MASTER_SITES_CMD_TMP} ${dp_RANDOMIZE_SITES}")" + sites="$(${SORTED_MASTER_SITES_CMD_TMP} ${dp_RANDOMIZE_SITES})" for site in ${sites}; do sites_remaining=$((sites_remaining + 1)) done for site in ${sites}; do sites_remaining=$((sites_remaining - 1)) CKSIZE=$(distinfo_data SIZE "${full_file}") - # The site may contain special shell characters, they - # need to be escaped. - site=$(escape "${site}") # There is a lot of escaping, but the " needs to survive echo/eval. case ${file} in */*) mkdir -p "${file%/*}" - args="-o \\\"${file}\\\" \\\"${site}${file}\\\"" + args="-o ${file} ${site}${file}" ;; *) - args="\\\"${site}${file}\\\"" + args="${site}${file}" ;; esac - _fetch_cmd=$(eval "echo ${dp_FETCH_ENV} ${dp_FETCH_CMD} ${dp_FETCH_BEFORE_ARGS} ${args} ${dp_FETCH_AFTER_ARGS}") + _fetch_cmd="${dp_FETCH_CMD} ${dp_FETCH_BEFORE_ARGS}" + if [ -z "${dp_DISABLE_SIZE}" -a -n "${CKSIZE}" ]; then + _fetch_cmd="${_fetch_cmd} -S ${CKSIZE}" + fi + _fetch_cmd="${_fetch_cmd} ${args} ${dp_FETCH_AFTER_ARGS}" case ${dp_TARGET} in do-fetch|makesum) ${dp_ECHO_MSG} "=> Attempting to fetch ${site}${file}" - if eval "env ${_fetch_cmd}"; then - actual_size=$(eval stat -f %z "${file}") + 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 continue 2 else @@ -142,10 +143,10 @@ for _file in "${@}"; do fi ;; fetch-list) - echo -n "env ${_fetch_cmd} || " + echo -n "env $(escape "${_fetch_cmd}") || " ;; fetch-url-list-int) - eval "echo $(eval "echo ${args}")" + echo ${args} ;; esac done @@ -156,7 +157,7 @@ for _file in "${@}"; do exit 1 ;; fetch-list) - echo "echo ${file} not fetched; }" ; \ + echo "echo \"${file}\" not fetched; }" ; \ ;; esac fi diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index a764db1b06bc..dad780000f07 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -2057,9 +2057,6 @@ FETCH_ENV?= SSL_NO_VERIFY_PEER=1 SSL_NO_VERIFY_HOSTNAME=1 FETCH_BINARY?= /usr/bin/fetch FETCH_ARGS?= -Fpr FETCH_REGET?= 1 -.if !defined(DISABLE_SIZE) -FETCH_BEFORE_ARGS+= $${CKSIZE:+-S $$CKSIZE} -.endif FETCH_CMD?= ${FETCH_BINARY} ${FETCH_ARGS} .if defined(RANDOMIZE_MASTER_SITES) @@ -2471,24 +2468,24 @@ MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n; # # Hackery to enable simple fetch targets with several dynamic MASTER_SITES # -_MASTER_SITES_ENV= _MASTER_SITES_DEFAULT="${_MASTER_SITES_DEFAULT}" +_MASTER_SITES_ENV= _MASTER_SITES_DEFAULT=${_MASTER_SITES_DEFAULT:Q} .for _F in ${DISTFILES} _F_TEMP= ${_F:S/^${_F:C/:[^:]+$//}//:S/^://} . if !empty(_F_TEMP) . for _group in ${_F_TEMP:S/,/ /g} . if defined(_MASTER_SITES_${_group}) -_MASTER_SITES_ENV+= _MASTER_SITES_${_group}="${_MASTER_SITES_${_group}}" +_MASTER_SITES_ENV+= _MASTER_SITES_${_group}=${_MASTER_SITES_${_group}:Q} . endif . endfor . endif .endfor -_PATCH_SITES_ENV= _PATCH_SITES_DEFAULT="${_PATCH_SITES_DEFAULT}" +_PATCH_SITES_ENV= _PATCH_SITES_DEFAULT=${_PATCH_SITES_DEFAULT:Q} .for _F in ${PATCHFILES} _F_TEMP= ${_F:S/^${_F:C/:[^-:][^:]*$//}//:S/^://} . if !empty(_F_TEMP) . for _group in ${_F_TEMP:S/,/ /g} . if defined(_PATCH_SITES_${_group}) -_PATCH_SITES_ENV+= _PATCH_SITES_${_group}="${_PATCH_SITES_${_group}}" +_PATCH_SITES_ENV+= _PATCH_SITES_${_group}=${_PATCH_SITES_${_group}:Q} . endif . endfor . endif @@ -3029,7 +3026,7 @@ _DO_FETCH_ENV= \ dp_FETCH_AFTER_ARGS='${FETCH_AFTER_ARGS}' \ dp_FETCH_BEFORE_ARGS='${FETCH_BEFORE_ARGS}' \ dp_FETCH_CMD='${FETCH_CMD}' \ - dp_FETCH_ENV=${FETCH_ENV:Q:Q} \ + dp_FETCH_ENV=${FETCH_ENV:Q} \ dp_FORCE_FETCH_ALL='${FORCE_FETCH_ALL}' \ dp_FORCE_FETCH_LIST='${FORCE_FETCH_LIST}' \ dp_MASTER_SITE_BACKUP='${_MASTER_SITE_BACKUP}' \ @@ -3792,7 +3789,7 @@ pre-distclean: .if !target(distclean) distclean: pre-distclean clean - @cd ${.CURDIR} && ${MAKE} delete-distfiles RESTRICTED_FILES="${_DISTFILES} ${_PATCHFILES}" + @cd ${.CURDIR} && ${MAKE} delete-distfiles RESTRICTED_FILES="${_DISTFILES:Q} ${_PATCHFILES:Q}" .endif .if !target(delete-distfiles) |