@@ -7,30 +7,59 @@ APP_NAME=https-everywhere
77# invoke with no arguments to pull a prerelease of the current
88# development point.
99
10- # invoke with a tag name to build a specific branch.
10+ # invoke with the literal argument "uncommitted" to build from the
11+ # current src directory.
12+
13+ # invoke with a tag name to build a specific branch or tag.
1114
1215# e.g.:
1316# ./makexpi.sh 0.2.3.development.2
1417
1518# or just:
1619# ./makexpi.sh
1720
18- if [ " $1 " ] ; then
21+ # BUGS: if you have a branch or tagged named "uncommitted" then this
22+ # is kind of ambiguous.
23+
24+ cd " $( dirname $0 ) "
25+
26+ if [ -n " $1 " ] && [ " $1 " != " uncommitted" ]; then
1927 VERSION=" $1 "
2028 TARG=" $1 "
2129else
2230 VERSION=" $( grep em:version src/install.rdf | sed -e ' s/[<>]/ /g' | cut -f3) ~pre"
2331 TARG=HEAD
32+ if [ " $1 " != " uncommitted" ] && [ -n " $( git status src -s) " ] ; then
33+ printf >&2 " \
34+ WARNING: There are uncommitted changes in your current repostitory.
35+ WARNING: These changes will not be included in the generated .xpi
36+ WARNING: Run 'git status' for information about the uncommitted changes.
37+ WARNING: Or, use 'makexpi.sh uncommitted' to include them in the build.
38+ "
39+ fi
2440fi
2541XPI_NAME=" pkg/$APP_NAME -$VERSION .xpi"
2642[ -d pkg ] || mkdir pkg
2743
28- cd " $( dirname $0 ) /src"
29- git archive --format=zip -9 " $TARG " . > " ../$XPI_NAME "
44+ cd " src"
45+ if [ " $1 " = " uncommitted" ]; then
46+ printf >&2 " WARNING: using zip instead of git archive to build .xpi\n"
47+ CHANGES=" $( git status . -s) "
48+ if [ -n " $CHANGES " ]; then
49+ printf >&2 " WARNING: uncommitted changes were included:\n%s\n" " $CHANGES "
50+ fi
51+ # FIXME: is it really acceptable to reuse .gitignore to specify
52+ # include patterns for /usr/bin/zip? It seems to work for our
53+ # current patterns (2010-11-09)
54+ zip -X -q -9r " ../$XPI_NAME " . " -x@../.gitignore"
55+ else
56+ git archive --format=zip -9 " $TARG " . > " ../$XPI_NAME "
57+ fi
58+
3059ret=" $? "
3160if [ " $ret " != 0 ]; then
3261 rm -f " ../$XPI_NAME "
3362 exit " $? "
3463else
35- echo Created $XPI_NAME
64+ printf >&2 " Created %s\n " " $XPI_NAME "
3665fi
0 commit comments