diff options
author | Jim Meyering <jim@meyering.net> | 2007-08-31 22:17:53 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-08-31 22:18:01 +0200 |
commit | 89907ec099edf633f42c00516ac5963f737a9b69 (patch) | |
tree | 12768bb24ee84ef4ab906a27ce7098ed94cceba7 | |
parent | 42a4957361cee5e3d5f8772daca0dddebc3162dc (diff) | |
download | coreutils-89907ec099edf633f42c00516ac5963f737a9b69.tar.xz |
Solve the unnecessary-.po-file-regeneration problem once and for all.
* bootstrap (download_po_files): New function, renamed from
get_translations. Now, downloads, but doesn't update LINGUAS.
(update_po_files): New function.
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | bootstrap | 38 |
2 files changed, 39 insertions, 6 deletions
@@ -1,3 +1,10 @@ +2007-08-31 Jim Meyering <jim@meyering.net> + + Solve the unnecessary-.po-file-regeneration problem once and for all. + * bootstrap (download_po_files): New function, renamed from + get_translations. Now, downloads, but doesn't update LINGUAS. + (update_po_files): New function. + 2007-08-30 Jim Meyering <jim@meyering.net> Shorten the snapshot version string by removing the "g". @@ -252,7 +252,7 @@ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool # Get translations. -get_translations() { +download_po_files() { subdir=$1 domain=$2 @@ -265,9 +265,35 @@ get_translations() { (cd $subdir && rm -f dummy `ls | sed -n '/\.po/p'` && $WGET_COMMAND -r -l1 -nd -np -A.po $TP_URL/$domain) ;; - esac && - ls "$subdir"/*.po 2>/dev/null | - sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" + esac +} + +# Download .po files to $po_dir/.reference and copy only the new +# or modified ones into $po_dir. Also update $po_dir/LINGUAS. +update_po_files() { + # Directory containing primary .po files. + # Overwrite them only when we're sure a .po file is new. + po_dir=$1 + domain=$2 + + # Download *.po files into this dir. + # Usually contains *.s1 checksum files. + ref_po_dir="$po_dir/.reference" + + test -d $ref_po_dir || mkdir $ref_po_dir || return + download_po_files $ref_po_dir $domain \ + && ls "$ref_po_dir"/*.po 2>/dev/null | + sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" + + for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do + new_po="$ref_po_dir/$po.po" + cksum_file="$ref_po_dir/$po.s1" + if ! sha1sum -c "$cksum_file" < "$new_po" > /dev/null; then + echo "updated $po_dir/$po.po..." + cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file" + fi + rm -f "$new_po" + done } case $SKIP_PO in @@ -284,11 +310,11 @@ case $SKIP_PO in esac if test -d po; then - get_translations po $package || exit + update_po_files po $package || exit fi if test -d runtime-po; then - get_translations runtime-po $package-runtime || exit + update_po_files runtime-po $package-runtime || exit fi;; esac |