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
|
envsubst = perl -pe 's/@([A-Z_]+)@/$$ENV{$$1} or die "$$1 undefined"/eg'
apt = apt-get install -yq --force-yes
britney_branch = lp:~ubuntu-release/britney/britney2-ubuntu
britney_path = /var/lib/britney
britney_prefix = /tmp/britney_
britney_hints_path = $(britney_prefix)hints
britney_hints = lp:~ubuntu-release/britney/hints-ubuntu
check:
python3 -m coverage run -m nose2
python3 -m coverage report --include="t*/*,b*/*" --show-missing --fail-under=100
find -name '*.py' | xargs python3 -m pyflakes
find -name '*.py' | xargs python3 -m pep8
find -name '*.py' | xargs python3 -m pylint --disable attribute-defined-outside-init,broad-except,fixme,import-error,interface-not-implemented,invalid-name,no-init,no-member,no-name-in-module,no-self-use,no-value-for-parameter,protected-access,star-args,too-few-public-methods,too-many-ancestors,too-many-arguments,too-many-instance-attributes,too-many-public-methods,unsubscriptable-object,unused-argument,unused-variable
devel:
./run.py
install-common-deps:
$(apt) python3-requests python3-launchpadlib python3-flask python3-flask-openid python3-flask-sqlalchemy python3-sqlalchemy python3-gunicorn
install-test-deps: install-common-deps
$(apt) python3-pyflakes || $(apt) pyflakes
$(apt) pylint3 python3-pep8 python3-nose2 python3-coverage python3-mock
install-nagios:
mkdir --parents /usr/local/lib/nagios/plugins/ /etc/nagios/nrpe.d
cp files/check_bileto.sh /usr/local/lib/nagios/plugins/check_bileto.sh
cp files/check_bileto.cfg /etc/nagios/nrpe.d
chmod 755 /usr/local/lib/nagios/plugins/check_bileto.sh
install: install-common-deps install-nagios
$(apt) uuid tree python3-yaml python3-amqplib python3-psycopg2 gunicorn3 supervisor postgresql-client
$(envsubst) <files/supervisor.conf >/etc/supervisor/conf.d/bileto.conf
# Branch branches if necessary
[ -d "$(britney_path)" ] || bzr branch $(britney_branch) $(britney_path)
[ -d "$(britney_hints_path)" ] || bzr branch $(britney_hints) $(britney_hints_path)
# Misc files
cp files/cron /etc/cron.d/bileto
cp files/logrotate.conf /etc/logrotate.d/bileto
./scripts/update.sh
rm -rf /etc/cron.daily/expire-britney-output # TODO: drop this transition
install-user:
[ -f "$$HOME/bileto.api.token" ] || uuid > "$$HOME/bileto.api.token"
uuid > "$$HOME/bileto.instance.id"
uuid > "$$HOME/bileto.session.key"
mkdir --parents $(britney_prefix)data $(britney_prefix)output
./db_migrations.sh
|