From 02a9bf3ec9c6e42b81060a501c5bc7306751325e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 1 Oct 2020 12:22:48 -0700 Subject: [PATCH] Fix version-id bug, drop unused code, check that URL exists before allowing "versions.sh" to continue --- version-id.jq | 2 +- versions.sh | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/version-id.jq b/version-id.jq index c46b3915..88c75bf5 100644 --- a/version-id.jq +++ b/version-id.jq @@ -1,7 +1,7 @@ def version_id: # https://www.php.net/phpversion # $version_id = $major_version * 10000 + $minor_version * 100 + $release_version; - sub("[a-z].*$"; "") + sub("[a-zA-Z].*$"; "") | split(".") | ( (.[0] // 0 | tonumber) * 10000 diff --git a/versions.sh b/versions.sh index 55b4f439..e0732630 100755 --- a/versions.sh +++ b/versions.sh @@ -23,8 +23,6 @@ declare -A gpgKeys=( # https://www.php.net/downloads.php#gpg-7.2 # https://www.php.net/gpg-keys.php#gpg-7.2 [7.2]='1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F' - - [7.1]='foo' ) # see https://www.php.net/downloads.php @@ -104,6 +102,11 @@ for version in "${versions[@]}"; do exit 1 fi + if ! wget -q --spider "$url"; then + echo >&2 "error: '$url' appears to be missing" + exit 1 + fi + # if we don't have a .asc URL, let's see if we can figure one out :) if [ -z "$ascUrl" ] && wget -q --spider "$url.asc"; then ascUrl="$url.asc"