3 # fetch-po-files -- fetches the .po files from the Translation Project website
4 # Copyright (C) 2005 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Written by James Youngman.
21 URLBASE
="http://www.iro.umontreal.ca/translation/maint"
25 echo "You need to specify the package name and a destination directory on the command line." >&2
45 debug
"update_required: Checking $@"
49 major_new
=$
(echo $vnew | cut
-s -d.
-f1)
50 major_existing
=$
(echo $vexisting | cut
-s -d.
-f1)
51 if [ -z "$major_new" ]; then
52 debug
"New version number empty, update not needed"
54 elif [ -z "$major_existing" ]; then
55 debug
"Existing version number empty, update is needed"
57 elif [ $major_new -gt $major_existing ]; then
58 debug
"$vnew > $vexisting, update needed"
60 elif [ $major_new -lt $major_existing ]; then
61 debug
"$vnew < $vexisting, update NOT needed"
65 $
(echo $vnew | cut
-s -d.
-f2-) \
66 $
(echo $vexisting | cut
-s -d.
-f2-)
71 # Determine if an update is neeededon the basis of the version numbers.
74 grep "^PO-Revision-Date: " |
75 sed -e 's/PO-Revision-Date: //' -e 's/\\n$//' |
76 LANG
=C
sort -c >/dev
/null
82 grep Project-Id-Version
: < "$1" |
84 sed -e 's/^.*'$PACKAGE' //' -e 's/\\n$//'
89 if vnew
=$
(getversion
"$1"); then
90 if vexisting
=$
(getversion
"$2"); then
91 if v_update_needed
"$vnew" "$vexisting"; then
94 d_update_needed
"$2" "$1" && \
95 info
"Timestamp fields indicate $1 is newer than $2"
109 # ls -ltrd "$new" "$existing"
111 if ! [ -e "$existing" ] ; then
112 debug
"$existing does not exist, using $new"
114 elif cmp $new $existing >/dev
/null
2>&1; then
115 info
"$new and $existing are identical"
117 elif check_versions
"$new" "$existing"; then
118 info
"Fetched file has newer version number or date stamp"
128 debug
"Possible update of $3/$1"
133 if update_required
$new $existing; then
134 info
"Updating $1..."
145 potfile
=$DESTDIR/$PACKAGE.pot
146 if [ -f $potfile ] ; then
149 echo "$potfile is not present. Did you specify the right command line?" >&2
156 printf "Fetching .po files..."
157 wget
--quiet --recursive --directory-prefix="$tmpdir" --level=1 --accept "*.po" --no-directories "$URLBASE"/"$PACKAGE"
159 # cp /tmp/po-updates/$PACKAGE/*.po "$tmpdir"
160 # touch "$tmpdir"/*.po
162 for f
in $
(cd $tmpdir && ls *.po
); do
163 possible_update
"$f" "$tmpdir" "$DESTDIR"
171 # update_needed 4.1.5 4.1.5
172 # update_needed 4.1.15 4.1.5
173 # update_needed 5.0 4.1.5
174 # update_needed 4.2.6 5.0