diff --git a/tests/test00_specsyntax.in b/tests/test00_specsyntax.in index ff43c1e..35305ad 100644 --- a/tests/test00_specsyntax.in +++ b/tests/test00_specsyntax.in @@ -42,6 +42,30 @@ function specfile.checksyntax() { local total_issues=0 + # 0. checking if 'Source[0]' is a valid internet address + # (skip this test if no '%setup' section has been found) + test.skip $test_number || { + notify.note "$(test.num2str). ${NOTE}"\ +"url""${NORM}..." + if [[ "$SPEC_URL" ]]; then + http_code=`curl -s -o /dev/null -w "%{http_code}" $SPEC_URL` + if [ "$http_code" != "200" ]; then + if [ "${http_code:0:2}" == "30" ]; then + http_effective_url=`curl -w "%{url_effective}" -I -L -s -o /dev/null -S $SPEC_URL` + { notify.warning "\ +\`url': "$"redirect detected: replacing from \`$SPEC_URL' to \`${http_effective_url}'" + let "total_issues += 1"; + } + sed -i "s|^\(URL:[[:space:]]*\)$SPEC_URL.*|\1${http_effective_url}|" $specfile + else + { notify.error "\ +\`url': "$"invalid return code for \`$SPEC_URL': $http_code" + let "total_issues += 1"; } + fi + fi + fi; } + test_number=$(($test_number + 1)) + # 1. checking if 'Source[0]' is a valid internet address # (skip this test if no '%setup' section has been found) test.skip $test_number || {