]> git.decadent.org.uk Git - dak.git/commitdiff
Regenerate i18n/Index before generate-release.
authorAnsgar Burchardt <ansgar@debian.org>
Mon, 5 Dec 2011 22:03:31 +0000 (23:03 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Mon, 5 Dec 2011 22:14:30 +0000 (23:14 +0100)
We need to regenerate i18n/Index as generate-packages-sources2 writes
Translation-en.  In the future we might get rid of it entirely.

config/debian/dinstall.functions
scripts/debian/ddtp-i18n-check.sh
scripts/debian/generate-i18n-Index [new file with mode: 0755]

index 830a4c207f827913c1831289242a479cfbdc5eea..2981c8c303d513bc223a2ff7d21c68ae00f1c58e 100644 (file)
@@ -183,6 +183,10 @@ function pdiff() {
 }
 
 function release() {
+    # XXX: disable once we can remove i18n/Index (#649314)
+    log "Generating i18n/Index"
+    (cd "$ftpdir/dists"; for dist in testing unstable; do $scriptsdir/generate-i18n-Index $dist; done)
+    (cd "$webdir/newdists/dists"; for dist in testing unstable; do $scriptsdir/generate-i18n-Index $dist; done)
     log "Generating Release files"
     dak generate-releases
     # XXX: disable again later
index 8f5c6c08ffc746bf2d924dbd285f5bcd06547526..74494ad5c054178e95a584f4fe73472bd65491ed 100755 (executable)
@@ -25,10 +25,6 @@ DEBUG=0
 # files.
 DRY_RUN=0
 
-# When GEN_IDX=1, we create the Index files.  There is a runtime option
-# to not create/generate the Index file.
-GEN_IDX=1
-
 dists_parent_dir=""
 # If no argument indicates the PACKAGES_LISTS_DIR then use '.'
 PACKAGES_LISTS_DIR=""
@@ -39,7 +35,6 @@ usage () {
        echo "    --debug      Debug mode: do not stop after the first error" >&2
        echo "    --dry-run    Do not generate the compressed version of the " >&2
        echo "                 Translation files">&2
-       echo "    --no-index   Do not generate the Index files" >&2
        exit 1
 }
 
@@ -52,9 +47,6 @@ for opt; do
                "--dry-run")
                        DRY_RUN=1
                        ;;
-               "--no-index")
-                       GEN_IDX=0
-                       ;;
                "-*")
                        usage
                        ;;
@@ -355,14 +347,6 @@ while read f; do
                if ! is_dirname_okay "$f"; then
                        echo "Wrong directory name: $f" >&2
                        exit 1
-               else
-                       # If the directory name is OK, and if it's name is i18n
-                       # and GEN_IDX is enabled, we generate the header of the
-                       # Index file
-                       if [ "$(basename $f)" = "i18n" -a "$GEN_IDX" = "1" ];
-                       then
-                               echo "SHA1:" > "$f/Index"
-                       fi
                fi
        elif [ -f "$f" ]; then
                # If $f is in $SPECIAL_FILES, we skip to the next loop because
@@ -410,17 +394,6 @@ while read f; do
                        # Now generate the compressed files
                        bzip2 "$f"
                fi
-
-               # Create Index
-               if [ "$GEN_IDX" = "1" ]; then
-                       fbz=${f}.bz2
-                       IDX=$(dirname $f)
-                       tf_name=$(basename $fbz)
-                       tf_sha1=$(sha1sum $fbz)
-                       tf_size=$(du --bytes $fbz)
-                       printf ' %s % 7s %s\n' "${tf_sha1% *}" \
-                               "${tf_size%     *}" "${tf_name}" >> "$IDX/Index"
-               fi
        else
                echo "Neither a file or directory: $f" >&2
                exit 1
diff --git a/scripts/debian/generate-i18n-Index b/scripts/debian/generate-i18n-Index
new file mode 100755 (executable)
index 0000000..d0a7089
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Copyright (C) 2011, Ansgar Burchardt <ansgar@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# On Debian systems, you can find the full text of the license in
+# /usr/share/common-licenses/GPL-2
+
+set -eu
+export LC_ALL=C
+
+usage () {
+       echo "Usage: $0 <dist-directory>" >&2
+       exit 1
+}
+
+# Parse options
+if [ $# != 1 ] ; then
+       usage
+fi
+if [ ! -d "$1" ] ; then
+       echo "$1 does not exist or is not a directory." >&2
+       usage
+fi
+if [ ! -d "$1"/main/i18n ] ; then
+       echo "No main/i18n directory in $1." >&2
+       usage
+fi
+cd "$1/main/i18n"
+
+# If it's trapped, something bad happened.
+trap_exit () {
+       rm -f Index
+       exit 1
+}
+trap trap_exit EXIT HUP INT QUIT TERM
+
+exec 3>Index
+
+echo "SHA1:" >&3
+for file in Translation-* ; do
+       sha=$(sha1sum "$file"); sha="${sha%% *}"
+       size=$(du --bytes "$file"); size="${size%%[^0-9]*}"
+       printf ' %s % 7s %s\n' "$sha" "$size" "$file" >&3
+done
+
+exec 3>&-
+
+trap - EXIT