forked from Khan/jenkins-jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-all-pot-pickle.sh
executable file
·68 lines (54 loc) · 2.59 KB
/
create-all-pot-pickle.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash -xe
# This script is run by the jenkins 'i18n-create-all-pot-pickle' job
# Step 1: Updating the webapp repo for automated-commits and translations.
# This step ensures that translations submodule is in sync for master.
# Step 2: Extract and download the sync snapshot of article content
# Step 3: Graphie images (from the sync snapshot) are collected
# as they contain translatable strings
# Step 4: Call build/kake/build_prod_main.py to create the all.pot file.
( cd webapp && make install_deps )
DATA_DIR=`readlink -f /mnt/webapp-i18n-data`
echo "Updating the webapp repo."
# We do our work in the 'automated-commits' branch.
jenkins-jobs/safe_git.sh pull_in_branch webapp automated-commits
# ...which we want to make sure is up-to-date with master.
jenkins-jobs/safe_git.sh merge_from_master webapp automated-commits
# We also make sure the intl/translations sub-repo is up to date.
jenkins-jobs/safe_git.sh pull webapp/intl/translations
cd webapp
echo "Starting update_strings job at $(date +%H:%M:%S)"
# find_graphie_images_in_items.js needs this snapshot of article content in
# order to extract images from articles.
echo "Starting extracting sync snapshot at $(date +%H%M)"
gsutil cp gs://ka_dev_sync/snapshot_en snapshot_en
tools/extract_lintable_content.py \
--articles \
--input snapshot_en \
--output article_content.zip
echo "Ending extracting sync snapshot at $(date +%H:%M:%S)"
# find_graphie_images_in_items.js caches items here, so we create the directory
# for it.
echo "Starting updating the list of graphie images at $(date +%H:%M:%S)"
mkdir -p genfiles/assessment_items
dev/tools/run_js_in_node.js content-editing/tools/find_graphie_images_in_items.js
echo "Ending updating the list of graphie images at $(date +%H%M)"
echo "Starting to create a new, up-to-date all.pot at $(date +%H:%M:%S)"
rm -f genfiles/extracted_strings/en/intl/datastore.pot.pickle
echo "Starting build_prod_main $(date +%H:%M:%S)"
build/kake/build_prod_main.py -v3 pot
# This is where build_prod_main.py puts the output all.pot
echo "Ending build_prod_main $(date +%H:%M:%S)"
ALL_POT="$PWD"/genfiles/translations/all.pot.pickle
echo "Sanity check: will fail if the all.pot is missing stuff."
[ `strings "$ALL_POT" | wc -l` -gt 3000000 ]
strings "$ALL_POT" | grep -q 'intl/datastore'
echo "Ending create of all.pot at $(date +%H:%M:%S)"
# Update export timestamps for fake languages.
mark_fake_langs=`cat <<PYCOMMAND
from deploy import download_i18n
download_i18n.mark_strings_export('accents')
download_i18n.mark_strings_export('boxes')
PYCOMMAND
`
python -c "$mark_fake_langs"
cp "$ALL_POT" "$DATA_DIR"/all.pot