From: Ansgar Burchardt Date: Mon, 5 Dec 2011 22:03:31 +0000 (+0100) Subject: Regenerate i18n/Index before generate-release. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1b9fb11b2adefa328f8ea41c59b835e148c6f8e;p=dak Regenerate i18n/Index before generate-release. We need to regenerate i18n/Index as generate-packages-sources2 writes Translation-en. In the future we might get rid of it entirely. --- diff --git a/config/debian/dinstall.functions b/config/debian/dinstall.functions index 830a4c20..2981c8c3 100644 --- a/config/debian/dinstall.functions +++ b/config/debian/dinstall.functions @@ -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 diff --git a/scripts/debian/ddtp-i18n-check.sh b/scripts/debian/ddtp-i18n-check.sh index 8f5c6c08..74494ad5 100755 --- a/scripts/debian/ddtp-i18n-check.sh +++ b/scripts/debian/ddtp-i18n-check.sh @@ -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 index 00000000..d0a7089b --- /dev/null +++ b/scripts/debian/generate-i18n-Index @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Copyright (C) 2011, Ansgar Burchardt +# +# 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 " >&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