summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 27f3a94)
raw | patch | inline | side by side (parent: 27f3a94)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Dec 2007 11:29:50 +0000 (11:29 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Dec 2007 11:29:50 +0000 (11:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8098 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/update-gosa | [new file with mode: 0755] | patch | blob |
gosa-core/update-locale | [new file with mode: 0755] | patch | blob |
gosa-core/update-online-help | [new file with mode: 0755] | patch | blob |
gosa-core/update-pdf-help | [new file with mode: 0755] | patch | blob |
update-gosa | [deleted file] | patch | blob | history |
update-locale | [deleted file] | patch | blob | history |
update-online-help | [deleted file] | patch | blob | history |
update-pdf-help | [deleted file] | patch | blob | history |
diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa
--- /dev/null
+++ b/gosa-core/update-gosa
@@ -0,0 +1,81 @@
+#!/usr/bin/php5
+<?php
+
+/* Function to include all class_ files starting at a given directory base */
+function get_classes($folder= ".")
+{
+ static $base_dir= "";
+ static $result= array();
+
+ if ($base_dir == ""){
+ $base_dir= getcwd();
+ }
+
+ $currdir=getcwd();
+ if ($folder){
+ chdir("$folder");
+ }
+
+ $dh = opendir(".");
+ while(false !== ($file = readdir($dh))){
+
+ if (preg_match("/.*\.svn.*/", $file) ||
+ preg_match("/.*smarty.*/i",$file) ||
+ preg_match("/.*\.tpl.*/",$file) ||
+ ($file==".") ||($file =="..")){
+ continue;
+ }
+
+ /* Recurse through all "common" directories */
+ if (is_dir($file)){
+ get_classes($file);
+ continue;
+ }
+
+ /* Only take care about .inc and .php files... */
+ if (!(preg_match('/\.php$/', $file) || preg_match('/\.inc$/', $file))){
+ continue;
+ }
+
+ /* Include existing class_ files */
+ $contents= file($file);
+ foreach($contents as $line){
+ $line= chop($line);
+ if (preg_match('/^\s*class\s*\w.*$/', $line)){
+ $class= preg_replace('/^\s*class\s*(\w+).*$/', '\1', $line);
+ $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");
+ }
+ }
+ }
+
+ closedir($dh);
+ chdir($currdir);
+
+ return ($result);
+}
+
+$class_mapping= get_classes();
+$filename= "include/class_location.inc";
+
+/* Sanity checks */
+if (is_writable($filename)) {
+
+ if (!$handle= fopen($filename, 'w')) {
+ echo "Cannot open file \"$filename\" - aborted\n";
+ exit (1);
+ }
+
+} else {
+ echo "File \"$filename\" is not writable - aborted\n";
+ exit (2);
+}
+
+fwrite ($handle, "<?php\n\$class_mapping= array(\n");
+foreach ($class_mapping as $key => $value){
+ fwrite ($handle, " \"$key\" => \"$value\",\n");
+}
+fwrite ($handle, " );\n?>");
+
+fclose($handle);
+
+?>
diff --git a/gosa-core/update-locale b/gosa-core/update-locale
--- /dev/null
+++ b/gosa-core/update-locale
@@ -0,0 +1,172 @@
+#!/bin/sh
+
+generate_po() {
+ ORIG=`pwd`
+ TEMPDIR="/tmp/gosa-locale"
+ TRUE=`which true`
+
+ echo
+ echo "Creating temporary directory..."
+ [ -d $TEMPDIR ] && rm -rf $TEMPDIR
+ mkdir $TEMPDIR
+
+ echo "Creating copy of GOsa..."
+ tar c . | tar x -C $TEMPDIR
+
+ echo "Converting .tpl files..."
+ pushd . &> /dev/null
+ cd $TEMPDIR
+
+ for template in $(find . -name '*.tpl'); do
+ echo "* converting .tpl files: $(basename $template)"
+ sed -e 's/{t}/<?php $t= _("/g;s!{/t}!");?>!g' $template > $template.new
+ mv $template.new $template
+ done
+
+ for class in $(find . -name 'class_*.inc'); do
+ echo "* converting class_*.inc files: $(basename $class)"
+ sed -e 's/\($pl[DH][^=]*\)= *"\([^"]*\)";$/\1= _("\2");/g' $class > $class.new
+ mv $class.new $class
+ done
+
+ echo "* converting strings from gosa.conf"
+ sed -e 's/headline="\([^"]*\)"/<?php $headline=_("\1");?>/g;s/name="\([^"]*\)"/<?php $t= _("\1");?>/g' contrib/gosa.conf > contrib/gosa.conf.new
+ mv contrib/gosa.conf.new contrib/gosa.conf
+
+ echo "Extracting languages..."
+ rm locale/messages.po
+ (echo contrib/gosa.conf; find . -name '*.[ctpi][ophn][nlpc]') | xgettext -f - --keyword=must -d Domain -L PHP -n -o locale/messages.po
+
+ echo "Merging po files with existing ones"
+ error=0
+ for f in locale/??/LC_MESSAGES; do
+ echo -n "* merging $f/messages.po: "
+ [ -f $f/messages.po ] && msgmerge $f/messages.po locale/messages.po --output-file=$f/messages.po.new &> /dev/null
+
+ # Do an extra check for dummy dir 'locale/en/LC_MESSAGES'
+ if [ $? -ne 0 ]; then
+ [ "$f" == "locale/en/LC_MESSAGES" ] && $TRUE
+ fi
+
+ if [ $? -eq 0 ]; then
+ echo "done";
+ else
+ echo "failed";
+ error=1
+ fi
+
+ done
+
+ echo "Copying new po files, making backups..."
+ find . -name messages.po | while read f; do
+
+ if [ -f $ORIG/$f ]; then
+ mv $ORIG/$f $ORIG/$f.orig
+ else
+ continue
+ fi
+
+ echo $f | grep -q "locale/messages.po"
+ if [ $? -ne 0 ]; then
+ echo "* replaced $ORIG/$f"
+ cp $f.new $ORIG/$f
+ else
+ cp $f $ORIG/$f
+ fi
+
+ done
+
+ rm -rf $TEMPDIR
+
+ echo
+ if [ $error -eq 0 ]; then
+ if [ $ASSUME_Y -eq 1 ]; then
+ find $ORIG/ -type f -name 'messages.po.orig' -exec rm -f {} \;
+ else
+ read -p "Do you want to erase the message.po.orig files? (y/n)" -n1 ans
+
+ if [ "$ans" == "y" -o "$ans" == "Y" ]; then
+ find $ORIG/ -type f -name 'messages.po.orig' -exec rm -f {} \;
+ fi
+ fi
+
+ else
+ echo "There were errors during the transition. Please fix!"
+ exit 1
+ fi
+
+cat <<-EOF
+
+---------------------------------------------------------------------
+
+Now edit all files that have been replaced above (i.e. using kbabel
+or gtranslator) and mail the changes to gosa@oss.gonicus.de to be
+included in the next release.
+
+To see the changes you've made in GOsa, run "msgfmt messages.po" on
+your freshly edited files and restart your apache after that. Set
+the webbrowser to the language you've edited and go back to the
+login screen.
+
+---------------------------------------------------------------------
+
+EOF
+
+ popd &> /dev/null
+}
+
+compile_po()
+{
+ po='messages.po'
+ mo='messages.mo'
+
+ echo "Compiling po files..."
+ for f in locale/??/LC_MESSAGES; do
+
+ if [ -f $f/$po ]; then
+ echo "* compiling $f/$po"
+ msgfmt $f/$po -o $f/$mo
+ else
+ echo "! skipped $f/$po - does not exist"
+ error=1
+ continue
+ fi
+
+ done
+}
+
+#
+# MAIN
+#
+GENERATE=0
+COMPILE=0
+ASSUME_Y=0
+while getopts ":cgyh" opt
+do
+ case $opt in
+ c) COMPILE=1
+ ;;
+ g) GENERATE=1;
+ ;;
+ y) ASSUME_Y=1;
+ ;;
+ h|--help)
+ echo "Usage: $(basename $0) [-c] [-g] [-y]"
+ echo " -c compile existing po files into mo files"
+ echo " -g extract strings from GOsa and generate po files"
+ echo " -y assume yes"
+ exit 1
+ ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+# Default to generate
+if [ $GENERATE -eq 0 -a $COMPILE -eq 0 ]; then
+ GENERATE=1
+fi
+
+[ $GENERATE -eq 1 ] && generate_po
+[ $COMPILE -eq 1 ] && compile_po
+
+# vim:tabstop=2:expandtab:shiftwidth=2:syntax:ruler:
diff --git a/gosa-core/update-online-help b/gosa-core/update-online-help
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Defaults for Debian
+CNV=`pwd`/contrib/latex2html
+LYX=lyx-qt
+
+# Sanity checks
+if [ ! -d doc/guide/user ]; then
+ echo "Can't find usable documentation structure - aborting"
+ exit 1
+fi
+
+# Commands present?
+for cmd in $CNV $LYX; do
+ if ! which $cmd &> /dev/null; then
+ echo "Can't find executable for '$cmd' - aborting"
+ exit 2
+ fi
+done
+
+pushd . &> /dev/null
+cd doc/guide/user
+
+for lang in *; do
+ [ ! -d "$lang" ] && continue
+
+ pushd . &> /dev/null
+ echo "Processing language $lang..."
+ cd $lang/lyx-source
+
+ for source in *.lyx; do
+ $LYX -e latex $source; d=../html/${source%%\.*}/ > /dev/null
+ [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
+ $CNV -no_navigation -dir $d ${source%%\.*}.tex > /dev/null
+ done
+
+ popd &> /dev/null
+done
+
+popd &> /dev/null
+echo
+exit 0
diff --git a/gosa-core/update-pdf-help b/gosa-core/update-pdf-help
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Defaults for Debian
+LYX=lyx-qt
+
+# Sanity checks
+if [ ! -d doc/guide/user ]; then
+ echo "Can't find usable documentation structure - aborting"
+ exit 1
+fi
+
+# Commands present?
+for cmd in $LYX; do
+ if ! which $cmd &> /dev/null; then
+ echo "Can't find executable for '$cmd' - aborting"
+ exit 2
+ fi
+done
+
+pushd . &> /dev/null
+cd doc/guide/user
+
+for lang in *; do
+ [ ! -d "$lang" ] && continue
+
+ pushd . &> /dev/null
+ echo "Processing language $lang..."
+ cd $lang/lyx-source
+
+ for source in *.lyx; do
+ $LYX -e pdf $source; d=../pdf/${source%%\.*}/; pdf=${source%lyx}pdf > /dev/null
+ [ -d $d ] || mkdir -p $d && cp $pdf ../pdf/${source%%\.*}/ >/dev/null
+ done
+
+ popd &> /dev/null
+done
+
+popd &> /dev/null
+echo
+exit 0
diff --git a/update-gosa b/update-gosa
--- a/update-gosa
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/php5
-<?php
-
-/* Function to include all class_ files starting at a given directory base */
-function get_classes($folder= ".")
-{
- static $base_dir= "";
- static $result= array();
-
- if ($base_dir == ""){
- $base_dir= getcwd();
- }
-
- $currdir=getcwd();
- if ($folder){
- chdir("$folder");
- }
-
- $dh = opendir(".");
- while(false !== ($file = readdir($dh))){
-
- if (preg_match("/.*\.svn.*/", $file) ||
- preg_match("/.*smarty.*/i",$file) ||
- preg_match("/.*\.tpl.*/",$file) ||
- ($file==".") ||($file =="..")){
- continue;
- }
-
- /* Recurse through all "common" directories */
- if (is_dir($file)){
- get_classes($file);
- continue;
- }
-
- /* Only take care about .inc and .php files... */
- if (!(preg_match('/\.php$/', $file) || preg_match('/\.inc$/', $file))){
- continue;
- }
-
- /* Include existing class_ files */
- $contents= file($file);
- foreach($contents as $line){
- $line= chop($line);
- if (preg_match('/^\s*class\s*\w.*$/', $line)){
- $class= preg_replace('/^\s*class\s*(\w+).*$/', '\1', $line);
- $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");
- }
- }
- }
-
- closedir($dh);
- chdir($currdir);
-
- return ($result);
-}
-
-$class_mapping= get_classes();
-$filename= "include/class_location.inc";
-
-/* Sanity checks */
-if (is_writable($filename)) {
-
- if (!$handle= fopen($filename, 'w')) {
- echo "Cannot open file \"$filename\" - aborted\n";
- exit (1);
- }
-
-} else {
- echo "File \"$filename\" is not writable - aborted\n";
- exit (2);
-}
-
-fwrite ($handle, "<?php\n\$class_mapping= array(\n");
-foreach ($class_mapping as $key => $value){
- fwrite ($handle, " \"$key\" => \"$value\",\n");
-}
-fwrite ($handle, " );\n?>");
-
-fclose($handle);
-
-?>
diff --git a/update-locale b/update-locale
--- a/update-locale
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/bin/sh
-
-generate_po() {
- ORIG=`pwd`
- TEMPDIR="/tmp/gosa-locale"
- TRUE=`which true`
-
- echo
- echo "Creating temporary directory..."
- [ -d $TEMPDIR ] && rm -rf $TEMPDIR
- mkdir $TEMPDIR
-
- echo "Creating copy of GOsa..."
- tar c . | tar x -C $TEMPDIR
-
- echo "Converting .tpl files..."
- pushd . &> /dev/null
- cd $TEMPDIR
-
- for template in $(find . -name '*.tpl'); do
- echo "* converting .tpl files: $(basename $template)"
- sed -e 's/{t}/<?php $t= _("/g;s!{/t}!");?>!g' $template > $template.new
- mv $template.new $template
- done
-
- for class in $(find . -name 'class_*.inc'); do
- echo "* converting class_*.inc files: $(basename $class)"
- sed -e 's/\($pl[DH][^=]*\)= *"\([^"]*\)";$/\1= _("\2");/g' $class > $class.new
- mv $class.new $class
- done
-
- echo "* converting strings from gosa.conf"
- sed -e 's/headline="\([^"]*\)"/<?php $headline=_("\1");?>/g;s/name="\([^"]*\)"/<?php $t= _("\1");?>/g' contrib/gosa.conf > contrib/gosa.conf.new
- mv contrib/gosa.conf.new contrib/gosa.conf
-
- echo "Extracting languages..."
- rm locale/messages.po
- (echo contrib/gosa.conf; find . -name '*.[ctpi][ophn][nlpc]') | xgettext -f - --keyword=must -d Domain -L PHP -n -o locale/messages.po
-
- echo "Merging po files with existing ones"
- error=0
- for f in locale/??/LC_MESSAGES; do
- echo -n "* merging $f/messages.po: "
- [ -f $f/messages.po ] && msgmerge $f/messages.po locale/messages.po --output-file=$f/messages.po.new &> /dev/null
-
- # Do an extra check for dummy dir 'locale/en/LC_MESSAGES'
- if [ $? -ne 0 ]; then
- [ "$f" == "locale/en/LC_MESSAGES" ] && $TRUE
- fi
-
- if [ $? -eq 0 ]; then
- echo "done";
- else
- echo "failed";
- error=1
- fi
-
- done
-
- echo "Copying new po files, making backups..."
- find . -name messages.po | while read f; do
-
- if [ -f $ORIG/$f ]; then
- mv $ORIG/$f $ORIG/$f.orig
- else
- continue
- fi
-
- echo $f | grep -q "locale/messages.po"
- if [ $? -ne 0 ]; then
- echo "* replaced $ORIG/$f"
- cp $f.new $ORIG/$f
- else
- cp $f $ORIG/$f
- fi
-
- done
-
- rm -rf $TEMPDIR
-
- echo
- if [ $error -eq 0 ]; then
- if [ $ASSUME_Y -eq 1 ]; then
- find $ORIG/ -type f -name 'messages.po.orig' -exec rm -f {} \;
- else
- read -p "Do you want to erase the message.po.orig files? (y/n)" -n1 ans
-
- if [ "$ans" == "y" -o "$ans" == "Y" ]; then
- find $ORIG/ -type f -name 'messages.po.orig' -exec rm -f {} \;
- fi
- fi
-
- else
- echo "There were errors during the transition. Please fix!"
- exit 1
- fi
-
-cat <<-EOF
-
----------------------------------------------------------------------
-
-Now edit all files that have been replaced above (i.e. using kbabel
-or gtranslator) and mail the changes to gosa@oss.gonicus.de to be
-included in the next release.
-
-To see the changes you've made in GOsa, run "msgfmt messages.po" on
-your freshly edited files and restart your apache after that. Set
-the webbrowser to the language you've edited and go back to the
-login screen.
-
----------------------------------------------------------------------
-
-EOF
-
- popd &> /dev/null
-}
-
-compile_po()
-{
- po='messages.po'
- mo='messages.mo'
-
- echo "Compiling po files..."
- for f in locale/??/LC_MESSAGES; do
-
- if [ -f $f/$po ]; then
- echo "* compiling $f/$po"
- msgfmt $f/$po -o $f/$mo
- else
- echo "! skipped $f/$po - does not exist"
- error=1
- continue
- fi
-
- done
-}
-
-#
-# MAIN
-#
-GENERATE=0
-COMPILE=0
-ASSUME_Y=0
-while getopts ":cgyh" opt
-do
- case $opt in
- c) COMPILE=1
- ;;
- g) GENERATE=1;
- ;;
- y) ASSUME_Y=1;
- ;;
- h|--help)
- echo "Usage: $(basename $0) [-c] [-g] [-y]"
- echo " -c compile existing po files into mo files"
- echo " -g extract strings from GOsa and generate po files"
- echo " -y assume yes"
- exit 1
- ;;
- esac
-done
-shift $(($OPTIND - 1))
-
-# Default to generate
-if [ $GENERATE -eq 0 -a $COMPILE -eq 0 ]; then
- GENERATE=1
-fi
-
-[ $GENERATE -eq 1 ] && generate_po
-[ $COMPILE -eq 1 ] && compile_po
-
-# vim:tabstop=2:expandtab:shiftwidth=2:syntax:ruler:
diff --git a/update-online-help b/update-online-help
--- a/update-online-help
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-# Defaults for Debian
-CNV=`pwd`/contrib/latex2html
-LYX=lyx-qt
-
-# Sanity checks
-if [ ! -d doc/guide/user ]; then
- echo "Can't find usable documentation structure - aborting"
- exit 1
-fi
-
-# Commands present?
-for cmd in $CNV $LYX; do
- if ! which $cmd &> /dev/null; then
- echo "Can't find executable for '$cmd' - aborting"
- exit 2
- fi
-done
-
-pushd . &> /dev/null
-cd doc/guide/user
-
-for lang in *; do
- [ ! -d "$lang" ] && continue
-
- pushd . &> /dev/null
- echo "Processing language $lang..."
- cd $lang/lyx-source
-
- for source in *.lyx; do
- $LYX -e latex $source; d=../html/${source%%\.*}/ > /dev/null
- [ -d $d ] || mkdir -p $d && rm -r $d/* &> /dev/null
- $CNV -no_navigation -dir $d ${source%%\.*}.tex > /dev/null
- done
-
- popd &> /dev/null
-done
-
-popd &> /dev/null
-echo
-exit 0
diff --git a/update-pdf-help b/update-pdf-help
--- a/update-pdf-help
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-# Defaults for Debian
-LYX=lyx-qt
-
-# Sanity checks
-if [ ! -d doc/guide/user ]; then
- echo "Can't find usable documentation structure - aborting"
- exit 1
-fi
-
-# Commands present?
-for cmd in $LYX; do
- if ! which $cmd &> /dev/null; then
- echo "Can't find executable for '$cmd' - aborting"
- exit 2
- fi
-done
-
-pushd . &> /dev/null
-cd doc/guide/user
-
-for lang in *; do
- [ ! -d "$lang" ] && continue
-
- pushd . &> /dev/null
- echo "Processing language $lang..."
- cd $lang/lyx-source
-
- for source in *.lyx; do
- $LYX -e pdf $source; d=../pdf/${source%%\.*}/; pdf=${source%lyx}pdf > /dev/null
- [ -d $d ] || mkdir -p $d && cp $pdf ../pdf/${source%%\.*}/ >/dev/null
- done
-
- popd &> /dev/null
-done
-
-popd &> /dev/null
-echo
-exit 0