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 2, or (at your option)
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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 # Written by James Youngman.
23 URLBASE
="http://www.iro.umontreal.ca/translation/maint"
27 echo "You need to specify the package name and a destination directory on the command line." >&2
47 debug
"update_required: Checking $@"
51 major_new
=$
(echo $vnew | cut
-s -d.
-f1)
52 major_existing
=$
(echo $vexisting | cut
-s -d.
-f1)
53 if [ -z "$major_new" ]; then
54 debug
"New version number empty, update not needed"
56 elif [ -z "$major_existing" ]; then
57 debug
"Existing version number empty, update is needed"
59 elif [ $major_new -gt $major_existing ]; then
60 debug
"$vnew > $vexisting, update needed"
62 elif [ $major_new -lt $major_existing ]; then
63 debug
"$vnew < $vexisting, update NOT needed"
67 $
(echo $vnew | cut
-s -d.
-f2-) \
68 $
(echo $vexisting | cut
-s -d.
-f2-)
73 # Determine if an update is neeededon the basis of the version numbers.
76 grep "^PO-Revision-Date: " |
77 sed -e 's/PO-Revision-Date: //' -e 's/\\n$//' |
78 LANG
=C
sort -c >/dev
/null
84 grep Project-Id-Version
: < "$1" |
86 sed -e 's/^.*'$PACKAGE' //' -e 's/\\n$//'
91 if vnew
=$
(getversion
"$1"); then
92 if vexisting
=$
(getversion
"$2"); then
93 if v_update_needed
"$vnew" "$vexisting"; then
96 d_update_needed
"$2" "$1" && \
97 info
"Timestamp fields indicate $1 is newer than $2"
111 # ls -ltrd "$new" "$existing"
113 if ! [ -e "$existing" ] ; then
114 debug
"$existing does not exist, using $new"
116 elif cmp $new $existing >/dev
/null
2>&1; then
117 info
"$new and $existing are identical"
119 elif check_versions
"$new" "$existing"; then
120 info
"Fetched file has newer version number or date stamp"
130 debug
"Possible update of $3/$1"
135 if update_required
$new $existing; then
136 info
"Updating $1..."
147 potfile
=$DESTDIR/$PACKAGE.pot
148 if [ -f $potfile ] ; then
151 echo "$potfile is not present. Did you specify the right command line?" >&2
158 printf "Fetching .po files..."
159 wget
--quiet --recursive --directory-prefix="$tmpdir" --level=1 --accept "*.po" --no-directories "$URLBASE"/"$PACKAGE"
161 # cp /tmp/po-updates/$PACKAGE/*.po "$tmpdir"
162 # touch "$tmpdir"/*.po
164 for f
in $
(cd $tmpdir && ls *.po
); do
165 possible_update
"$f" "$tmpdir" "$DESTDIR"
173 # update_needed 4.1.5 4.1.5
174 # update_needed 4.1.15 4.1.5
175 # update_needed 5.0 4.1.5
176 # update_needed 4.2.6 5.0