[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r19944: {} added a new folder for old code (in translation/trunk/tools/gsoc09: . other)



Author: runa
Date: 2009-07-08 09:36:39 -0400 (Wed, 08 Jul 2009)
New Revision: 19944

Added:
   translation/trunk/tools/gsoc09/other/
   translation/trunk/tools/gsoc09/other/new-and-updated-wml
   translation/trunk/tools/gsoc09/other/new-wml
   translation/trunk/tools/gsoc09/other/updated-po
   translation/trunk/tools/gsoc09/other/updated-wml
Log:
added a new folder for old code

Added: translation/trunk/tools/gsoc09/other/new-and-updated-wml
===================================================================
--- translation/trunk/tools/gsoc09/other/new-and-updated-wml	                        (rev 0)
+++ translation/trunk/tools/gsoc09/other/new-and-updated-wml	2009-07-08 13:36:39 UTC (rev 19944)
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+# PRE-COMMIT HOOK
+#
+# The pre-commit hook is invoked before a Subversion txn is
+# committed.  Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-commit' (for which
+# this file is a template), with the following ordered arguments:
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] TXN-NAME     (the name of the txn about to be committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the txn is committed; but
+# if it exits with failure (non-zero), the txn is aborted, no commit
+# takes place, and STDERR is returned to the client.   The hook
+# program can use the 'svnlook' utility to help it examine the txn.
+#
+# On a Unix system, the normal procedure is to have 'pre-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
+#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
+#
+#   This is why we recommend using the read-only 'svnlook' utility.
+#   In the future, Subversion may enforce the rule that pre-commit
+#   hooks should not modify the versioned data in txns, or else come
+#   up with a mechanism to make it safe to do so (by informing the
+#   committing client of the changes).  However, right now neither
+#   mechanism is implemented, so hook writers just have to be careful.
+#
+# Note that 'pre-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-commit.bat' or 'pre-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process.  For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+# 
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# the Subversion repository at
+# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
+# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
+
+# This hook will take the new and updated wml files and update the po files
+
+REPOS="$1"
+REV="$2"
+
+# a few variables
+SVNLOOK="/usr/bin/svnlook"
+SVN="/usr/bin/svn"
+AWK="/usr/bin/awk"
+GREP="/bin/egrep"
+SED="/bin/sed"
+LS="/bin/ls"
+RM="/bin/rm"
+PO4A="/usr/bin/po4a-updatepo"
+# Where you have the po files
+PATH="/home/runa/svn-test/result/po"
+# Where the repository  is
+WML="/home/runa/svn-test/repo"
+
+# List the files being modified in this commit
+# Also include files being added in this commit
+NEW=`$SVNLOOK changed -r "$REV" "$REPOS" | $GREP "^[U|A]" | $AWK '{print $2}' | $GREP en/*.wml$`
+
+# For every modified wml file in this commit - convert back to wml
+for FILE in $NEW ; do
+	cd $PATH
+	PO=${FILE%%.*}
+	# Make sure the po file exists in every language directory
+	for dir in $($LS -d */ | $GREP -v ^templates/$) ; do
+		cd $dir
+
+		# Convert the files
+		$PO4A -f wml -m "$WML/$FILE" -p "$PO.po" --master-charset utf-8
+
+		# Set the right encoding and charset
+		$SED -i '1,/CHARSET/ s/CHARSET/UTF-8/' "$PO.po" ;
+		$SED -i '1,/ENCODING/ s/ENCODING/8bit/' "$PO.po" ;
+
+		# Delete the swap
+		$RM "$PO.po~"	
+		
+		# CD back to the old directory
+		cd $PATH
+	done
+done
+
+# All checks passed, so allow the commit.
+exit 0


Property changes on: translation/trunk/tools/gsoc09/other/new-and-updated-wml
___________________________________________________________________
Added: svn:executable
   + *

Added: translation/trunk/tools/gsoc09/other/new-wml
===================================================================
--- translation/trunk/tools/gsoc09/other/new-wml	                        (rev 0)
+++ translation/trunk/tools/gsoc09/other/new-wml	2009-07-08 13:36:39 UTC (rev 19944)
@@ -0,0 +1,113 @@
+#!/bin/sh
+
+# PRE-COMMIT HOOK
+#
+# The pre-commit hook is invoked before a Subversion txn is
+# committed.  Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-commit' (for which
+# this file is a template), with the following ordered arguments:
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] TXN-NAME     (the name of the txn about to be committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the txn is committed; but
+# if it exits with failure (non-zero), the txn is aborted, no commit
+# takes place, and STDERR is returned to the client.   The hook
+# program can use the 'svnlook' utility to help it examine the txn.
+#
+# On a Unix system, the normal procedure is to have 'pre-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
+#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
+#
+#   This is why we recommend using the read-only 'svnlook' utility.
+#   In the future, Subversion may enforce the rule that pre-commit
+#   hooks should not modify the versioned data in txns, or else come
+#   up with a mechanism to make it safe to do so (by informing the
+#   committing client of the changes).  However, right now neither
+#   mechanism is implemented, so hook writers just have to be careful.
+#
+# Note that 'pre-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-commit.bat' or 'pre-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process.  For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+# 
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# the Subversion repository at
+# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
+# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
+
+
+# This is a pre-commit hook that will convert new wml files to po files
+
+### TODO ###
+#
+# 0. clean up this code
+# 1. Make sure that only wml files commited to en/ will be processed (?)
+# 2. Do we really need a hook for a new wml? The updated-wml-hook can
+# take care of this for us.
+#
+
+REPOS="$1"
+TXN="$2"
+
+# a few variables
+SVNLOOK="/usr/bin/svnlook"
+SVN="/usr/bin/svn"
+AWK="/usr/bin/awk"
+GREP="/bin/egrep"
+SED="/bin/sed"
+LS="/bin/ls"
+CP="/bin/cp"
+MV="/bin/mv"
+PO4A="/usr/bin/po4a-gettextize"
+# Where you want the resulting po files to be
+PATH="/home/runa/svn-test/result/po"
+
+# List the files being added in this commit
+NEW=`$SVNLOOK changed -t "$TXN" "$REPOS" | $GREP "^[A]" | $AWK '{print $2}' | $GREP \\.wml$`
+
+# For every new file in this commit - convert it
+for FILE in $NEW
+do
+	$PO4A -f wml -m "$FILE" -p "$PATH/en/$FILE.po" --master-charset utf-8
+	
+	# Make sure that the new po file is copied to all the other
+	# language directories, but stay out of en/ and templates/
+	cd "$PATH"
+	for dir in $($LS -d */ | $GREP -v ^en/$ | $GREP -v ^templates/$) ; do 
+		$CP en/*.wml.po "$dir" ;
+	done
+	
+	# Set the right charset and encoding, as well as rename the file
+	# to .po and add it to the repository
+	for dir in $($LS -d */) ; do
+		cd $dir
+		for FILE in *.wml.po ; do
+			$SED -i '1,/CHARSET/ s/CHARSET/UTF-8/' $FILE ;
+			$SED -i '1,/ENCODING/ s/ENCODING/8bit/' $FILE ;
+			$MV $FILE `echo $FILE | $SED 's/\(.*\.\)wml.po/\1po/'` ;
+			$SVN add $FILE ;
+		done
+		cd "$OLDPWD"
+	done
+done
+
+# All checks passed, so allow the commit.
+exit 0


Property changes on: translation/trunk/tools/gsoc09/other/new-wml
___________________________________________________________________
Added: svn:executable
   + *

Added: translation/trunk/tools/gsoc09/other/updated-po
===================================================================
--- translation/trunk/tools/gsoc09/other/updated-po	                        (rev 0)
+++ translation/trunk/tools/gsoc09/other/updated-po	2009-07-08 13:36:39 UTC (rev 19944)
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# PRE-COMMIT HOOK
+#
+# The pre-commit hook is invoked before a Subversion txn is
+# committed.  Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-commit' (for which
+# this file is a template), with the following ordered arguments:
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] TXN-NAME     (the name of the txn about to be committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the txn is committed; but
+# if it exits with failure (non-zero), the txn is aborted, no commit
+# takes place, and STDERR is returned to the client.   The hook
+# program can use the 'svnlook' utility to help it examine the txn.
+#
+# On a Unix system, the normal procedure is to have 'pre-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
+#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
+#
+#   This is why we recommend using the read-only 'svnlook' utility.
+#   In the future, Subversion may enforce the rule that pre-commit
+#   hooks should not modify the versioned data in txns, or else come
+#   up with a mechanism to make it safe to do so (by informing the
+#   committing client of the changes).  However, right now neither
+#   mechanism is implemented, so hook writers just have to be careful.
+#
+# Note that 'pre-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-commit.bat' or 'pre-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process.  For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+# 
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# the Subversion repository at
+# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
+# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
+
+# This hook will take the updated po file and convert back to wml
+
+### TODO ###
+# 0. Clean up the code
+# 1. Make sure you have the right path for the file, 
+# i.e en/foo.wml -> en/foo.po
+#
+
+REPOS="$1"
+TXN="$2"
+
+# a few variables
+SVNLOOK="/usr/bin/svnlook"
+SVN="/usr/bin/svn"
+AWK="/usr/bin/awk"
+GREP="/bin/egrep"
+SED="/bin/sed"
+LS="/bin/ls"
+CP="/bin/cp"
+MV="/bin/mv"
+ECHO="/bin/echo"
+PO4A="/usr/bin/po4a-translate"
+# Where you have the po files
+PATH="/home/runa/svn-test/result/wml/en"
+PODIR="/home/runa/svn-test/repo"
+
+# List the files being modified in this commit
+NEW=`$SVNLOOK changed -t "$TXN" "$REPOS" | $GREP "^[U]" | $AWK '{print $2}' | $GREP \\.po$`
+
+# For every modified po file in this commit - convert back to wml
+for FILE in $NEW ; do
+	cd $PATH
+	WML=${FILE%%.*}
+	$PO4A -f wml -m "$WML.wml" -p "$PODIR/$FILE" -l "$WML.wml" -L utf-8 --master-charset utf-8
+done
+
+# All checks passed, so allow the commit.
+exit 0


Property changes on: translation/trunk/tools/gsoc09/other/updated-po
___________________________________________________________________
Added: svn:executable
   + *

Added: translation/trunk/tools/gsoc09/other/updated-wml
===================================================================
--- translation/trunk/tools/gsoc09/other/updated-wml	                        (rev 0)
+++ translation/trunk/tools/gsoc09/other/updated-wml	2009-07-08 13:36:39 UTC (rev 19944)
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+# PRE-COMMIT HOOK
+#
+# The pre-commit hook is invoked before a Subversion txn is
+# committed.  Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-commit' (for which
+# this file is a template), with the following ordered arguments:
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] TXN-NAME     (the name of the txn about to be committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the txn is committed; but
+# if it exits with failure (non-zero), the txn is aborted, no commit
+# takes place, and STDERR is returned to the client.   The hook
+# program can use the 'svnlook' utility to help it examine the txn.
+#
+# On a Unix system, the normal procedure is to have 'pre-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
+#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
+#
+#   This is why we recommend using the read-only 'svnlook' utility.
+#   In the future, Subversion may enforce the rule that pre-commit
+#   hooks should not modify the versioned data in txns, or else come
+#   up with a mechanism to make it safe to do so (by informing the
+#   committing client of the changes).  However, right now neither
+#   mechanism is implemented, so hook writers just have to be careful.
+#
+# Note that 'pre-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-commit.bat' or 'pre-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process.  For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+# 
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# the Subversion repository at
+# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
+# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
+
+# This hook will take the updated wml file and update the po files
+
+### TODO ###
+# 0. Clean up code
+# 1. Rewrite the code to include added files:
+#	- set the right encoding and charset
+#	- we don't need the hook for a new wml, do we?
+#
+
+REPOS="$1"
+TXN="$2"
+
+# a few variables
+SVNLOOK="/usr/bin/svnlook"
+SVN="/usr/bin/svn"
+AWK="/usr/bin/awk"
+GREP="/bin/egrep"
+SED="/bin/sed"
+LS="/bin/ls"
+CP="/bin/cp"
+MV="/bin/mv"
+ECHO="/bin/echo"
+PO4A="/usr/bin/po4a-updatepo"
+# Where you have the po files
+PATH="/home/runa/svn-test/result/po"
+WML="/home/runa/svn-test/repo"
+
+# List the files being modified in this commit
+# Also include files being added in this commit
+NEW=`$SVNLOOK changed -t "$TXN" "$REPOS" | $GREP "^[U|A]" | $AWK '{print $2}' | $GREP \\.wml$`
+
+# For every modified wml file in this commit - convert back to wml
+for FILE in $NEW ; do
+	cd $PATH
+	PO=${FILE%%.*}
+	for dir in $($LS -d */ | $GREP -v ^templates/$) ; do
+		cd $dir
+		$PO4A -f wml -m "$WML/$FILE" -p "$PO.po" --master-charset utf-8
+		cd $PATH
+	done
+done
+
+# All checks passed, so allow the commit.
+exit 0


Property changes on: translation/trunk/tools/gsoc09/other/updated-wml
___________________________________________________________________
Added: svn:executable
   + *