MozillaFirefox/create-tar.sh
branchfirefox101
changeset 1174 90e3d0cf8567
parent 1173 56ecd2ae6e61
child 1184 1c3d3217d679
--- a/MozillaFirefox/create-tar.sh	Sun May 01 18:18:56 2022 +0200
+++ b/MozillaFirefox/create-tar.sh	Sun Jun 12 16:05:04 2022 +0200
@@ -37,7 +37,6 @@
 fi
 
 SOURCE_TARBALL="$PRODUCT-$VERSION$VERSION_SUFFIX.source.tar.xz"
-PREV_SOURCE_TARBALL="$PRODUCT-$PREV_VERSION$PREV_VERSION_SUFFIX.source.tar.xz"
 FTP_URL="https://ftp.mozilla.org/pub/$PRODUCT/releases/$VERSION$VERSION_SUFFIX/source"
 FTP_CANDIDATES_BASE_URL="https://ftp.mozilla.org/pub/$PRODUCT/candidates"
 # Make first letter of PRODCUT upper case
@@ -146,48 +145,22 @@
   fi
 }
 
-function locales_parse_file() {
-  FILE="$1"
-  cat "$FILE" | python -c "import json; import sys; \
-             print('\n'.join(['{} {}'.format(key, value['revision']) \
-                for key, value in sorted(json.load(sys.stdin).items())]));"
-}
-
-function locales_parse_url() {
+function locales_parse() {
   URL="$1"
   curl -s "$URL" | python -c "import json; import sys; \
              print('\n'.join(['{} {}'.format(key, value['changeset']) \
                 for key, value in sorted(json.load(sys.stdin)['locales'].items())]));"
 }
 
-function extract_locales_file() {
-    # still need to extract the locale information from the archive
-    echo "extract locale changesets"
-    tar -xf $SOURCE_TARBALL $LOCALE_FILE
-}
-
 function locales_unchanged() {
   BUILD_ID="$1"
   PREV_BUILD_ID=$(get_build_number "$PREV_VERSION$PREV_VERSION_SUFFIX")
   # If no json-file for one of the versions can be found, we say "they changed"
   prev_url=$(locales_get "$PREV_VERSION$PREV_VERSION_SUFFIX" "$PREV_BUILD_ID") || return 1
-  prev_content=$(locales_parse_url "$prev_url") || exit 1
+  curr_url=$(locales_get "$VERSION$VERSION_SUFFIX" "$BUILD_ID")           || return 1
 
-  curr_url=$(locales_get "$VERSION$VERSION_SUFFIX" "$BUILD_ID")
-  if [ $? -ne 0 ]; then
-    # We did not find a locales file upstream on the servers
-    if [ -e $SOURCE_TARBALL ]; then
-        # We can find out what the locales are, by extracting the json-file from the tar-ball
-        # instead of getting it from the server
-        extract_locales_file || return 1
-        curr_content=$(locales_parse_file "$LOCALE_FILE") || exit 1
-      else 
-        # We can't know what the locales are in the current version
-        return 1
-      fi
-  else
-    curr_content=$(locales_parse_url "$curr_url") || exit 1
-  fi
+  prev_content=$(locales_parse "$prev_url") || exit 1
+  curr_content=$(locales_parse "$curr_url") || exit 1
 
   diff -y --suppress-common-lines -d <(echo "$prev_content") <(echo "$curr_content")
 }
@@ -238,7 +211,9 @@
 # we might have an upstream archive already and can skip the checkout
 if [ -e $SOURCE_TARBALL ]; then
   if [ -z ${SKIP_LOCALES+x} ] && [ $LOCALES_CHANGED -ne 0 ]; then
-    extract_locales_file
+    # still need to extract the locale information from the archive
+    echo "extract locale changesets"
+    tar -xf $SOURCE_TARBALL $LOCALE_FILE
   fi
   get_source_stamp "$BUILD_ID"
 else
@@ -353,11 +328,3 @@
   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
-
-if [ -e $PREV_SOURCE_TARBALL ]; then
-    echo ""
-    echo "Deleting old sources tarball $PREV_SOURCE_TARBALL"
-    $(ask_cont_abort_question "Is this ok?") || exit 0
-    rm "$PREV_SOURCE_TARBALL"
-    rm "$PREV_SOURCE_TARBALL.asc"
-fi