[or-cvs] [https-everywhere/master 3/5] added "uncommitted" target for makexpi.sh
pde at torproject.org
pde at torproject.org
Wed Nov 10 20:10:33 UTC 2010
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Tue, 9 Nov 2010 14:38:46 -0500
Subject: added "uncommitted" target for makexpi.sh
Commit: abbea034da969079a27d65dd3600265b109d3ee7
---
makexpi.sh | 40 +++++++++++++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/makexpi.sh b/makexpi.sh
index e408f8d..1e05d01 100755
--- a/makexpi.sh
+++ b/makexpi.sh
@@ -7,7 +7,10 @@ APP_NAME=https-everywhere
# invoke with no arguments to pull a prerelease of the current
# development point.
-# invoke with a tag name to build a specific branch.
+# invoke with the literal argument "uncommitted" to build from the
+# current src directory.
+
+# invoke with a tag name to build a specific branch or tag.
# e.g.:
# ./makexpi.sh 0.2.3.development.2
@@ -15,24 +18,47 @@ APP_NAME=https-everywhere
# or just:
# ./makexpi.sh
-if [ "$1" ] ; then
+# BUGS: if you have a branch or tagged named "uncommitted" then this
+# is kind of ambiguous.
+
+cd "$(dirname $0)"
+
+if [ -n "$1" ] && [ "$1" != "uncommitted" ]; then
VERSION="$1"
TARG="$1"
else
VERSION="$(grep em:version src/install.rdf | sed -e 's/[<>]/ /g' | cut -f3)~pre"
TARG=HEAD
- if [ -n "$(git status -s)" ] ; then
- printf "WARNING: There are uncommitted changes in your current repostitory.\nWARNING: These changes will not be included in the generated .xpi\nWARNING: Run 'git status' for information about the uncommitted changes.\n" >&2
+ if [ "$1" != "uncommitted" ] && [ -n "$(git status src -s)" ] ; then
+ printf >&2 "\
+WARNING: There are uncommitted changes in your current repostitory.
+WARNING: These changes will not be included in the generated .xpi
+WARNING: Run 'git status' for information about the uncommitted changes.
+WARNING: Or, use 'makexpi.sh uncommitted' to include them in the build.
+"
fi
fi
XPI_NAME="pkg/$APP_NAME-$VERSION.xpi"
-cd "$(dirname $0)/src"
-git archive --format=zip -9 "$TARG" . > "../$XPI_NAME"
+cd "src"
+if [ "$1" == "uncommitted" ]; then
+ printf >&2 "WARNING: using zip instead of git archive to build .xpi\n"
+ CHANGES="$(git status . -s)"
+ if [ -n "$CHANGES" ]; then
+ printf >&2 "WARNING: uncommitted changes were included:\n%s\n" "$CHANGES"
+ fi
+ # FIXME: is it really acceptable to reuse .gitignore to specify
+ # include patterns for /usr/bin/zip? It seems to work for our
+ # current patterns (2010-11-09)
+ zip -X -q -9r "../$XPI_NAME" . "-x at ../.gitignore"
+else
+ git archive --format=zip -9 "$TARG" . > "../$XPI_NAME"
+fi
+
ret="$?"
if [ "$ret" != 0 ]; then
rm -f "../$XPI_NAME"
exit "$?"
else
- echo Created $XPI_NAME
+ printf >&2 "Created %s\n" "$XPI_NAME"
fi
--
1.7.1
More information about the tor-commits
mailing list