[TASK] Enhanced packaging and detection of moved files 79/41979/4
authorXavier Perseguers <xavier@typo3.org>
Mon, 27 Jul 2015 13:46:27 +0000 (15:46 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 27 Jul 2015 16:20:43 +0000 (18:20 +0200)
Change-Id: Ib7e2e9a819d8add88ae1ec7cd86941a4e3831177
Reviewed-on: http://review.typo3.org/41979
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
typo3/files/scripts/bin/update-extension
typo3/files/scripts/bin/update-typo3-core-template

index 65076f4..42c43b1 100755 (executable)
@@ -20,14 +20,11 @@ for EXTNAME in $EXTENSIONS; do
        validProjectName ${EXT_PREFIX}.${EXTNAME} || exit 1
 
        echo "Packaging $EXTNAME"
-       if [ ! -z "$FORCE_EXTENSION" ]; then
-               echo -n "   synchronizing store ... "
-               ${POOTLE_MANAGE} sync_stores --project=$EXT_PREFIX.$EXTNAME >/dev/null 2>&1
-               echo "done."
-       fi
+
        echo -n "   updating statistics ... "
        ${POOTLE_MANAGE} refresh_stats --project="$EXT_PREFIX.$EXTNAME" >/dev/null 2>&1
        echo "done."
+
        pushd ${POOTLE_PO}/$EXT_PREFIX.$EXTNAME >/dev/null
        rm -rf ${TER_L10N_PATH}/_$EXTNAME
 
@@ -35,6 +32,8 @@ for EXTNAME in $EXTENSIONS; do
        mkdir -p $_LANGUAGE_PACK_PATH
        mkdir -p $STATE_DIR/$EXT_PREFIX.$EXTNAME
 
+       UPDATED_PACKAGES=0
+
        LANGUAGES="$(ls | grep -v templates) ba br ch cz dk si se gr hk kr ua jp qc vn ge ga"
        for LANG in $LANGUAGES; do
                ORIG_LANG=$LANG
@@ -74,7 +73,7 @@ for EXTNAME in $EXTENSIONS; do
                esac
 
                echo -n "   processing $LANG ... "
-               #${POOTLE_MANAGE} sync_stores --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
+               ${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
@@ -113,52 +112,55 @@ for EXTNAME in $EXTENSIONS; do
 
                        # Save current state
                        echo $LAST_EDIT > $STATUS_FILE
+                       UPDATED_PACKAGES=1
                        echo "done."
                else
                        echo "skipped."
                fi
        done
 
-       # Create language pack index
-       pushd $_LANGUAGE_PACK_PATH >/dev/null
-
-       _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
-       _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}.xml
-       rm -f $_LANGUAGE_INDEX_FILE
-       touch $_LANGUAGE_INDEX_FILE
-
-       echo -e "<?xml version=\"1.0\" standalone=\"yes\" ?>"                   >> $_LANGUAGE_INDEX_FILE
-       echo -e "<TERlanguagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
-       echo -e "\t<meta>"                                                      >> $_LANGUAGE_INDEX_FILE
-       echo -e "\t\t<timestamp>$(date +"%s")</timestamp>"                      >> $_LANGUAGE_INDEX_FILE
-       echo -e "\t\t<date>$(date +"%F %T")</date>"                             >> $_LANGUAGE_INDEX_FILE
-       echo -e "\t</meta>"                                                     >> $_LANGUAGE_INDEX_FILE
-       echo -e "\t<languagePackIndex>"                                         >> $_LANGUAGE_INDEX_FILE
-
-       for p in $(find . -name \*.zip | sort);
-       do
-               _LANGUAGE_KEY=$(echo $p | sed -r "s/.*${_LANGUAGE_PACK_NAME}-(.*)\.zip\$/\1/")
-               echo -e "\t\t<languagepack language=\"$_LANGUAGE_KEY\">"        >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t\t\t<md5>$(md5sum $p | cut -d" " -f1)</md5>"         >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t\t</languagepack>"                                   >> $_LANGUAGE_INDEX_FILE
-       done
-
-       echo -e "\t</languagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
-       echo -e "</TERlanguagePackIndex>"                                       >> $_LANGUAGE_INDEX_FILE
-
-       chmod 644 $_LANGUAGE_INDEX_FILE
-
-       popd >/dev/null
+       if [ ${UPDATED_PACKAGES} -eq 1 ]; then
+               # Create language pack index
+               pushd $_LANGUAGE_PACK_PATH >/dev/null
+
+               _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
+               _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}.xml
+               rm -f $_LANGUAGE_INDEX_FILE
+               touch $_LANGUAGE_INDEX_FILE
+
+               echo -e "<?xml version=\"1.0\" standalone=\"yes\" ?>"                   >> $_LANGUAGE_INDEX_FILE
+               echo -e "<TERlanguagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
+               echo -e "\t<meta>"                                                      >> $_LANGUAGE_INDEX_FILE
+               echo -e "\t\t<timestamp>$(date +"%s")</timestamp>"                      >> $_LANGUAGE_INDEX_FILE
+               echo -e "\t\t<date>$(date +"%F %T")</date>"                             >> $_LANGUAGE_INDEX_FILE
+               echo -e "\t</meta>"                                                     >> $_LANGUAGE_INDEX_FILE
+               echo -e "\t<languagePackIndex>"                                         >> $_LANGUAGE_INDEX_FILE
+
+               for p in $(find . -name \*.zip | sort);
+               do
+                       _LANGUAGE_KEY=$(echo $p | sed -r "s/.*${_LANGUAGE_PACK_NAME}-(.*)\.zip\$/\1/")
+                       echo -e "\t\t<languagepack language=\"$_LANGUAGE_KEY\">"            >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t\t\t<md5>$(md5sum $p | cut -d" " -f1)</md5>"             >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t\t</languagepack>"                                       >> $_LANGUAGE_INDEX_FILE
+               done
+
+               echo -e "\t</languagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
+               echo -e "</TERlanguagePackIndex>"                                       >> $_LANGUAGE_INDEX_FILE
+
+               chmod 644 $_LANGUAGE_INDEX_FILE
+
+               popd >/dev/null
+
+               # Mark changes on directories and fix access rights
+               touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+               touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
+               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
+               touch ${TER_L10N_PATH}/${EXTNAME:0:1}
+               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}
+       fi
 
        rm -rf ${TER_L10N_PATH}/_$EXTNAME
 
-       # Mark changes on directories and fix access rights
-       touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-       touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
-       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
-       touch ${TER_L10N_PATH}/${EXTNAME:0:1}
-       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}
-
        popd >/dev/null
 done
index 03a2d1c..48db855 100755 (executable)
@@ -20,14 +20,11 @@ for EXTNAME in $EXTENSIONS; do
        validProjectName ${EXT_PREFIX}.${EXTNAME} || exit 1
 
        echo "Packaging $EXTNAME"
-       if [ ! -z "$FORCE_EXTENSION" ]; then
-               echo -n "   synchronizing store ... "
-               ${POOTLE_MANAGE} sync_stores --project=$EXT_PREFIX.$EXTNAME >/dev/null 2>&1
-               echo "done."
-       fi
+
        echo -n "   updating statistics ... "
        ${POOTLE_MANAGE} refresh_stats --project="$EXT_PREFIX.$EXTNAME" >/dev/null 2>&1
        echo "done."
+
        pushd ${POOTLE_PO}/$EXT_PREFIX.$EXTNAME >/dev/null
 
        _LANGUAGE_PACK_PATH=${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
@@ -40,6 +37,7 @@ for EXTNAME in $EXTENSIONS; do
                echo "   ----------------------"
 
                rm -rf ${TER_L10N_PATH}/_$EXTNAME
+               UPDATED_PACKAGES=0
                LANGUAGES="$(ls | grep -v templates)"
 
                SUFFIX=""
@@ -87,7 +85,7 @@ for EXTNAME in $EXTENSIONS; do
                        esac
 
                        echo -n "   processing $LANG ... "
-                       #${POOTLE_MANAGE} sync_stores --project="$EXT_PREFIX.$EXTNAME" --language=$ORIG_LANG >/dev/null 2>&1
+                       ${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
@@ -177,54 +175,57 @@ EOT
 
                                # Save current state
                                echo $LAST_EDIT > $STATUS_FILE
+                               UPDATED_PACKAGES=1
                                echo "done."
                        else
                                echo "skipped."
                        fi
                done
 
-               # Create language pack index
-               pushd $_LANGUAGE_PACK_PATH >/dev/null
-
-               _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
-               _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}${SUFFIX}.xml
-               rm -f $_LANGUAGE_INDEX_FILE
-               touch $_LANGUAGE_INDEX_FILE
-
-               echo -e "<?xml version=\"1.0\" standalone=\"yes\" ?>"                   >> $_LANGUAGE_INDEX_FILE
-               echo -e "<TERlanguagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t<meta>"                                                      >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t\t<timestamp>$(date +"%s")</timestamp>"                      >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t\t<date>$(date +"%F %T")</date>"                             >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t</meta>"                                                     >> $_LANGUAGE_INDEX_FILE
-               echo -e "\t<languagePackIndex>"                                         >> $_LANGUAGE_INDEX_FILE
-
-               for p in $(find . -name \*${SUFFIX}.zip | sort);
-               do
-                       _LANGUAGE_KEY=$(echo $p | sed -r "s/.*${_LANGUAGE_PACK_NAME}-(.*)${SUFFIX}\.zip\$/\1/")
-                       if [ -n "${SUFFIX}" ] || [ -z "$(echo ${_LANGUAGE_KEY} | grep '\.')" ]; then
-                               echo -e "\t\t<languagepack language=\"$_LANGUAGE_KEY\">"        >> $_LANGUAGE_INDEX_FILE
-                               echo -e "\t\t\t<md5>$(md5sum $p | cut -d" " -f1)</md5>"         >> $_LANGUAGE_INDEX_FILE
-                               echo -e "\t\t</languagepack>"                                   >> $_LANGUAGE_INDEX_FILE
-                       fi
-               done
-
-               echo -e "\t</languagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
-               echo -e "</TERlanguagePackIndex>"                                       >> $_LANGUAGE_INDEX_FILE
-
-               chmod 644 $_LANGUAGE_INDEX_FILE
-
-               popd >/dev/null
+               if [ ${UPDATED_PACKAGES} -eq 1 ]; then
+                       # Create language pack index
+                       pushd $_LANGUAGE_PACK_PATH >/dev/null
+
+                       _LANGUAGE_PACK_NAME=${EXTNAME}-l10n
+                       _LANGUAGE_INDEX_FILE=${_LANGUAGE_PACK_NAME}${SUFFIX}.xml
+                       rm -f $_LANGUAGE_INDEX_FILE
+                       touch $_LANGUAGE_INDEX_FILE
+
+                       echo -e "<?xml version=\"1.0\" standalone=\"yes\" ?>"                   >> $_LANGUAGE_INDEX_FILE
+                       echo -e "<TERlanguagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t<meta>"                                                      >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t\t<timestamp>$(date +"%s")</timestamp>"                      >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t\t<date>$(date +"%F %T")</date>"                             >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t</meta>"                                                     >> $_LANGUAGE_INDEX_FILE
+                       echo -e "\t<languagePackIndex>"                                         >> $_LANGUAGE_INDEX_FILE
+
+                       for p in $(find . -name \*${SUFFIX}.zip | sort);
+                       do
+                               _LANGUAGE_KEY=$(echo $p | sed -r "s/.*${_LANGUAGE_PACK_NAME}-(.*)${SUFFIX}\.zip\$/\1/")
+                               if [ -n "${SUFFIX}" ] || [ -z "$(echo ${_LANGUAGE_KEY} | grep '\.')" ]; then
+                                       echo -e "\t\t<languagepack language=\"$_LANGUAGE_KEY\">"        >> $_LANGUAGE_INDEX_FILE
+                                       echo -e "\t\t\t<md5>$(md5sum $p | cut -d" " -f1)</md5>"         >> $_LANGUAGE_INDEX_FILE
+                                       echo -e "\t\t</languagepack>"                                   >> $_LANGUAGE_INDEX_FILE
+                               fi
+                       done
+
+                       echo -e "\t</languagePackIndex>"                                        >> $_LANGUAGE_INDEX_FILE
+                       echo -e "</TERlanguagePackIndex>"                                       >> $_LANGUAGE_INDEX_FILE
+
+                       chmod 644 $_LANGUAGE_INDEX_FILE
+
+                       popd >/dev/null
+
+                       # Mark changes on directories and fix access rights
+                       touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+                       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
+                       touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
+                       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
+                       touch ${TER_L10N_PATH}/${EXTNAME:0:1}
+                       chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}
+               fi
 
                rm -rf ${TER_L10N_PATH}/_$EXTNAME
-
-               # Mark changes on directories and fix access rights
-               touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}/${EXTNAME}-l10n
-               touch ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
-               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}/${EXTNAME:1:1}
-               touch ${TER_L10N_PATH}/${EXTNAME:0:1}
-               chmod 755 ${TER_L10N_PATH}/${EXTNAME:0:1}
        done
 
        popd >/dev/null
index 957dfd1..9186f4d 100755 (executable)
@@ -125,7 +125,7 @@ check_available_languages ${PROJECT_NAME}
 
 # Find new files automatically
 echo "[INFO]    Update stores"
-${POOTLE_MANAGE} update_stores --project=${PROJECT_NAME} --language=templates >/dev/null 2>&1
+${POOTLE_MANAGE} update_stores --force --project=${PROJECT_NAME} --language=templates >/dev/null 2>&1
 
 echo "[INFO]    Update from templates"
 ${POOTLE_MANAGE} update_against_templates --project=${PROJECT_NAME} >/dev/null 2>&1
index 2fa1f0f..d8f2d1e 100755 (executable)
@@ -32,6 +32,15 @@ if [ ! -d ${SOURCES}/.git ]; then
        popd >/dev/null
 fi
 
+pushd ${POOTLE_PO} >/dev/null
+PROJECTS=$(find . -maxdepth 1 -name TYPO3.core.\* -type d | cut -b3- | sort)
+popd >/dev/null
+
+for PROJECT in ${PROJECTS}; do
+       echo "[INFO]    Synchronizing stores for project ${PROJECT}"
+       ${POOTLE_MANAGE} sync_stores --overwrite --project="$EXT_PREFIX.$EXTNAME" >/dev/null 2>&1
+done
+
 # Update TYPO3 sources
 echo "[INFO]    Fetching latest changes from TYPO3 CMS sources"
 pushd ${SOURCES} >/dev/null
@@ -215,6 +224,7 @@ for VERSION in ${VERSIONS}; do
                                                                echo "found"
                                                                TRANSLATED_TARGET=${EXTENSION_TARGET}/${LANGUAGE_KEY}/${ORIGINAL_FILE}
                                                                cp ${TRANSLATED_FILE} ${TRANSLATED_TARGET}
+                                                               ${POOTLE_MANAGE} update_stores --force --project=${PROJECT} --language=${LANGUAGE_KEY} >/dev/null 2>&1
                                                        else
                                                                echo "not found"
                                                        fi
@@ -232,16 +242,12 @@ for VERSION in ${VERSIONS}; do
        PREVIOUS_GLOBAL_MAPPING=${GLOBAL_MAPPING}
 done
 
-pushd ${POOTLE_PO} >/dev/null
-
-PROJECTS=$(find . -maxdepth 1 -name TYPO3.core.\* -type d | cut -b3- | sort)
-
 for PROJECT in ${PROJECTS}; do
        echo "[INFO]    Refreshing Pootle for project ${PROJECT}"
 
        # Find new files automatically
        echo "[INFO]    Update stores"
-       ${POOTLE_MANAGE} update_stores --project=${PROJECT} --language=templates >/dev/null 2>&1
+       ${POOTLE_MANAGE} update_stores --force --project=${PROJECT} --language=templates >/dev/null 2>&1
 
        # Add new languages if needed
        echo "[INFO]    Add new languages"
@@ -255,6 +261,4 @@ for PROJECT in ${PROJECTS}; do
        ${POOTLE_MANAGE} refresh_stats --project=${PROJECT} >/dev/null 2>&1
 done
 
-popd >/dev/null
-
 echo "[INFO]    ====== UPDATE FINISHED ======"