3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by scripts/Create-CopyPatch.
6 # T2 SDE: scripts/Check-PkgVersion
7 # Copyright (C) 2004 - 2020 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 ROCK Linux Project
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 if [ "$1" = "-repository" ]; then
20 for x
in package
/$y/*; do $0 ${x##*/}; done
25 if [ "$1" != "${1#-}" -o $# -eq 0 ]; then
26 echo "Usage: $0 <package-names>"
27 echo "or $0 -repository <repository-names>"
31 curl_options
='--disable-epsv'
33 # Set proxy information
34 if [ -f download
/Proxy
]; then
35 proxy
="$(< download/Proxy)"
37 echo "INFO: Setting proxy to $proxy."
38 curl_options
="$curl_options --proxy $proxy"
40 echo "INFO: No proxy information... removing download/Proxy."
44 if [ -f download
/Proxy-auth
]; then
45 proxyauth
="$(< download/Proxy-auth)"
46 if [ "$proxyauth" ]; then
47 echo "INFO: Setting proxy authentication information."
48 curl_options
="$curl_options --proxy-user $proxyauth"
50 echo "INFO: No proxy-auth information... removing download/Proxy-auth."
51 rm download
/Proxy-auth
60 for pdir
in package
/*/$package; do :; done
61 if [ -x $pdir/check-version
]; then
62 sh
$pdir/check-version
63 elif [ -f $pdir/$package.desc
]; then
64 x
="`egrep '^\[D\] ' $pdir/$package.desc | head -n 1 | tr -s ' '`"
66 echo "No [D] for package $package found!"
68 echo "Testing package $package ..."
70 pattern
="`echo $x | cut -f3 -d' '`"
71 url
="`echo $x | cut -f4 -d' '`"; url
="${url#-}"
73 if [ "${url:0:1}" == "!" ]; then
78 url
="$( echo ${url#!} | sed -e 's,http://dl.sourceforge.net/sourceforge/,http://prdownloads.sourceforge.net/,' )"
79 pattern
="`echo $pattern | \
80 sed -e 's,+,\\\\+,g' -e 's,[0-9].*$,,' \
81 -e 's,$,[0-9],' -e 's,^,^,'`"
83 delpattern
='\.(gz|bz2|Z)$ \.(tar|zip|tgz|tbz)$ ^[^0-9]+'
84 delpattern
="$delpattern"' .*\.(deb|sign?|diff|rpm)$'
85 delpattern
="$delpattern"' .*\.(dsc|lsm|asc|md5)$'
87 if egrep -q '^\[CV-URL\] ' $pdir/$package.desc
; then
88 url
="`egrep '^\[CV-URL\] ' \
89 $pdir/$package.desc | head -n 1 | \
90 tr -s ' ' | cut -f2 -d' '`"
93 if egrep -q '^\[CV-PAT\]' $pdir/$package.desc
; then
94 pattern
="`egrep '^\[CV-PAT\]' \
95 $pdir/$package.desc | head -n 1 | \
99 if egrep -q '^\[CV-DEL\]' $pdir/$package.desc
; then
100 delpattern
="`egrep '^\[CV-DEL\]' \
101 $pdir/$package.desc | head -n 1 | \
102 cut -s -f2- -d' ' | tr -s ' '`"
105 echo -e "\n** `echo $x | cut -f3 -d' '`\n"
106 echo "package='$package' pattern='$pattern'"
107 echo -e "url='$url'\ndelpattern='$delpattern'"
110 curl
$curl_options -s "$url" | \
111 tee checkver
/debug
.1 | \
112 tr "\r\t\"'<>= /" '\n\n\n\n\n\n\n\n\n' | \
113 tee checkver
/debug
.2 | \
114 perl
-e "while (<>) { chomp;
115 \$fn=\$_; next unless /$pattern/;
116 foreach \$x (qw/$delpattern/) { s/\$x//g; }
117 print \"\$_\t\$fn\\n\" if \$_ ne ''; }" | \
118 tee checkver
/debug
.3 | \
126 next unless /(\S+)\s+(\S+)/;
128 s/(\d+)/sprintf("%020d", $1)/eg;
129 # print "$_:$a:$b\n";
130 if (not defined $x{$_}) {
137 foreach (reverse sort keys %x) {
139 }' |
tee checkver
/$package.new | \
141 if [ ! -f checkver
/$package.txt
] ||
142 ! grep -qx "$line" checkver
/$package.txt
144 echo " * $line" |
expand -t20
146 echo " $line" |
expand -t20
150 } > checkver
/$package.msg
152 if ! [ -s checkver
/$package.new
]; then
153 echo "Got no list for package $package!" \
154 >> checkver
/$package.msg
155 cat checkver
/$package.msg
; echo
157 if grep -q '^ \* ' checkver
/$package.msg
158 then cat checkver
/$package.msg
; echo
159 else rm checkver
/$package.msg
; fi
162 if [ -f checkver
/$package.msg
]; then
163 echo >> checkver
/$package.msg
167 echo "ERROR: Package $package not found!"