[TASK] Various enhancements 73/42073/2
authorXavier Perseguers <xavier@typo3.org>
Tue, 28 Jul 2015 14:26:23 +0000 (16:26 +0200)
committerXavier Perseguers <xavier@typo3.org>
Tue, 28 Jul 2015 21:03:34 +0000 (23:03 +0200)
- Better variable naming
- Invisible build directory ("." instead of "_" prefix)
- Speed up packaging by clever use of sync_stores)

Change-Id: If9c5e8e3851b85bdee95012279b85c7a5846c50c
Reviewed-on: http://review.typo3.org/42073
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/files/scripts/bin/build-language-pack
typo3/files/scripts/bin/build-sysext-language-pack

index 31a9e3e..2e16564 100755 (executable)
@@ -28,8 +28,9 @@ for EXTNAME in $EXTENSIONS; do
        pushd ${POOTLE_PO}/$EXT_PREFIX.$EXTNAME >/dev/null
        rm -rf ${TER_L10N_PATH}/_$EXTNAME
 
-       _LANGUAGE_PACK_PATH=${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-       mkdir -p $_LANGUAGE_PACK_PATH
+       LANGUAGE_PACK_PATH=${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+       BUILD_EXT_PATH=${TER_L10N_PATH}/.$EXTNAME
+       mkdir -p $LANGUAGE_PACK_PATH
        mkdir -p $STATE_DIR/$EXT_PREFIX.$EXTNAME
 
        UPDATED_PACKAGES=0
@@ -73,7 +74,6 @@ for EXTNAME in $EXTENSIONS; do
                esac
 
                echo -n "   processing $LANG ... "
-               ${POOTLE_MANAGE} sync_stores --overwrite --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
 
                # Compute current state
                STATUS_FILE=$STATE_DIR/$EXT_PREFIX.$EXTNAME/$LANG.time
@@ -84,9 +84,12 @@ for EXTNAME in $EXTENSIONS; do
                fi
                LAST_EDIT=$(lastedit "$EXT_PREFIX.$EXTNAME" $ORIG_LANG)
                if [[ $LAST_EDIT -gt 0 && $LAST_EDIT -ne $LAST_GENERATION ]]; then
-                       mkdir -p ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME
-                       cp -r $ORIG_LANG/* ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME
-                       pushd ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME >/dev/null
+                       ${POOTLE_MANAGE} sync_stores --overwrite --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
+
+                       BUILD_PATH=${BUILD_EXT_PATH}/$LANG/$EXTNAME
+                       mkdir -p ${BUILD_PATH}
+                       cp -r $ORIG_LANG/* ${TEMP_PATH}
+                       pushd ${BUILD_PATH} >/dev/null
                        for XLF in $(find . -type f | cut -b3-); do
                                DIR=$(dirname $XLF)
                                FILE=$(basename $XLF)
@@ -102,11 +105,11 @@ for EXTNAME in $EXTENSIONS; do
                        done
                        find . -name \*.xlf -exec chmod 644 {} \;
                        find . -name \*.xml -exec chmod 644 {} \;
-                       rm -f $_LANGUAGE_PACK_PATH/$EXTNAME-l10n-$LANG.zip
+                       rm -f $LANGUAGE_PACK_PATH/$EXTNAME-l10n-$LANG.zip
                        # ../ to include $EXTNAME directory
                        cd ../
-                       zip -9 $_LANGUAGE_PACK_PATH/$EXTNAME-l10n-$LANG.zip -r . >/dev/null
-                       chmod 644 ${_LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}.zip
+                       zip -9 $LANGUAGE_PACK_PATH/$EXTNAME-l10n-$LANG.zip -r . >/dev/null
+                       chmod 644 ${LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}.zip
 
                        popd >/dev/null
 
@@ -121,7 +124,7 @@ for EXTNAME in $EXTENSIONS; do
 
        if [ ${UPDATED_PACKAGES} -eq 1 ]; then
                # Create language pack index
-               pushd $_LANGUAGE_PACK_PATH >/dev/null
+               pushd $LANGUAGE_PACK_PATH >/dev/null
 
                _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
                _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}.xml
index 63dd2c7..35dd9a6 100755 (executable)
@@ -27,8 +27,9 @@ for EXTNAME in $EXTENSIONS; do
 
        pushd ${POOTLE_PO}/$EXT_PREFIX.$EXTNAME >/dev/null
 
-       _LANGUAGE_PACK_PATH=${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-       mkdir -p $_LANGUAGE_PACK_PATH
+       LANGUAGE_PACK_PATH=${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+       BUILD_EXT_PATH=${TER_L10N_PATH}/.$EXTNAME
+       mkdir -p $LANGUAGE_PACK_PATH
        mkdir -p $STATE_DIR/$EXT_PREFIX.$EXTNAME
 
        for VERSION in $(find .typo3 -name \*.filemapping | sed -r 's/^.*TYPO3(v.)\.filemapping/\1/'); do
@@ -85,7 +86,6 @@ for EXTNAME in $EXTENSIONS; do
                        esac
 
                        echo -n "   processing $LANG ... "
-                       ${POOTLE_MANAGE} sync_stores --overwrite --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
 
                        # Compute current state
                        STATUS_FILE=$STATE_DIR/$EXT_PREFIX.$EXTNAME/$LANG.${VERSION}.time
@@ -96,9 +96,12 @@ for EXTNAME in $EXTENSIONS; do
                        fi
                        LAST_EDIT=$(lastedit "$EXT_PREFIX.$EXTNAME" $ORIG_LANG)
                        if [[ $LAST_EDIT -gt 0 && $LAST_EDIT -ne $LAST_GENERATION ]]; then
-                               mkdir -p ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME
-                               cp -r $ORIG_LANG/* ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME
-                               pushd ${TER_L10N_PATH}/_$EXTNAME/$LANG/$EXTNAME >/dev/null
+                               ${POOTLE_MANAGE} sync_stores --overwrite --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
+
+                               BUILD_PATH=${BUILD_EXT_PATH}/$LANG/$EXTNAME
+                               mkdir -p ${BUILD_PATH}
+                               cp -r $ORIG_LANG/* ${TEMP_PATH}
+                               pushd ${BUILD_PATH} >/dev/null
                                for XLF in $(find . -type f | cut -b3-); do
                                        MAPPING=${POOTLE_PO}/${EXT_PREFIX}.${EXTNAME}/.typo3/TYPO3${VERSION}.filemapping
                                        if [ ! -f "${MAPPING}" ]; then
@@ -165,11 +168,11 @@ EOT
                                done
                                find . -name \*.xlf -exec chmod 644 {} \;
                                find . -name \*.xml -exec chmod 644 {} \;
-                               rm -f ${_LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip
+                               rm -f ${LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip
                                # ../ to include $EXTNAME directory
                                cd ../
-                               zip -9 ${_LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip -r . >/dev/null
-                               chmod 644 ${_LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip
+                               zip -9 ${LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip -r . >/dev/null
+                               chmod 644 ${LANGUAGE_PACK_PATH}/${EXTNAME}-l10n-${LANG}${SUFFIX}.zip
 
                                popd >/dev/null
 
@@ -184,7 +187,7 @@ EOT
 
                if [ ${UPDATED_PACKAGES} -eq 1 ]; then
                        # Create language pack index
-                       pushd $_LANGUAGE_PACK_PATH >/dev/null
+                       pushd $LANGUAGE_PACK_PATH >/dev/null
 
                        _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
                        _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}${SUFFIX}.xml
@@ -225,7 +228,7 @@ EOT
                        chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}
                fi
 
-               rm -rf ${TER_L10N_PATH}/_$EXTNAME
+               rm -rf ${BUILD_EXT_PATH}
        done
 
        popd >/dev/null