Skip to content

Commit 79536a2

Browse files
committed
Remove make-sqlite.py & replace with make-json.py
Remove references to make-sqlite.py
1 parent 7b9d4f2 commit 79536a2

6 files changed

Lines changed: 11 additions & 44 deletions

File tree

‎Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ clean:
1212
rm -rf pkg/xpi-amo/ pkg/xpi-eff/
1313
rm -f pkg/*.xpi
1414
rm -f src/chrome/content/rules/default.rulesets
15-
rm -f src/defaults/rulesets.sqlite
1615

1716
.PHONY: clean prerelease

‎makecrx.sh‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
# releases signed by EFF :/. We should find a more elegant arrangement.
2121

2222
cd $(dirname $0)
23-
RULESETS_UNVALIDATED="$PWD/pkg/rulesets.unvalidated.sqlite"
24-
RULESETS_SQLITE="$PWD/src/defaults/rulesets.sqlite"
23+
RULESETS_JSON="$PWD/pkg/rulesets.json"
2524

2625
if [ -n "$1" ]; then
2726
BRANCH=`git branch | head -n 1 | cut -d \ -f 2-`
@@ -42,14 +41,12 @@ echo "Building chrome version" $VERSION
4241
# Only generate the sqlite database if any rulesets have changed. Tried
4342
# implementing this with make, but make is very slow with 15k+ input files.
4443
needs_update() {
45-
find src/chrome/content/rules/ -newer $RULESETS_UNVALIDATED |\
44+
find src/chrome/content/rules/ -newer $RULESETS_JSON |\
4645
grep -q .
4746
}
48-
if [ ! -f "$RULESETS_UNVALIDATED" ] || needs_update ; then
49-
# Build the SQLite DB even though we don't yet use it in the Chrome extension,
50-
# because trivial-validate.py depends on it.
51-
echo "Generating sqlite DB"
52-
python2.7 ./utils/make-sqlite.py && bash utils/validate.sh
47+
if [ ! -f "$RULESETS_JSON" ] || needs_update ; then
48+
echo "Generating ruleset DB"
49+
python2.7 ./utils/make-json.py && bash utils/validate.sh
5350
fi
5451

5552
sed -e "s/VERSION/$VERSION/g" chromium/updates-master.xml > chromium/updates.xml

‎makexpi.sh‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ APP_NAME=https-everywhere
1616
# ./makexpi.sh 0.2.3.development.2
1717

1818
cd "`dirname $0`"
19-
RULESETS_UNVALIDATED="$PWD/pkg/rulesets.unvalidated.sqlite"
20-
RULESETS_JSON="$PWD/src/defaults/rulesets.json"
19+
RULESETS_JSON="$PWD/pkg/rulesets.json"
2120
ANDROID_APP_ID=org.mozilla.firefox
2221
VERSION=`echo $1 | cut -d "-" -f 2`
2322

@@ -58,10 +57,10 @@ fi
5857
# Only generate the ruleset database if any rulesets have changed. Tried
5958
# implementing this with make, but make is very slow with 15k+ input files.
6059
needs_update() {
61-
find src/chrome/content/rules/ -newer $RULESETS_UNVALIDATED |\
60+
find src/chrome/content/rules/ -newer $RULESETS_JSON |\
6261
grep -q .
6362
}
64-
if [ ! -f "$RULESETS_UNVALIDATED" ] || needs_update ; then
63+
if [ ! -f "$RULESETS_JSON" ] || needs_update ; then
6564
# This is an optimization to get the OS reading the rulesets into RAM ASAP;
6665
# it's useful on machines with slow disk seek times; doing several of these
6766
# at once allows the IO subsystem to seek more efficiently.
@@ -70,7 +69,7 @@ if [ ! -f "$RULESETS_UNVALIDATED" ] || needs_update ; then
7069
nohup cat src/chrome/content/rules/"$firstchar"*.xml >/dev/null 2>/dev/null &
7170
done
7271
echo "Generating ruleset DB"
73-
python2.7 ./utils/make-sqlite.py
72+
python2.7 ./utils/make-json.py
7473
fi
7574

7675
# =============== BEGIN VALIDATION ================

‎src/chrome.manifest‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
content https-everywhere chrome/content/
2-
override chrome://https-everywhere/content/rulesets.sqlite defaults/rulesets.sqlite
32

43
locale https-everywhere en chrome/locale/en/
54
locale https-everywhere ar chrome/locale/ar/

‎test/firefox.sh‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,5 @@ fi
7878

7979
popd
8080

81-
# Echo the version of sqlite3, since the determinism of the build depends on
82-
# having the same version.
83-
echo "To reproduce this build (https://wiki.debian.org/ReproducibleBuilds)," \
84-
"please use this version of sqlite3:"
85-
sqlite3 -version
8681
shasum=$(openssl sha -sha256 "$XPI_NAME")
8782
echo -e "Git commit `git rev-parse HEAD`\n$shasum"
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env python2.7
22
#
3-
# Builds an sqlite DB and a JSON DB containing all the rulesets, indexed by target.
4-
# The sqlite DB is used by trivial-validate.py. The JSON DB is used by the
5-
# Firefox addon.
3+
# Builds a JSON DB containing all the rulesets, indexed by target.
4+
# The JSON DB is used by the Firefox addon.
65
#
76

87
import glob
@@ -24,20 +23,6 @@
2423
locale.setlocale(locale.LC_ALL, 'C')
2524

2625
json_path = os.path.join(os.path.dirname(__file__), '../pkg/rulesets.json')
27-
# Removing the file before we create it avoids some non-determinism.
28-
db_path = os.path.join(os.path.dirname(__file__), '../pkg/rulesets.unvalidated.sqlite')
29-
if os.path.isfile(db_path):
30-
os.remove(db_path)
31-
conn = sqlite3.connect(db_path)
32-
c = conn.cursor()
33-
c.execute('''DROP TABLE IF EXISTS rulesets''')
34-
c.execute('''CREATE TABLE rulesets
35-
(id INTEGER PRIMARY KEY,
36-
contents TEXT)''')
37-
c.execute('''DROP TABLE IF EXISTS targets''')
38-
c.execute('''CREATE TABLE targets
39-
(host TEXT,
40-
ruleset_id INTEGER)''')
4126

4227
json_output = {
4328
"rulesetStrings": [],
@@ -96,18 +81,11 @@
9681
# FF version can find it.
9782
xpath_ruleset(tree)[0].attrib["f"] = os.path.basename(fi).decode(encoding="UTF-8")
9883

99-
c.execute('''INSERT INTO rulesets (contents) VALUES(?)''', (etree.tostring(tree),))
100-
ruleset_id = c.lastrowid
10184
for target in targets:
102-
c.execute('''INSERT INTO targets (host, ruleset_id) VALUES(?, ?)''', (target, ruleset_id))
10385
# id is the current length of the rules list - i.e. the offset at which
10486
# this rule will be added in the list.
10587
json_output["targets"][target].append(len(json_output["rulesetStrings"]))
10688
json_output["rulesetStrings"].append(etree.tostring(tree))
10789

108-
conn.commit()
109-
conn.execute("VACUUM")
110-
conn.close()
111-
11290
with open(json_path, 'w') as f:
11391
f.write(json.dumps(json_output))

0 commit comments

Comments
 (0)