3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: scripts/Check-PkgVersion
5 # Copyright (C) 2004 - 2023 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 if [ "$1" = "-repository" ]; then
17 for x
in package
/$y/*; do $0 ${x##*/}; done
22 if [ "$1" != "${1#-}" -o $# -eq 0 ]; then
23 echo "Usage: $0 <package-names>"
24 echo "or $0 -repository <repository-names>"
28 curl_options
='--disable-epsv'
30 # Set proxy information
31 if [ -f download
/Proxy
]; then
32 proxy
="$(< download/Proxy)"
34 echo "INFO: Setting proxy to $proxy."
35 curl_options
="$curl_options --proxy $proxy"
37 echo "INFO: No proxy information... removing download/Proxy."
41 if [ -f download
/Proxy-auth
]; then
42 proxyauth
="$(< download/Proxy-auth)"
43 if [ "$proxyauth" ]; then
44 echo "INFO: Setting proxy authentication information."
45 curl_options
="$curl_options --proxy-user $proxyauth"
47 echo "INFO: No proxy-auth information... removing download/Proxy-auth."
48 rm download
/Proxy-auth
57 for pdir
in package
/*/$package; do :; done
58 if [ -x $pdir/check-version
]; then
59 sh
$pdir/check-version
60 elif [ -f $pdir/$package.desc
]; then
61 x
="`egrep '^\[D\] ' $pdir/$package.desc | head -n 1 | tr -s ' '`"
63 echo "No [D] for package $package found!"
65 echo "Testing package $package ..."
67 pattern
="`echo $x | cut -f3 -d' '`"
68 url
="`echo $x | cut -f4 -d' '`" url
="${url#-}"
70 if [ "${url:0:1}" == "!" ]; then
75 url
="`echo ${url#!} | sed -e 's,http://dl.sourceforge.net/sourceforge/,http://prdownloads.sourceforge.net/,'`"
76 pattern
="`echo $pattern | \
77 sed -e 's,+,\\\\+,g' -e 's,[0-9].*$,,' \
78 -e 's,$,[0-9],' -e 's,^,^,'`"
80 delpattern
='\.(gz|bz2|Z)$ \.(tar|zip|tgz|tbz)$ ^[^0-9]+'
81 delpattern
="$delpattern"' .*\.(deb|sign?|diff|rpm)$'
82 delpattern
="$delpattern"' .*\.(dsc|lsm|asc|md5)$'
84 if egrep -q '^\[CV-URL\] ' $pdir/$package.desc
; then
85 url
="`egrep '^\[CV-URL\] ' \
86 $pdir/$package.desc | head -n 1 | \
87 tr -s ' ' | cut -f2 -d' '`"
90 if egrep -q '^\[CV-PAT\]' $pdir/$package.desc
; then
91 pattern
="`egrep '^\[CV-PAT\]' \
92 $pdir/$package.desc | head -n 1 | \
96 if egrep -q '^\[CV-DEL\]' $pdir/$package.desc
; then
97 delpattern
="`egrep '^\[CV-DEL\]' \
98 $pdir/$package.desc | head -n 1 | \
99 cut -s -f2- -d' ' | tr -s ' '`"
102 echo -e "\n** `echo $x | cut -f3 -d' '`\n"
103 echo "package='$package' pattern='$pattern'"
104 echo -e "url='$url'\ndelpattern='$delpattern'"
107 curl
$curl_options -s "$url" | \
108 tee checkver
/debug
.1 | \
109 tr "\r\t\"'<>= /" '\n\n\n\n\n\n\n\n\n' | \
110 tee checkver
/debug
.2 | \
111 perl
-e "while (<>) { chomp;
112 \$fn=\$_; next unless /$pattern/;
113 foreach \$x (qw/$delpattern/) { s/\$x//g; }
114 print \"\$_\t\$fn\\n\" if \$_ ne ''; }" | \
115 tee checkver
/debug
.3 | \
123 next unless /(\S+)\s+(\S+)/;
125 s/(\d+)/sprintf("%020d", $1)/eg;
126 # print "$_:$a:$b\n";
127 if (not defined $x{$_}) {
134 foreach (reverse sort keys %x) {
136 }' |
tee checkver
/$package.new | \
138 if [ ! -f checkver
/$package.txt
] ||
139 ! grep -qx "$line" checkver
/$package.txt
141 echo " * $line" |
expand -t20
143 echo " $line" |
expand -t20
147 } > checkver
/$package.msg
149 if ! [ -s checkver
/$package.new
]; then
150 echo "Got no list for package $package!" \
151 >> checkver
/$package.msg
152 cat checkver
/$package.msg
; echo
154 if grep -q '^ \* ' checkver
/$package.msg
155 then cat checkver
/$package.msg
; echo
156 else rm checkver
/$package.msg
; fi
159 if [ -f checkver
/$package.msg
]; then
160 echo >> checkver
/$package.msg
164 echo "ERROR: Package $package not found!"