MozillaFirefox/create-tar.sh
branchfirefox68
changeset 1098 538cbf0bbdca
parent 1097 840132a4a9b3
child 1111 97a6da6d7e29
--- a/MozillaFirefox/create-tar.sh	Wed Jul 10 08:14:34 2019 +0200
+++ b/MozillaFirefox/create-tar.sh	Fri Aug 30 23:43:39 2019 +0200
@@ -80,21 +80,24 @@
 
   LAST_FOUND=""
   # Unfortunately, locales-files are not associated to releases, but to builds.
-  # And since we don't know which build was the final build, we go from 1 to
-  # the last we find and try to find the latest one that exists.
+  # And since we don't know which build was the final build, we go from 9 downwards
+  # try to find the latest one that exists (assuming there are no more than 9 builds).
   # Error only if not even the first one exists
-  for BUILD_ID in $(seq 1 9); do
+  for BUILD_ID in $(seq 9 -1 0); do
     FINAL_URL="${URL_TO_CHECK}-build${BUILD_ID}.json"
     if wget --quiet --spider "$FINAL_URL"; then
       LAST_FOUND="$FINAL_URL"
-    elif [ $BUILD_ID -gt 1 ]; then
-      echo "$LAST_FOUND"
-      return 0
-    else
-      echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !"  1>&2
-      return 1
+      break
     fi
   done
+
+  if [ "$LAST_FOUND" != "" ]; then
+    echo "$LAST_FOUND"
+    return 0
+  else
+    echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !"  1>&2
+    return 1
+  fi
 }
 
 function locales_parse() {
@@ -160,7 +163,7 @@
 
 # we might have an upstream archive already and can skip the checkout
 if [ -e $SOURCE_TARBALL ]; then
-  if [ -z ${SKIP_LOCALES+x} ]; then
+  if [ -z ${SKIP_LOCALES+x} ] && [ $LOCALES_CHANGED -ne 0 ]; then
     # still need to extract the locale information from the archive
     echo "extract locale changesets"
     tar -xf $SOURCE_TARBALL $LOCALE_FILE
@@ -243,13 +246,18 @@
       esac
     done
   echo "creating l10n archive..."
-if [ "$PRODUCT" = "thunderbird" ]; then
+  if [ "$PRODUCT" = "thunderbird" ]; then
     TB_TAR_FLAGS="--exclude=browser --exclude=suite"
-fi
+  fi
   tar $compression -cf l10n-$VERSION$VERSION_SUFFIX.tar.xz \
   --exclude=.hgtags --exclude=.hgignore --exclude=.hg \
   $TB_TAR_FLAGS \
   l10n
+elif [ -f "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" ]; then
+  # Locales did not change, but the old tar-ball is in this directory
+  # Simply rename it:
+  echo "Moving l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz to l10n-$VERSION$VERSION_SUFFIX.tar.xz"
+  mv "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" "l10n-$VERSION$VERSION_SUFFIX.tar.xz"
 fi
 
 # compare-locales