Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version replaced with a placeholder.

  • Loading branch information...
commit 3e95339e094204db18a81ce72ed6841f3eadf4d2 1 parent 74ee90d
Tomaž Šolc authored
Showing with 35 additions and 1 deletion.
  1. +4 −1 makexpi.sh
  2. +31 −0 version.sh
5 makexpi.sh
View
@@ -37,13 +37,16 @@ else
fi
# The name/version of the XPI we're building comes from src/install.rdf
-XPI_NAME="$APP_NAME-`grep em:version xpi/install.rdf | sed -e 's/[<>]/ /g' | cut -f3`"
+VERSION=`grep em:version xpi/install.rdf | sed -e 's/[<>]/ /g' | cut -f3`
+XPI_NAME="$APP_NAME-$VERSION"
if [ "$1" ]; then
XPI_NAME="$XPI_NAME.xpi"
else
XPI_NAME="$XPI_NAME~pre.xpi"
fi
+../version.sh --add "$VERSION" xpi
+
# Build the XPI!
rm -f "../$XPI_NAME"
(cd xpi/chrome && zip -q -r -m "noscript.jar" *)
31 version.sh
View
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ "$#" -ne 3 ]; then
+ echo "USAGE: version.sh [--add|--strip] version path"
+ exit 1
+fi
+
+CMD=$1
+VERSION=$2
+TARGET=$3
+
+REGEX='.*\.\(dtd\|xul\|js\)'
+
+PLACEHOLDER="@VERSION@"
+
+if [ "$CMD" = "--add" ]; then
+ SED_SCRIPT="s/$PLACEHOLDER/$VERSION/g"
+elif [ "$CMD" = "--strip" ]; then
+ SED_SCRIPT="s/$VERSION/$PLACEHOLDER/g"
+ if find "$TARGET" -regex "$REGEX" -print0 | xargs -0 grep "$PLACEHOLDER"; then
+ echo "Placeholder $PLACEHOLDER already present in source when stripping version!"
+ exit 1
+ fi
+
+else
+ echo "Invalid option $CMD"
+ exit 1
+fi
+
+find "$TARGET" -regex "$REGEX" -print0 | \
+ xargs -0 sed -i -e "$SED_SCRIPT"
Please sign in to comment.
Something went wrong with that request. Please try again.