35 else |
35 else |
36 LOCALE_FILE="thunderbird-$VERSION/comm/mail/locales/l10n-changesets.json" |
36 LOCALE_FILE="thunderbird-$VERSION/comm/mail/locales/l10n-changesets.json" |
37 fi |
37 fi |
38 |
38 |
39 SOURCE_TARBALL="$PRODUCT-$VERSION$VERSION_SUFFIX.source.tar.xz" |
39 SOURCE_TARBALL="$PRODUCT-$VERSION$VERSION_SUFFIX.source.tar.xz" |
|
40 PREV_SOURCE_TARBALL="$PRODUCT-$PREV_VERSION$PREV_VERSION_SUFFIX.source.tar.xz" |
40 FTP_URL="https://ftp.mozilla.org/pub/$PRODUCT/releases/$VERSION$VERSION_SUFFIX/source" |
41 FTP_URL="https://ftp.mozilla.org/pub/$PRODUCT/releases/$VERSION$VERSION_SUFFIX/source" |
41 FTP_CANDIDATES_BASE_URL="https://ftp.mozilla.org/pub/$PRODUCT/candidates" |
42 FTP_CANDIDATES_BASE_URL="https://ftp.mozilla.org/pub/$PRODUCT/candidates" |
42 # Make first letter of PRODCUT upper case |
43 # Make first letter of PRODCUT upper case |
43 PRODUCT_CAP="${PRODUCT^}" |
44 PRODUCT_CAP="${PRODUCT^}" |
44 LOCALES_URL="https://product-details.mozilla.org/1.0/l10n/$PRODUCT_CAP" |
45 LOCALES_URL="https://product-details.mozilla.org/1.0/l10n/$PRODUCT_CAP" |
143 echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !" 1>&2 |
144 echo "Error: Could not find locales-file (json) for Firefox $TMP_VERSION !" 1>&2 |
144 return 1 |
145 return 1 |
145 fi |
146 fi |
146 } |
147 } |
147 |
148 |
148 function locales_parse() { |
149 function locales_parse_file() { |
|
150 FILE="$1" |
|
151 cat "$FILE" | python -c "import json; import sys; \ |
|
152 print('\n'.join(['{} {}'.format(key, value['revision']) \ |
|
153 for key, value in sorted(json.load(sys.stdin).items())]));" |
|
154 } |
|
155 |
|
156 function locales_parse_url() { |
149 URL="$1" |
157 URL="$1" |
150 curl -s "$URL" | python -c "import json; import sys; \ |
158 curl -s "$URL" | python -c "import json; import sys; \ |
151 print('\n'.join(['{} {}'.format(key, value['changeset']) \ |
159 print('\n'.join(['{} {}'.format(key, value['changeset']) \ |
152 for key, value in sorted(json.load(sys.stdin)['locales'].items())]));" |
160 for key, value in sorted(json.load(sys.stdin)['locales'].items())]));" |
|
161 } |
|
162 |
|
163 function extract_locales_file() { |
|
164 # still need to extract the locale information from the archive |
|
165 echo "extract locale changesets" |
|
166 tar -xf $SOURCE_TARBALL $LOCALE_FILE |
153 } |
167 } |
154 |
168 |
155 function locales_unchanged() { |
169 function locales_unchanged() { |
156 BUILD_ID="$1" |
170 BUILD_ID="$1" |
157 PREV_BUILD_ID=$(get_build_number "$PREV_VERSION$PREV_VERSION_SUFFIX") |
171 PREV_BUILD_ID=$(get_build_number "$PREV_VERSION$PREV_VERSION_SUFFIX") |
158 # If no json-file for one of the versions can be found, we say "they changed" |
172 # If no json-file for one of the versions can be found, we say "they changed" |
159 prev_url=$(locales_get "$PREV_VERSION$PREV_VERSION_SUFFIX" "$PREV_BUILD_ID") || return 1 |
173 prev_url=$(locales_get "$PREV_VERSION$PREV_VERSION_SUFFIX" "$PREV_BUILD_ID") || return 1 |
160 curr_url=$(locales_get "$VERSION$VERSION_SUFFIX" "$BUILD_ID") || return 1 |
174 prev_content=$(locales_parse_url "$prev_url") || exit 1 |
161 |
175 |
162 prev_content=$(locales_parse "$prev_url") || exit 1 |
176 curr_url=$(locales_get "$VERSION$VERSION_SUFFIX" "$BUILD_ID") |
163 curr_content=$(locales_parse "$curr_url") || exit 1 |
177 if [ $? -ne 0 ]; then |
|
178 # We did not find a locales file upstream on the servers |
|
179 if [ -e $SOURCE_TARBALL ]; then |
|
180 # We can find out what the locales are, by extracting the json-file from the tar-ball |
|
181 # instead of getting it from the server |
|
182 extract_locales_file || return 1 |
|
183 curr_content=$(locales_parse_file "$LOCALE_FILE") || exit 1 |
|
184 else |
|
185 # We can't know what the locales are in the current version |
|
186 return 1 |
|
187 fi |
|
188 else |
|
189 curr_content=$(locales_parse_url "$curr_url") || exit 1 |
|
190 fi |
164 |
191 |
165 diff -y --suppress-common-lines -d <(echo "$prev_content") <(echo "$curr_content") |
192 diff -y --suppress-common-lines -d <(echo "$prev_content") <(echo "$curr_content") |
166 } |
193 } |
167 |
194 |
168 # check required tools |
195 # check required tools |
209 fi |
236 fi |
210 |
237 |
211 # we might have an upstream archive already and can skip the checkout |
238 # we might have an upstream archive already and can skip the checkout |
212 if [ -e $SOURCE_TARBALL ]; then |
239 if [ -e $SOURCE_TARBALL ]; then |
213 if [ -z ${SKIP_LOCALES+x} ] && [ $LOCALES_CHANGED -ne 0 ]; then |
240 if [ -z ${SKIP_LOCALES+x} ] && [ $LOCALES_CHANGED -ne 0 ]; then |
214 # still need to extract the locale information from the archive |
241 extract_locales_file |
215 echo "extract locale changesets" |
|
216 tar -xf $SOURCE_TARBALL $LOCALE_FILE |
|
217 fi |
242 fi |
218 get_source_stamp "$BUILD_ID" |
243 get_source_stamp "$BUILD_ID" |
219 else |
244 else |
220 # We are working on a version that is not yet published on the mozilla mirror |
245 # We are working on a version that is not yet published on the mozilla mirror |
221 # so we have to actually check out the repo |
246 # so we have to actually check out the repo |
326 # Locales did not change, but the old tar-ball is in this directory |
351 # Locales did not change, but the old tar-ball is in this directory |
327 # Simply rename it: |
352 # Simply rename it: |
328 echo "Moving l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz to l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
353 echo "Moving l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz to l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
329 mv "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" "l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
354 mv "l10n-$PREV_VERSION$PREV_VERSION_SUFFIX.tar.xz" "l10n-$VERSION$VERSION_SUFFIX.tar.xz" |
330 fi |
355 fi |
|
356 |
|
357 if [ -e $PREV_SOURCE_TARBALL ]; then |
|
358 echo "" |
|
359 echo "Deleting old sources tarball $PREV_SOURCE_TARBALL" |
|
360 $(ask_cont_abort_question "Is this ok?") || exit 0 |
|
361 rm "$PREV_SOURCE_TARBALL" |
|
362 rm "$PREV_SOURCE_TARBALL.asc" |
|
363 fi |