[Kde-extra-gear] cvsExtract patch

Sebastian Trueg kde-extra-gear@mail.kde.org
Sun, 9 Feb 2003 13:28:43 +0100


--Boundary-00=_7lkR+HTUUJVyt4M
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hy,

I added two things to cvsExtract.sh:
1. All available languages in kde-i18n are searched for a translation (from 
cvs2dist)
2. no documentation option

May I commit?

Cheers,
Sebastian

--Boundary-00=_7lkR+HTUUJVyt4M
Content-Type: text/x-diff;
  charset="us-ascii";
  name="cvsExtract_patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cvsExtract_patch"

Index: cvsExtract.sh
===================================================================
RCS file: /home/kde/kdeextragear-1/scripts/cvsExtract.sh,v
retrieving revision 1.9
diff -u -p -r1.9 cvsExtract.sh
--- cvsExtract.sh	21 Oct 2002 21:17:42 -0000	1.9
+++ cvsExtract.sh	9 Feb 2003 11:45:51 -0000
@@ -36,6 +36,8 @@ LANGUAGES=""
 
 # misc
 KDECOMMON=kde-common
+GETDOC="yes"
+GETI18N="yes"
 
 # CVS settings
 RETRIEVAL_METHOD=LOCAL
@@ -77,7 +79,8 @@ Following Options are needed
     -a|--app <APPNAME>        The name of the application to extract from cvs
 
 Following Options are optional
-    -l|--languages <LANGUAGES> space seperated list of languages to include
+    -l|--languages <LANGUAGES> Space seperated list of languages to search for translations.
+                               If no languages are specified all available languages are searched.
     -b|--builddir <DIRNAME>   Name of the temporary working directory where all files will be put
     -v|--version <VERSION>    version of the application (only for correct naming of the tar archive)
     -cb|--cvsbase <DIRNAME>   Directory in which the cvs modules 
@@ -88,6 +91,8 @@ Following Options are optional
 					    current directory (DEFAULT).
     -d <CVSROOT>              Use the specified CVSROOT instead of the environment variable. 
                               Implies \"-r CVS\".
+    -nodoc                    Do not try to get any documentation.
+    -noi18n                   Do not search for any translations.
     -h|--help                 This Help"
 }
 
@@ -145,6 +150,12 @@ do
 	RETRIEVAL_METHOD="CVS"
 	shift
       ;;
+    -nodoc)
+        GETDOC="no"
+      ;;
+    -noi18n)
+        GETI18N="no"
+      ;;
     -h|--help)
 	showHelp
 	exit 0
@@ -184,6 +195,25 @@ APPDIR=${APPNAME}
 [ -z "$TARGETDIR" ] && TARGETDIR="${APPDIR}-${APPVERSION}-BUILD"
 
 
+# if no languages are specified get the complete list from kde-i18n
+if [ $GETI18N = "yes" ]; then
+    if [ -z "$LANGUAGES" ]; then
+	echo "Retrieving complete list of available languages..."
+	case "${RETRIEVAL_METHOD}" in
+	    CVS)
+		cvs -z4 -q -d "$CVSROOT" co -P kde-i18n/subdirs > /dev/null 2>&1
+		;;
+	    LOCAL)
+		cp  -a ${CVSBASEDIR}/${KDEI18N}/subdirs kde-i18n
+		;;
+	esac
+	LANGUAGES="$(cat kde-i18n/subdirs)"
+	echo "available languages: $LANGUAGES"
+	rm -r kde-i18n
+    fi
+fi
+
+
 #----------------------------------------------------------#
 #                      FUNCTIONS                           #
 #----------------------------------------------------------#
@@ -325,12 +355,13 @@ function getTranslation {
 	    echo -e "   $lang"
 	    mkdir ${lang}
 
+   	    gotTranslations="no"
+
 	    case $1 in 
 		CVS)
 		    if cvs co -d ${lang}_tmp ${KDEI18N}/${lang}/messages/${MODULENAME_I18N} 2>/dev/null ; then
-			mv ${lang}_tmp/${APPNAME}*.po ${lang} 2>/dev/null ||echo -e "No Translation for Language $lang"
-			mv ${lang}_tmp/Makefile.am ${lang}
-			gotTranslations="yes"
+			mv ${lang}_tmp/${APPNAME}*.po ${lang} 2>/dev/null && gotTranslations="yes"
+			mv ${lang}_tmp/Makefile.am ${lang} 2>/dev/null
 		    fi
 		    rm -rf ${lang}_tmp
 		;;
@@ -442,9 +473,13 @@ cd ${APPDIR}
 
 getAdminDir "${RETRIEVAL_METHOD}" "admin"
 
-getDocumentation "${RETRIEVAL_METHOD}" "doc"
+if [ $GETDOC = "yes" ]; then
+    getDocumentation "${RETRIEVAL_METHOD}" "doc"
+fi
 
-getTranslation "${RETRIEVAL_METHOD}" "po"
+if [ $GETI18N = "yes" ]; then
+    getTranslation "${RETRIEVAL_METHOD}" "po"
+fi
 
 # remove all "CVS/*" files
 cd "$BUILDDIR"
@@ -453,7 +488,7 @@ cleanUpFiles
 cd ${APPDIR}
 
 # create Makefile.am for doc and all Languages
-( 
+if [ $GETDOC = "yes" ]; then
     cd doc 
     DOC_SUBDIRS=`listsubdirs`
     if [ -n "`echo $DOC_SUBDIRS|sed 's/ //g'`" ]; then
@@ -461,14 +496,15 @@ cd ${APPDIR}
 	for lang in $LANGUAGES ; do 
 	    ( test -d $lang && cd $lang && echo "SUBDIRS = `listsubdirs`" > Makefile.am )
 	done
+	cd ..
     else 
 	cd ..
 	rmdir doc 2> /dev/null
     fi
-)
+fi
     
 # create Makefile.am for po
-( 
+if [ $GETI18N = "yes" ]; then
     cd po 
     PO_SUBDIRS=`listsubdirs`
     if [ -n "`echo $PO_SUBDIRS|tr -d '\n'`" ] ;then
@@ -482,11 +518,12 @@ SUBDIRS = \$(AUTODIRS)
 POFILES = AUTO" > Makefile.am 
 	)
 	done
+	cd ..
     else
 	cd ..
 	rm -rf po
     fi
-)
+fi
 
 # 
 echo -e "Building configure script\n"

--Boundary-00=_7lkR+HTUUJVyt4M--