Mercurial > kallithea
annotate scripts/validate-commits @ 8131:f254dd2f9dcb
setup: bump ipaddr minium version to 2.2.0 to get py3 support
2.2.0 is also the latest version, but released in 2017.
Previous versions failed installation on py3 with:
File "/tmp/pip-install-o31ka351/ipaddr/ipaddr.py", line 1450
ip_int = 0L
^
SyntaxError: invalid syntax
----------------------------------------
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 03 Jan 2020 23:49:19 +0100 |
parents | 37ac2ac0a9ae |
children | aa6f17a53b49 |
rev | line source |
---|---|
7902
37ac2ac0a9ae
scripts/validate-commits: use direct /bin/bash interpreter
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7841
diff
changeset
|
1 #!/bin/bash |
7503
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
2 # Validate the specified commits against test suite and other checks. |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
3 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
4 if [ -n "$VIRTUAL_ENV" ]; then |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
5 echo "Please run this script from outside a virtualenv." |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
6 exit 1 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
7 fi |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
8 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
9 if ! hg update --check -q .; then |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
10 echo "Working dir is not clean, please commit/revert changes first." |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
11 exit 1 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
12 fi |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
13 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
14 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX) |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
15 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX) |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
16 echo > "$resultfile" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
17 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
18 cleanup() |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
19 { |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
20 rm -rf /tmp/kallithea-test* |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
21 rm -rf "$venv" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
22 } |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
23 finish() |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
24 { |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
25 cleanup |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
26 # print (possibly intermediate) results |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
27 cat "$resultfile" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
28 rm "$resultfile" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
29 } |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
30 trap finish EXIT |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
31 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
32 for rev in $(hg log -r "$1" -T '{node}\n'); do |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
33 hg log -r "$rev" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
34 hg update "$rev" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
35 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
36 cleanup |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
37 virtualenv -p "$(command -v python2)" "$venv" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
38 source "$venv/bin/activate" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
39 pip install --upgrade pip setuptools |
7841
d9e37f7fd35b
docs: always use dev_requirements.txt together with main version constraints in setup.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7503
diff
changeset
|
40 pip install -e . -r dev_requirements.txt python-ldap python-pam |
7503
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
41 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
42 # run-all-cleanup |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
43 scripts/run-all-cleanup |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
44 if ! hg update --check -q .; then |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
45 echo "run-all-cleanup did not give clean results!" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
46 result="NOK" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
47 hg diff |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
48 hg revert -a |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
49 else |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
50 result=" OK" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
51 fi |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
52 echo "$result: $rev (run-all-cleanup)" >> "$resultfile" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
53 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
54 # pytest |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
55 if py.test; then |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
56 result=" OK" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
57 else |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
58 result="NOK" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
59 fi |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
60 echo "$result: $rev (pytest)" >> "$resultfile" |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
61 |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
62 deactivate |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
63 echo |
69f70de15f26
scripts: add developer script validate-commits
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
64 done |