File: update

package info (click to toggle)
https-everywhere 3.5.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 15,888 kB
  • sloc: xml: 29,560; python: 1,825; sh: 310; makefile: 36
file content (62 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
#
# Hook script to validate rules and check locales before accepting
# pushed changes on the server side. 
# See http://stackoverflow.com/questions/4541417/how-can-i-make-it-so-git-rejects-pushing-code-that-wont-compile
#
# By default, this should run in the root of the git repository.

# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"

# --- Safety check
if [ -z "$GIT_DIR" ]; then
	echo "Don't run this script from the command line." >&2
	echo " (if you want, you could supply GIT_DIR then run" >&2
	echo "  $0 <ref> <oldrev> <newrev>)" >&2
	exit 1
fi

if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
	exit 1
fi

# --- Copy the state of the repository as of the new pushed code

maindir=$(git rev-parse --show-toplevel)
cd "$maindir"
copydir="./tmp/git_hook_compile_copy"

echo "making copy of $newrev to $copydir" >&2
rm -rf "$copydir"
mkdir "$copydir"
git archive $newrev | tar -x -C $copydir/
if [ "$?" != "0" ]; then
	echo "*** unable to make copy of code" >&2
	exit 1
fi
echo "attempting to validate $newrev" >&2

# --- Test build

if [ -f makexpi.sh && -f makecrx.sh ]; then
	./makexpi.sh
	XPIBULID=$?
	
	./makecrx.sh
	CRXBUILD=$?
	
	if [ "$XPIBULID" != 0 || "$CRXBUILD" != 0 ]; then
		echo "*** build failed" >&2
		exit 1
	else
		exit 0
	fi
else
	echo "*** could not find makexpi.sh or makecrx.sh." >&2
	exit 1
fi