@@ -16,16 +16,14 @@ 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
21- if [ " $1 " == " --fast" ]; then
22- FAST=true
23- fi
2422
2523[ -d pkg ] || mkdir pkg
2624
2725# If the command line argument is a tag name, check that out and build it
28- if [ -n " $1 " ] && [ " $2 " != " --no-recurse" ] && [ -z " $FAST " ] ; then
26+ if [ -n " $1 " ] && [ " $2 " != " --no-recurse" ] ; then
2927 BRANCH=` git branch | head -n 1 | cut -d \ -f 2-`
3028 SUBDIR=checkout
3129 [ -d $SUBDIR ] || mkdir $SUBDIR
@@ -54,15 +52,20 @@ if [ -n "$1" ] && [ "$2" != "--no-recurse" ] && [ -z "$FAST" ] ; then
5452 exit 0
5553fi
5654
57- if [ -z " $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 15k+ 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
5862 # This is an optimization to get the OS reading the rulesets into RAM ASAP;
5963 # it's useful on machines with slow disk seek times; doing several of these
6064 # at once allows the IO subsystem to seek more efficiently.
6165 for firstchar in ` echo {a..z} {A..Z} {0..9}` ; do
6266 # Those cover everything but it wouldn't matter if they didn't
6367 nohup cat src/chrome/content/rules/" $firstchar " * .xml > /dev/null 2> /dev/null &
6468 done
65-
6669 echo " Generating sqlite DB"
6770 python2.7 ./utils/make-sqlite.py
6871fi
@@ -75,55 +78,15 @@ die() {
7578 exit 1
7679}
7780
78- if [ -z " $FAST " ] ; then
79- if python2.7 ./utils/trivial-validate.py --quiet --db $RULESETS_SQLITE >&2
80- then
81- echo Validation of included rulesets completed. >&2
82- echo >&2
83- else
84- die " Validation of rulesets failed."
85- fi
86-
87- # Check for xmllint.
88- type xmllint > /dev/null || die " xmllint not available"
89-
90- GRAMMAR=" utils/relaxng.xml"
91- if [ -f " $GRAMMAR " ]
92- then
93- # xmllint spams stderr with "<FILENAME> validates, even with the --noout
94- # flag. We can't grep -v for that line, because the pipeline will mask error
95- # status from xmllint. Instead we run it once going to /dev/null, and if
96- # there's an error run it again, showing only error output.
97- validate_grammar () {
98- find src/chrome/content/rules -name " *.xml" | \
99- xargs xmllint --noout --relaxng utils/relaxng.xml
100- }
101- if validate_grammar 2> /dev/null
102- then
103- echo Validation of rulesets against $GRAMMAR succeeded. >&2
104- else
105- validate_grammar 2>&1 | grep -v validates
106- die " Validation of rulesets against $GRAMMAR failed."
107- fi
108- else
109- echo Validation of rulesets against $GRAMMAR SKIPPED. >&2
110- fi
111-
112- if [ -x ./utils/compare-locales.sh ] >&2
113- then
114- if sh ./utils/compare-locales.sh >&2
115- then
116- echo Validation of included locales completed. >&2
117- else
118- die " Validation of locales failed."
119- fi
120- 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
12185fi
122- # =============== END VALIDATION ================
12386
12487# The name/version of the XPI we're building comes from src/install.rdf
12588XPI_NAME=" pkg/$APP_NAME -` grep em:version src/install.rdf | sed -e ' s/[<>]/ /g' | cut -f3` "
126- if [ " $1 " -a -z " $FAST " ] ; then
89+ if [ " $1 " ] ; then
12790 XPI_NAME=" $XPI_NAME "
12891else
12992 # During development, generate packages named with the short hash of HEAD.
139102cp -a src/ pkg/xpi-eff/
140103rm -r pkg/xpi-eff/chrome/content/rules
141104[ -e pkg/xpi-amo ] && rm -rf pkg/xpi-amo
142- cp -a src/ pkg/xpi-amo/
143- rm -r pkg/xpi-amo/chrome/content/rules
105+ cp -a pkg/xpi-eff/ pkg/xpi-amo/
144106# The AMO version of the package cannot contain the updateKey or updateURL tags
145107sed -i.bak -e ' /updateKey/d' -e ' /updateURL/d' pkg/xpi-amo/install.rdf
146108rm pkg/xpi-amo/install.rdf.bak
0 commit comments