diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2016-06-19 11:25:35 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2016-06-19 11:25:35 +0000 |
commit | 5ba3aba7ff8a966196d93846c9e3020757d11042 (patch) | |
tree | ac4236e8754a4d6776129d614f9e7bcb21ada45e /Mk/Scripts | |
parent | a2262e931305294882ca078238da1ce88deba4bb (diff) |
Notes
Diffstat (limited to 'Mk/Scripts')
-rw-r--r-- | Mk/Scripts/check-vulnerable.sh | 25 | ||||
-rw-r--r-- | Mk/Scripts/checksum.sh | 36 | ||||
-rw-r--r-- | Mk/Scripts/do-fetch.sh | 135 |
3 files changed, 100 insertions, 96 deletions
diff --git a/Mk/Scripts/check-vulnerable.sh b/Mk/Scripts/check-vulnerable.sh index 6ddf6d68b00a..ecac738103dc 100644 --- a/Mk/Scripts/check-vulnerable.sh +++ b/Mk/Scripts/check-vulnerable.sh @@ -20,16 +20,17 @@ if [ "${dp_PORTNAME}" = "pkg" ]; then exit 0 fi -if [ -x "${dp_PKG_BIN}" ]; then - vlist=$(${dp_PKG_BIN} audit "${dp_PKGNAME}" || :) - if [ "${vlist}" = "0 problem(s) in the installed packages found." ]; then - vlist="" - else - ${dp_ECHO_MSG} "===> ${dp_PKGNAME} has known vulnerabilities:" - ${dp_ECHO_MSG} "$vlist" - ${dp_ECHO_MSG} "=> Please update your ports tree and try again." - ${dp_ECHO_MSG} "=> Note: Vulnerable ports are marked as such even if there is no update available." - ${dp_ECHO_MSG} "=> If you wish to ignore this vulnerability rebuild with 'make DISABLE_VULNERABILITIES=yes'" - exit 1 - fi +if [ ! -x "${dp_PKG_BIN}" ]; then + exit 0 +fi + +vlist=$(${dp_PKG_BIN} audit "${dp_PKGNAME}" || :) + +if [ "${vlist}" != "0 problem(s) in the installed packages found." ]; then + ${dp_ECHO_MSG} "===> ${dp_PKGNAME} has known vulnerabilities:" + ${dp_ECHO_MSG} "$vlist" + ${dp_ECHO_MSG} "=> Please update your ports tree and try again." + ${dp_ECHO_MSG} "=> Note: Vulnerable ports are marked as such even if there is no update available." + ${dp_ECHO_MSG} "=> If you wish to ignore this vulnerability rebuild with 'make DISABLE_VULNERABILITIES=yes'" + exit 1 fi diff --git a/Mk/Scripts/checksum.sh b/Mk/Scripts/checksum.sh index ba826ce9e9f3..fc028893a002 100644 --- a/Mk/Scripts/checksum.sh +++ b/Mk/Scripts/checksum.sh @@ -39,24 +39,26 @@ if [ -f "${dp_DISTINFO_FILE}" ]; then ignore="true" fi - if [ $ignore = "false" ]; then - match="false" - for chksum in $CKSUM; do - if [ "$chksum" = "$MKSUM" ]; then - match="true" - break - fi - done - if [ $match = "true" ]; then - ${dp_ECHO_MSG} "=> $alg Checksum OK for $file." - ignored="false" - else - ${dp_ECHO_MSG} "=> $alg Checksum mismatch for $file." - refetchlist="$refetchlist $file " - OK="${OK:-retry}" - [ "${OK}" = "retry" -a "${dp_FETCH_REGET}" -gt 0 ] && rm -f "${file}" - ignored="false" + if [ $ignore != "false" ]; then + continue + fi + + match="false" + for chksum in $CKSUM; do + if [ "$chksum" = "$MKSUM" ]; then + match="true" + break fi + done + if [ $match = "true" ]; then + ${dp_ECHO_MSG} "=> $alg Checksum OK for $file." + ignored="false" + else + ${dp_ECHO_MSG} "=> $alg Checksum mismatch for $file." + refetchlist="$refetchlist $file " + OK="${OK:-retry}" + [ "${OK}" = "retry" -a "${dp_FETCH_REGET}" -gt 0 ] && rm -f "${file}" + ignored="false" fi done diff --git a/Mk/Scripts/do-fetch.sh b/Mk/Scripts/do-fetch.sh index c63fce5d81a6..2391b964bd39 100644 --- a/Mk/Scripts/do-fetch.sh +++ b/Mk/Scripts/do-fetch.sh @@ -42,24 +42,26 @@ for _file in "${@}"; do fi done fi - 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." - ${dp_ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?" - ${dp_ECHO_MSG} "=> Please correct this problem and try again." + if [ '(' -f "${file}" -o -f "$filebasename" ')' -a "$force_fetch" != "true" ]; then + continue + fi + 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." + ${dp_ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?" + ${dp_ECHO_MSG} "=> Please correct this problem and try again." + exit 1 + fi + if [ -f "${dp_DISTINFO_FILE}" -a -z "${dp_NO_CHECKSUM}" ]; then + _sha256sum=$(distinfo_data SHA256 "${full_file}") + if [ -z "$_sha256sum" ]; then + ${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is not in ${dp_DISTINFO_FILE}." + ${dp_ECHO_MSG} "=> Either ${dp_DISTINFO_FILE} is out of date, or" + ${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is spelled incorrectly." exit 1 fi - if [ -f "${dp_DISTINFO_FILE}" -a -z "${dp_NO_CHECKSUM}" ]; then - _sha256sum=$(distinfo_data SHA256 "${full_file}") - if [ -z "$_sha256sum" ]; then - ${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is not in ${dp_DISTINFO_FILE}." - ${dp_ECHO_MSG} "=> Either ${dp_DISTINFO_FILE} is out of date, or" - ${dp_ECHO_MSG} "=> ${dp_DIST_SUBDIR:+$dp_DIST_SUBDIR/}$file is spelled incorrectly." - exit 1 - fi - fi - case ${dp_TARGET} in + fi + case ${dp_TARGET} in do-fetch|makesum) ${dp_ECHO_MSG} "=> $file doesn't seem to exist in ${dp_DISTDIR}." if [ ! -w "${dp_DISTDIR}" ]; then @@ -67,18 +69,18 @@ for _file in "${@}"; do exit 1 fi ;; - esac - __MASTER_SITES_TMP= - for group in $select; do - # 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 - if [ -n "${___MASTER_SITES_TMP}" ] ; then - __MASTER_SITES_TMP="${__MASTER_SITES_TMP} ${___MASTER_SITES_TMP}" - else - case ${dp_TARGET} in + esac + __MASTER_SITES_TMP= + for group in $select; do + # 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 + if [ -n "${___MASTER_SITES_TMP}" ] ; then + __MASTER_SITES_TMP="${__MASTER_SITES_TMP} ${___MASTER_SITES_TMP}" + else + case ${dp_TARGET} in do-fetch|makesum) if [ -n "${dp_DEVELOPER}" ]; then ${dp_ECHO_MSG} "===> /!\\ Error /!\\" @@ -91,42 +93,42 @@ for _file in "${@}"; do exit 1 fi ;; - esac + esac - fi - done - ___MASTER_SITES_TMP= - SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(echo -n "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}" - case ${dp_TARGET} in - fetch-list) - echo -n "mkdir -p ${dp_DISTDIR} && " - echo -n "cd ${dp_DISTDIR} && { " + fi + done + ___MASTER_SITES_TMP= + SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(echo -n "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}" + case ${dp_TARGET} in + fetch-list) + echo -n "mkdir -p ${dp_DISTDIR} && " + echo -n "cd ${dp_DISTDIR} && { " + ;; + esac + sites_remaining=0 + 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}") + # 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="${site}${file}" ;; esac - sites_remaining=0 - 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}") - # 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="${site}${file}" - ;; - esac - _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 + _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 env -S "${dp_FETCH_ENV}" ${_fetch_cmd}; then @@ -148,18 +150,17 @@ for _file in "${@}"; do fetch-url-list-int) echo ${args} ;; - esac - done - case ${dp_TARGET} in + esac + done + case ${dp_TARGET} in do-fetch|makesum) ${dp_ECHO_MSG} "=> Couldn't fetch it - please try to retrieve this" ${dp_ECHO_MSG} "=> port manually into ${dp_DISTDIR} and try again." exit 1 ;; fetch-list) - echo "echo \"${file}\" not fetched; }" ; \ + echo "echo \"${file}\" not fetched; }" ;; - esac - fi + esac done |