@@ -16,6 +16,7 @@ APP_NAME=https-everywhere
1616# ./makexpi.sh 0.2.3.development.2
1717
1818cd " ` dirname $0 ` "
19+ RULESETS_UNVALIDATED=" $PWD /pkg/rulesets.unvalidated.sqlite"
1920RULESETS_SQLITE=" $PWD /src/defaults/rulesets.sqlite"
2021ANDROID_APP_ID=org.mozilla.firefox
2122
@@ -51,15 +52,20 @@ if [ -n "$1" ] && [ "$2" != "--no-recurse" ] && [ "$1" != "--fast" ] ; then
5152 exit 0
5253fi
5354
54- if [ " $1 " != " --fast" -o ! -f " $RULESETS_SQLITE " ] ; then
55+ # Only generate the sqlite database if any rulesets have changed. Tried
56+ # implementing this with make, but make is very slow with 11k+ input files.
57+ needs_update () {
58+ find src/chrome/content/rules/ -newer $RULESETS_UNVALIDATED | \
59+ grep -q .
60+ }
61+ if [ ! -f " $RULESETS_UNVALIDATED " ] || needs_update ; then
5562 # This is an optimization to get the OS reading the rulesets into RAM ASAP;
5663 # it's useful on machines with slow disk seek times; doing several of these
5764 # at once allows the IO subsystem to seek more efficiently.
5865 for firstchar in ` echo {a..z} {A..Z} {0..9}` ; do
5966 # Those cover everything but it wouldn't matter if they didn't
6067 nohup cat src/chrome/content/rules/" $firstchar " * .xml > /dev/null 2> /dev/null &
6168 done
62-
6369 echo " Generating sqlite DB"
6470 python2.7 ./utils/make-sqlite.py
6571fi
@@ -72,51 +78,11 @@ die() {
7278 exit 1
7379}
7480
75- if [ " $1 " != " --fast" -a -z " $FAST " ] ; then
76- if python2.7 ./utils/trivial-validate.py --quiet --db $RULESETS_SQLITE >&2
77- then
78- echo Validation of included rulesets completed. >&2
79- echo >&2
80- else
81- die " Validation of rulesets failed."
82- fi
83-
84- # Check for xmllint.
85- type xmllint > /dev/null || die " xmllint not available"
86-
87- GRAMMAR=" utils/relaxng.xml"
88- if [ -f " $GRAMMAR " ]
89- then
90- # xmllint spams stderr with "<FILENAME> validates, even with the --noout
91- # flag. We can't grep -v for that line, because the pipeline will mask error
92- # status from xmllint. Instead we run it once going to /dev/null, and if
93- # there's an error run it again, showing only error output.
94- validate_grammar () {
95- find src/chrome/content/rules -name " *.xml" | \
96- xargs xmllint --noout --relaxng utils/relaxng.xml
97- }
98- if validate_grammar 2> /dev/null
99- then
100- echo Validation of rulesets against $GRAMMAR succeeded. >&2
101- else
102- validate_grammar 2>&1 | grep -v validates
103- die " Validation of rulesets against $GRAMMAR failed."
104- fi
105- else
106- echo Validation of rulesets against $GRAMMAR SKIPPED. >&2
107- fi
108-
109- if [ -x ./utils/compare-locales.sh ] >&2
110- then
111- if sh ./utils/compare-locales.sh >&2
112- then
113- echo Validation of included locales completed. >&2
114- else
115- die " Validation of locales failed."
116- fi
117- fi
81+ # If the unvalidated rulesets have changed, validate and copy to the validated
82+ # rulesets file.
83+ if [ " $RULESETS_UNVALIDATED " -nt " $RULESETS_SQLITE " ] ; then
84+ bash utils/validate.sh
11885fi
119- # =============== END VALIDATION ================
12086
12187# The name/version of the XPI we're building comes from src/install.rdf
12288XPI_NAME=" pkg/$APP_NAME -` grep em:version src/install.rdf | sed -e ' s/[<>]/ /g' | cut -f3` "
0 commit comments