78 TMP_VERSION="$1" |
78 TMP_VERSION="$1" |
79 URL_TO_CHECK="${LOCALES_URL}-${TMP_VERSION}" |
79 URL_TO_CHECK="${LOCALES_URL}-${TMP_VERSION}" |
80 |
80 |
81 LAST_FOUND="" |
81 LAST_FOUND="" |
82 # Unfortunately, locales-files are not associated to releases, but to builds. |
82 # Unfortunately, locales-files are not associated to releases, but to builds. |
83 # And since we don't know which build was the final build, we go from 1 to |
83 # And since we don't know which build was the final build, we go from 9 downwards |
84 # the last we find and try to find the latest one that exists. |
84 # try to find the latest one that exists (assuming there are no more than 9 builds). |
85 # Error only if not even the first one exists |
85 # Error only if not even the first one exists |
86 for BUILD_ID in $(seq 1 9); do |
86 for BUILD_ID in $(seq 9 -1 0); do |
87 FINAL_URL="${URL_TO_CHECK}-build${BUILD_ID}.json" |
87 FINAL_URL="${URL_TO_CHECK}-build${BUILD_ID}.json" |
88 if wget --quiet --spider "$FINAL_URL"; then |
88 if wget --quiet --spider "$FINAL_URL"; then |
89 LAST_FOUND="$FINAL_URL" |
89 LAST_FOUND="$FINAL_URL" |
90 elif [ $BUILD_ID -gt 1 ]; then |
90 break |
91 echo "$LAST_FOUND" |
|
92 return 0 |
|
93 else |
|
94 echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !" 1>&2 |
|
95 return 1 |
|
96 fi |
91 fi |
97 done |
92 done |
|
93 |
|
94 if [ "$LAST_FOUND" != "" ]; then |
|
95 echo "$LAST_FOUND" |
|
96 return 0 |
|
97 else |
|
98 echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !" 1>&2 |
|
99 return 1 |
|
100 fi |
98 } |
101 } |
99 |
102 |
100 function locales_parse() { |
103 function locales_parse() { |
101 URL="$1" |
104 URL="$1" |
102 curl -s "$URL" | python -c "import json; import sys; \ |
105 curl -s "$URL" | python -c "import json; import sys; \ |
158 wget https://ftp.mozilla.org/pub/$PRODUCT/releases/$VERSION$VERSION_SUFFIX/source/$SOURCE_TARBALL.asc |
161 wget https://ftp.mozilla.org/pub/$PRODUCT/releases/$VERSION$VERSION_SUFFIX/source/$SOURCE_TARBALL.asc |
159 fi |
162 fi |
160 |
163 |
161 # we might have an upstream archive already and can skip the checkout |
164 # we might have an upstream archive already and can skip the checkout |
162 if [ -e $SOURCE_TARBALL ]; then |
165 if [ -e $SOURCE_TARBALL ]; then |
163 if [ -z ${SKIP_LOCALES+x} ]; then |
166 if [ -z ${SKIP_LOCALES+x} ] && [ $LOCALES_CHANGED -ne 0 ]; then |
164 # still need to extract the locale information from the archive |
167 # still need to extract the locale information from the archive |
165 echo "extract locale changesets" |
168 echo "extract locale changesets" |
166 tar -xf $SOURCE_TARBALL $LOCALE_FILE |
169 tar -xf $SOURCE_TARBALL $LOCALE_FILE |
167 fi |
170 fi |
168 else |
171 else |
241 [ "$FF_RELEASE_TAG" == "default" ] || hg -R "l10n/$locale" up -C -r "$changeset" |
244 [ "$FF_RELEASE_TAG" == "default" ] || hg -R "l10n/$locale" up -C -r "$changeset" |
242 ;; |
245 ;; |
243 esac |
246 esac |
244 done |
247 done |
245 echo "creating l10n archive..." |
248 echo "creating l10n archive..." |
246 if [ "$PRODUCT" = "thunderbird" ]; then |
249 if [ "$PRODUCT" = "thunderbird" ]; then |
247 TB_TAR_FLAGS="--exclude=browser --exclude=suite" |
250 TB_TAR_FLAGS="--exclude=browser --exclude=suite" |
248 fi |
251 fi |
249 tar $compression -cf l10n-$VERSION$VERSION_SUFFIX.tar.xz \ |
252 tar $compression -cf l10n-$VERSION$VERSION_SUFFIX.tar.xz \ |
250 --exclude=.hgtags --exclude=.hgignore --exclude=.hg \ |
253 --exclude=.hgtags --exclude=.hgignore --exclude=.hg \ |
251 $TB_TAR_FLAGS \ |
254 $TB_TAR_FLAGS \ |
252 l10n |
255 l10n |
|
256 elif [ -f "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" ]; then |
|
257 # Locales did not change, but the old tar-ball is in this directory |
|
258 # Simply rename it: |
|
259 echo "Moving l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz to l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
|
260 mv "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" "l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
253 fi |
261 fi |
254 |
262 |
255 # compare-locales |
263 # compare-locales |
256 echo "creating compare-locales" |
264 echo "creating compare-locales" |
257 if [ -d compare-locales/.hg ]; then |
265 if [ -d compare-locales/.hg ]; then |