Date: Sun, 19 Jun 2016 11:25:35 +0000 (UTC) From: Mathieu Arnold <mat@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r417111 - head/Mk/Scripts Message-ID: <201606191125.u5JBPZKH050242@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mat Date: Sun Jun 19 11:25:35 2016 New Revision: 417111 URL: https://svnweb.freebsd.org/changeset/ports/417111 Log: Reverse tests to decrease complexity. PR: 210198 Submitted by: mat Exp-run by: antoine Sponsored by: The FreeBSD Foundation, Absolight Differential Revision: https://reviews.freebsd.org/D6779 Modified: head/Mk/Scripts/check-vulnerable.sh (contents, props changed) head/Mk/Scripts/checksum.sh (contents, props changed) head/Mk/Scripts/do-fetch.sh (contents, props changed) Modified: head/Mk/Scripts/check-vulnerable.sh ============================================================================== --- head/Mk/Scripts/check-vulnerable.sh Sun Jun 19 11:25:29 2016 (r417110) +++ head/Mk/Scripts/check-vulnerable.sh Sun Jun 19 11:25:35 2016 (r417111) @@ -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 Modified: head/Mk/Scripts/checksum.sh ============================================================================== --- head/Mk/Scripts/checksum.sh Sun Jun 19 11:25:29 2016 (r417110) +++ head/Mk/Scripts/checksum.sh Sun Jun 19 11:25:35 2016 (r417111) @@ -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 Modified: head/Mk/Scripts/do-fetch.sh ============================================================================== --- head/Mk/Scripts/do-fetch.sh Sun Jun 19 11:25:29 2016 (r417110) +++ head/Mk/Scripts/do-fetch.sh Sun Jun 19 11:25:35 2016 (r417111) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606191125.u5JBPZKH050242>