[Debian-l10n-commits] r1193 - in /ddtp-dinstall/trunk: Changelog checks/ddtp_i18n_check.sh

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Wed Aug 13 02:24:53 UTC 2008


Author: nekral-guest
Date: Wed Aug 13 02:24:52 2008
New Revision: 1193

URL: http://svn.debian.org/wsvn/?sc=1&rev=1193
Log:
	* checks/ddtp_i18n_check.sh: Added support for the--dry-run option
	(do not generate the compressed files).
	* checks/ddtp_i18n_check.sh: Added option --debugto set the DEBUG
	variable.

Modified:
    ddtp-dinstall/trunk/Changelog
    ddtp-dinstall/trunk/checks/ddtp_i18n_check.sh

Modified: ddtp-dinstall/trunk/Changelog
URL: http://svn.debian.org/wsvn/ddtp-dinstall/trunk/Changelog?rev=1193&op=diff
==============================================================================
--- ddtp-dinstall/trunk/Changelog (original)
+++ ddtp-dinstall/trunk/Changelog Wed Aug 13 02:24:52 2008
@@ -1,3 +1,10 @@
+2008-08-12  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* checks/ddtp_i18n_check.sh: Added support for the--dry-run option
+	(do not generate the compressed files).
+	* checks/ddtp_i18n_check.sh: Added option --debugto set the DEBUG
+	variable.
+
 2008-08-12  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* tests/testsuite/bad.pkgs/no-code-name,

Modified: ddtp-dinstall/trunk/checks/ddtp_i18n_check.sh
URL: http://svn.debian.org/wsvn/ddtp-dinstall/trunk/checks/ddtp_i18n_check.sh?rev=1193&op=diff
==============================================================================
--- ddtp-dinstall/trunk/checks/ddtp_i18n_check.sh (original)
+++ ddtp-dinstall/trunk/checks/ddtp_i18n_check.sh Wed Aug 13 02:24:52 2008
@@ -16,11 +16,68 @@
 set -eu
 export LC_ALL=C
 
-# This must be defined to either 0 or 1
 # When DEBUG=0, fail after the first error.
 # Otherwise, list all the errors.
 DEBUG=0
 
+# When DRY_RUN=0, generate the compressed version of the Translation-*
+# files.
+DRY_RUN=0
+
+dists_parent_dir=""
+# If no argument indicates the PACKAGES_LISTS_DIR then use '.'
+PACKAGES_LISTS_DIR="."
+
+usage () {
+	echo "Usage: $0 [options] <dists_parent_dir> [<packages_lists_directory>]" >&2
+	echo "" >&2
+	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
+	exit 1
+}
+
+# Parse options
+for opt; do
+	case "$opt" in
+		"--debug")
+			DEBUG=1
+			;;
+		"--dry-run")
+			DRY_RUN=1
+			;;
+		"-*")
+			usage
+			;;
+		"")
+			echo "Empty parameter" >&2
+			echo "" >&2
+			usage
+			;;
+		*)
+			if [ -z "$dists_parent_dir" ]; then
+				# Removing trailing /
+				dists_parent_dir=${opt%/}
+			elif [ -z "$PACKAGES_LISTS_DIR" ]; then
+				PACKAGES_LISTS_DIR=$opt
+			else
+				echo "$0: Invalid option: $opt" >&2
+				usage
+			fi
+			;;
+	esac
+done
+
+if [ ! -d "$dists_parent_dir" ]; then
+	echo "missing dists_parent_dir, or not a directory" >&2
+	echo "" >&2
+	usage
+elif [ ! -d "$PACKAGES_LISTS_DIR" ]; then
+	echo "missing packages_lists_directory, or not a directory" >&2
+	echo "" >&2
+	usage
+fi
+
 #STABLE="etch"
 TESTING="lenny"
 UNSTABLE="sid"
@@ -33,16 +90,6 @@
 
 # These special files must exist on the top of dists_parent_dir
 SPECIAL_FILES="$SHA256SUMS $TIMESTAMP $TIMESTAMP.gpg"
-
-usage () {
-	echo "Usage: $0 <dists_parent_dir> [<packages_lists_directory>]" >&2
-	exit 1
-}
-
-if [ "$#" -lt 1 ] || [ "$#" -gt 2 ] || [ ! -d $1 ]
-then
-	usage
-fi
 
 # Temporary working directory. We need a full path to reduce the
 # complexity of checking SHA256SUMS and cleaning/removing TMPDIR
@@ -52,24 +99,13 @@
 cd "$OLDPWD"
 unset TEMP_WORK_DIR
 
-# If it's traped, something bad happened.
+# If it's trapped, something bad happened.
 trap_exit () {
 	rm -rf "$TMP_WORK_DIR"
 	rm -f "$dists_parent_dir"/dists/*/main/i18n/Translation-*.{bz2,gz}
 	exit 1
 }
 trap trap_exit EXIT HUP INT QUIT TERM
-
-# If no argument indicates the PACKAGES_LISTS_DIR then use '.'
-PACKAGES_LISTS_DIR=${2:-.}
-
-if [ ! -d "$PACKAGES_LISTS_DIR" ]
-then
-	usage
-fi
-
-# Removing trailing /
-dists_parent_dir=${1%/}
 
 is_filename_okay () {
 	ifo_file="$1"
@@ -351,10 +387,11 @@
 		# We do not check if the md5 in Translation-$lang are
 		# correct.
 
-		# Now generate files
-		#   Compress the file
-		bzip2 -c "$f" > "$f.bz2"
-		gzip  -c "$f" > "$f.gz"
+		if [ "$DRY_RUN" = "0" ]; then
+			# Now generate the compressed files
+			bzip2 -c "$f" > "$f.bz2"
+			gzip  -c "$f" > "$f.gz"
+		fi
 	else
 		echo "Neither a file or directory: $f" >&2
 		exit 1




More information about the Debian-l10n-commits mailing list