Skip to content

Commit 55a7ab0

Browse files
committed
Modify makexpi to build EFF and AMO versions.
AMO version doesn't include updateKey and updateURL.
1 parent 3bcf833 commit 55a7ab0

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

makexpi.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,18 @@ else
129129
if ! git diff-index --quiet HEAD; then
130130
XPI_NAME="$XPI_NAME-dirty"
131131
fi
132-
XPI_NAME="$XPI_NAME.xpi"
133132
fi
134133

134+
# Prepare packages suitable for uploading to EFF and AMO, respectively.
135135
[ -d pkg ] || mkdir pkg
136+
[ -e pkg/xpi-eff ] && rm -rf pkg/xpi-eff
137+
cp -a src/ pkg/xpi-eff/
138+
rm -r pkg/xpi-eff/chrome/content/rules
139+
[ -e pkg/xpi-amo ] && rm -rf pkg/xpi-amo
140+
cp -a src/ pkg/xpi-amo/
141+
rm -r pkg/xpi-amo/chrome/content/rules
142+
# The AMO version of the package cannot contain the updateKey or updateURL tags
143+
sed -i -e '/updateKey/d' -e '/updateURL/d' pkg/xpi-amo/install.rdf
136144

137145
# Used for figuring out which branch to pull from when viewing source for rules
138146
GIT_OBJECT_FILE=".git/refs/heads/master"
@@ -141,27 +149,19 @@ if [ -e "$GIT_OBJECT_FILE" ]; then
141149
export GIT_COMMIT_ID=$(cat "$GIT_OBJECT_FILE")
142150
fi
143151

144-
cd src
145-
146-
147152
# Build the XPI!
148-
rm -f "../$XPI_NAME"
149-
#zip -q -X -9r "../$XPI_NAME" . "-x@../.build_exclusions"
153+
rm -f "${XPI_NAME}.xpi"
154+
rm -f "${XPI_NAME}-amo.xpi"
155+
python2.7 utils/create_xpi.py -n "${XPI_NAME}.xpi" -x ".build_exclusions" "pkg/xpi-eff"
156+
python2.7 utils/create_xpi.py -n "${XPI_NAME}-amo.xpi" -x ".build_exclusions" "pkg/xpi-amo"
150157

151-
python2.7 ../utils/create_xpi.py -n "../$XPI_NAME" -x "../.build_exclusions" "."
158+
echo >&2 "Total included rules: `sqlite3 $RULESETS_SQLITE 'select count(*) from rulesets'`"
159+
echo >&2 "Rules disabled by default: `find src/chrome/content/rules -name "*.xml" | xargs grep -F default_off | wc -l`"
160+
echo >&2 "Created ${XPI_NAME}.xpi and ${XPI_NAME}-amo.xpi"
152161

153-
ret="$?"
154-
if [ "$ret" != 0 ]; then
155-
rm -f "../$XPI_NAME"
156-
exit "$?"
157-
else
158-
echo >&2 "Total included rules: `sqlite3 $RULESETS_SQLITE 'select count(*) from rulesets'`"
159-
echo >&2 "Rules disabled by default: `find chrome/content/rules -name "*.xml" | xargs grep -F default_off | wc -l`"
160-
echo >&2 "Created $XPI_NAME"
161-
../utils/android-push.sh "$XPI_NAME"
162-
if [ -n "$BRANCH" ]; then
163-
cd ../..
164-
cp $SUBDIR/$XPI_NAME pkg
165-
rm -rf $SUBDIR
166-
fi
162+
bash utils/android-push.sh "$XPI_NAME.xpi"
163+
164+
if [ -n "$BRANCH" ]; then
165+
cp $SUBDIR/$XPI_NAME pkg
166+
rm -rf $SUBDIR
167167
fi

utils/create_xpi.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
"""
99

1010
import argparse
11-
import zipfile_deterministic as zipfile
12-
import sys
1311
import glob
12+
import os
13+
import sys
14+
import zipfile_deterministic as zipfile
1415

1516
parser = argparse.ArgumentParser(
1617
description="Deterministic XPI file creator.")
@@ -34,5 +35,6 @@
3435

3536
xpiFile = zipfile.ZipFile(args.xpiname, mode='w', compression=compress)
3637

37-
xpiFile.write_from_directory(args.directory, exclusions, compress_type=compress)
38+
os.chdir(args.directory)
39+
xpiFile.write_from_directory(".", exclusions, compress_type=compress)
3840
xpiFile.close()

0 commit comments

Comments
 (0)