Commit c3f5101d authored by Ed Reel's avatar Ed Reel Committed by GitHub

Update check_updates.sh (#4592)

parent 523bb757
...@@ -5,14 +5,14 @@ if [ ! -f packages.yaml ]; then ...@@ -5,14 +5,14 @@ if [ ! -f packages.yaml ]; then
fi fi
if test $1; then if test $1; then
valid= valid=
opt="core high medium low none" opt="core high medium low"
for o in $opt; do for o in $opt; do
[ $1 == $o ] && valid=1 [ $1 == $o ] && valid=1
done done
if ! test $valid; then if ! test $valid; then
echo "Usage: $0 [activity] [offset] [lines]" echo "Usage: $0 [activity] [offset] [lines]"
echo "activity: core|high|medium|low|none" echo "activity: core|high|medium|low"
echo "offset: # from the beginning line" echo "offset: # of lines to skip"
echo "lines: # of lines to check" echo "lines: # of lines to check"
exit 1 exit 1
fi fi
...@@ -20,7 +20,7 @@ if test $1; then ...@@ -20,7 +20,7 @@ if test $1; then
rm -f /tmp/urls.txt rm -f /tmp/urls.txt
cat core_packages.txt > /tmp/names.txt cat core_packages.txt > /tmp/names.txt
for p in $(cat /tmp/names.txt); do 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 done
else else
grep -2 "^activity: $1" packages.yaml > /tmp/activity.txt grep -2 "^activity: $1" packages.yaml > /tmp/activity.txt
...@@ -49,42 +49,48 @@ if test $2; then ...@@ -49,42 +49,48 @@ if test $2; then
fi fi
c=0 c=0
for p in $(cat /tmp/names.txt); do for p in $(cat /tmp/names.txt); do
u=$(grep -1 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2) a=$(grep -2 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2)
version=$(grep "^ version" ../packages/$p.rb | cut -d"'" -f2) if [ "${a}" != "none" ]; then
repo= star=
[[ $u == *"gnu.org"* ]] && repo="gnu" repo=
[[ $u == *"github.com"* && $u == *"/releases"* ]] && repo="github" u=$(grep -1 "^name: ${p}$" packages.yaml | tail -1 | cut -d' ' -f2)
[[ $u == *"savannah.gnu.org"* && $u == *"/releases"* ]] && repo="savannah" version=$(grep "^ version" ../packages/$p.rb | cut -d"'" -f2)
case $repo in cp=$(grep "^${p}$" core_packages.txt)
gnu) test $cp && star=*
content=$(curl -Ls $u) [[ $u == *"gnu.org"* ]] && repo="gnu"
content=$(echo $content | sed 's,[ds|latest].tar,,g') [[ $u == *"github.com"* && $u == *"/releases"* ]] && repo="github"
d=${content##*\.tar\.[g|l|x]z\">} [[ $u == *"savannah.gnu.org"* && $u == *"/releases"* ]] && repo="savannah"
rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) case $repo in
ver=${rel%.tar*} gnu)
nu="$u/$p-$rel" content=$(curl -Ls $u)
[[ $version != $ver ]] && echo "- [ ] $p | $nu | $version | $ver" content=$(echo $content | sed 's,[ds|latest].tar,,g')
;; d=${content##*\.tar\.[g|l|x]z\">}
github) rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2)
content=$(curl -Ls $u) ver=${rel%.tar*}
d=${content#*/archive/} nu="$u/$p-$rel"
rel=$(echo $d | cut -d '"' -f1) [[ $version != $ver ]] && echo "- [ ] $p$star | $nu | $version | $ver"
ver=${rel%.zip*} ;;
nu=$(echo "${u/releases/archive}") github)
[[ $version != $ver ]] && echo "- [ ] $p | $nu/$ver.tar.gz | $version | $ver" content=$(curl -Ls $u)
;; d=${content#*/archive/}
savannah) rel=$(echo $d | cut -d '"' -f1)
content=$(curl -Ls $u) ver=${rel%.zip*}
d=${content##*\.tar\.[g|l|x]z\">} nu=$(echo "${u/releases/archive}")
rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2) [[ $version != $ver ]] && echo "- [ ] $p$star | $nu/$ver.tar.gz | $version | $ver"
ver=${rel%.tar*} ;;
nu="$u/$p-$rel" savannah)
[[ $version != $ver ]] && echo "- [ ] $p | $nu | $version | $ver" content=$(curl -Ls $u)
;; d=${content##*\.tar\.[g|l|x]z\">}
*) rel=$(echo $d | cut -d'<' -f1 | cut -d '-' -f2)
echo "- [ ] $p | $u | $version | not checked" ver=${rel%.tar*}
esac nu="$u/$p-$rel"
c=$((c+1)) [[ $version != $ver ]] && echo "- [ ] $p$star | $nu | $version | $ver"
;;
*)
echo "- [ ] $p$star | $u | $version | not checked"
esac
c=$((c+1))
fi
done done
echo "Total packages: $c" echo "Total packages: $c"
#most /tmp/urls.txt #most /tmp/urls.txt
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment