From c3f5101da1635d92fe620ddd84da2e660141fdd7 Mon Sep 17 00:00:00 2001 From: Ed Reel Date: Sat, 21 Nov 2020 23:28:59 -0600 Subject: [PATCH] Update check_updates.sh (#4592) --- tools/check_updates.sh | 86 ++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/tools/check_updates.sh b/tools/check_updates.sh index ee33a1d4ee..d13e1196f7 100755 --- a/tools/check_updates.sh +++ b/tools/check_updates.sh @@ -5,14 +5,14 @@ if [ ! -f packages.yaml ]; then fi if test $1; then valid= - opt="core high medium low none" + opt="core high medium low" for o in $opt; do [ $1 == $o ] && valid=1 done if ! test $valid; then echo "Usage: $0 [activity] [offset] [lines]" - echo "activity: core|high|medium|low|none" - echo "offset: # from the beginning line" + echo "activity: core|high|medium|low" + echo "offset: # of lines to skip" echo "lines: # of lines to check" exit 1 fi @@ -20,7 +20,7 @@ if test $1; then rm -f /tmp/urls.txt cat core_packages.txt > /tmp/names.txt for p in $(cat /tmp/names.txt); do - grep -1 "^name: $p" packages.yaml | tail -1 | cut -d' ' -f2 >> /tmp/urls.txt + grep -1 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2 >> /tmp/urls.txt done else grep -2 "^activity: $1" packages.yaml > /tmp/activity.txt @@ -49,42 +49,48 @@ if test $2; then fi c=0 for p in $(cat /tmp/names.txt); do - u=$(grep -1 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2) - version=$(grep "^ version" ../packages/$p.rb | cut -d"'" -f2) - repo= - [[ $u == *"gnu.org"* ]] && repo="gnu" - [[ $u == *"github.com"* && $u == *"/releases"* ]] && repo="github" - [[ $u == *"savannah.gnu.org"* && $u == *"/releases"* ]] && repo="savannah" - case $repo in - gnu) - content=$(curl -Ls $u) - content=$(echo $content | sed 's,[ds|latest].tar,,g') - d=${content##*\.tar\.[g|l|x]z\">} - rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) - ver=${rel%.tar*} - nu="$u/$p-$rel" - [[ $version != $ver ]] && echo "- [ ] $p | $nu | $version | $ver" - ;; - github) - content=$(curl -Ls $u) - d=${content#*/archive/} - rel=$(echo $d | cut -d '"' -f1) - ver=${rel%.zip*} - nu=$(echo "${u/releases/archive}") - [[ $version != $ver ]] && echo "- [ ] $p | $nu/$ver.tar.gz | $version | $ver" - ;; - savannah) - content=$(curl -Ls $u) - d=${content##*\.tar\.[g|l|x]z\">} - rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) - ver=${rel%.tar*} - nu="$u/$p-$rel" - [[ $version != $ver ]] && echo "- [ ] $p | $nu | $version | $ver" - ;; - *) - echo "- [ ] $p | $u | $version | not checked" - esac - c=$((c+1)) + a=$(grep -2 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2) + if [ "${a}" != "none" ]; then + star= + repo= + u=$(grep -1 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2) + version=$(grep "^ version" ../packages/$p.rb | cut -d"'" -f2) + cp=$(grep "^${p}$" core_packages.txt) + test $cp && star=* + [[ $u == *"gnu.org"* ]] && repo="gnu" + [[ $u == *"github.com"* && $u == *"/releases"* ]] && repo="github" + [[ $u == *"savannah.gnu.org"* && $u == *"/releases"* ]] && repo="savannah" + case $repo in + gnu) + content=$(curl -Ls $u) + content=$(echo $content | sed 's,[ds|latest].tar,,g') + d=${content##*\.tar\.[g|l|x]z\">} + rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) + ver=${rel%.tar*} + nu="$u/$p-$rel" + [[ $version != $ver ]] && echo "- [ ] $p$star | $nu | $version | $ver" + ;; + github) + content=$(curl -Ls $u) + d=${content#*/archive/} + rel=$(echo $d | cut -d '"' -f1) + ver=${rel%.zip*} + nu=$(echo "${u/releases/archive}") + [[ $version != $ver ]] && echo "- [ ] $p$star | $nu/$ver.tar.gz | $version | $ver" + ;; + savannah) + content=$(curl -Ls $u) + d=${content##*\.tar\.[g|l|x]z\">} + rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) + ver=${rel%.tar*} + nu="$u/$p-$rel" + [[ $version != $ver ]] && echo "- [ ] $p$star | $nu | $version | $ver" + ;; + *) + echo "- [ ] $p$star | $u | $version | not checked" + esac + c=$((c+1)) + fi done echo "Total packages: $c" #most /tmp/urls.txt