3 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
6 # Filename: scripts/Check-PkgVersion
7 # Copyright (C) 2008 The OpenSDE Project
8 # Copyright (C) 2004 - 2006 The T2 SDE Project
9 # Copyright (C) 1998 - 2003 Clifford Wolf
11 # More information can be found in the files COPYING and README.
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; version 2 of the License. A copy of the
16 # GNU General Public License can be found in the file COPYING.
17 # --- SDE-COPYRIGHT-NOTE-END ---
19 if [ "$1" = "-repository" ] ; then
21 for x
in package
/$y/* ; do $0 ${x##*/} ; done
26 if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
27 echo "Usage: $0 <package-names>"
28 echo "or $0 -repository <repository-names>"
32 curl_options
='--disable-epsv'
34 # Set proxy information
35 if [ -f download
/Proxy
]; then
36 proxy
="`cat download/Proxy`"
38 echo "INFO: Setting proxy to $proxy."
39 curl_options
="$curl_options --proxy $proxy"
41 echo "INFO: No proxy information... removing download/Proxy."
45 if [ -f download
/Proxy-auth
]; then
46 proxyauth
="`cat download/Proxy-auth`"
47 if [ "$proxyauth" ]; then
48 echo "INFO: Setting proxy authentication information."
49 curl_options
="$curl_options --proxy-user $proxyauth"
51 echo "INFO: No proxy-auth information... removing download/Proxy-auth."
52 rm download
/Proxy-auth
61 for pdir
in package
/*/$package ; do : ; done
62 if [ -x $pdir/check-version
] ; then
63 sh
$pdir/check-version
64 elif [ -f $pdir/$package.desc
] ; then
65 x
="`egrep '^\[D\] ' $pdir/$package.desc | head -n 1 | tr -s ' '`"
67 echo "No [D] for package $package found!"
69 echo "Testing package $package ..."
71 pattern
="`echo $x | cut -f3 -d' '`"
72 url
="`echo $x | cut -f4 -d' '`"; url
="${url#-}"
74 if [ "${url:0:1}" = "!" ]; then
79 url
="$( echo ${url#!} | sed -e 's,http://dl.sourceforge.net/sourceforge/,http://prdownloads.sourceforge.net/,' )"
80 pattern
="`echo $pattern | \
81 sed -e 's,+,\\\\+,g' -e 's,[0-9].*$,,' \
82 -e 's,$,[0-9],' -e 's,^,^,'`"
84 delpattern
='\.(gz|bz2|Z)$ \.(tar|zip|tgz|tbz)$ ^[^0-9]+'
85 delpattern
="$delpattern"' .*\.(deb|sign?|diff|rpm)$'
86 delpattern
="$delpattern"' .*\.(dsc|lsm|asc|md5)$'
88 if egrep -q '^\[CV-URL\] ' $pdir/$package.desc
; then
89 url
="`egrep '^\[CV-URL\] ' \
90 $pdir/$package.desc | head -n 1 | \
91 tr -s ' ' | cut -f2 -d' '`"
94 if egrep -q '^\[CV-PAT\]' $pdir/$package.desc
; then
95 pattern
="`egrep '^\[CV-PAT\]' \
96 $pdir/$package.desc | head -n 1 | \
100 if egrep -q '^\[CV-DEL\]' $pdir/$package.desc
; then
101 delpattern
="`egrep '^\[CV-DEL\]' \
102 $pdir/$package.desc | head -n 1 | \
103 cut -s -f2- -d' ' | tr -s ' '`"
106 echo -e "\n** `echo $x | cut -f3 -d' '`\n"
107 echo "package='$package' pattern='$pattern'"
108 echo -e "url='$url'\ndelpattern='$delpattern'"
111 curl
$curl_options -s "$url" | \
112 tee checkver
/debug
.1 | \
113 tr "\r\t\"'<>= /" '\n\n\n\n\n\n\n\n\n' | \
114 tee checkver
/debug
.2 | \
115 perl
-e "while (<>) { chomp;
116 \$fn=\$_; next unless /$pattern/;
117 foreach \$x (qw/$delpattern/) { s/\$x//g; }
118 print \"\$_\t\$fn\\n\" if \$_ ne ''; }" | \
119 tee checkver
/debug
.3 | \
127 next unless /(\S+)\s+(\S+)/;
129 s/(\d+)/sprintf("%020d", $1)/eg;
130 # print "$_:$a:$b\n";
131 if (not defined $x{$_}) {
138 foreach (reverse sort keys %x) {
140 }' |
tee checkver
/$package.new | \
142 if [ ! -f checkver
/$package.txt
] ||
143 ! grep -qx "$line" checkver
/$package.txt
145 echo " * $line" |
expand -t20
147 echo " $line" |
expand -t20
151 } > checkver
/$package.msg
153 if ! [ -s checkver
/$package.new
] ; then
154 echo "Got no list for package $package!" \
155 >> checkver
/$package.msg
156 cat checkver
/$package.msg
; echo
158 if grep -q '^ \* ' checkver
/$package.msg
159 then cat checkver
/$package.msg
; echo
160 else rm checkver
/$package.msg
; fi
163 if [ -f checkver
/$package.msg
] ; then
164 echo >> checkver
/$package.msg
168 echo "ERROR: Package $package not found!"