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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/bash
ORG="capomastro"
PROJECT="capomastro"
CODE_TREE="https://github.com/${ORG}/${PROJECT}.git"
CODE_BRANCH="" # prefix -b
VCS_CHECKOUT="git clone ${CODE_BRANCH} --single-branch ${CODE_TREE}"
echo "Building a capomastro tarball to deploy..."
rm -rf ${PROJECT}
`${VCS_CHECKOUT}`
pushd ${PROJECT}
# Add the wsgi file that will bootstrap the virtualenv
cat << EOF > capomastro_wsgi.py
"""
WSGI config for capomastro project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
app_root = os.path.dirname(os.path.realpath(__file__))
activate_this = os.path.join(app_root, 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "capomastro.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
EOF
# Add the management command that will bootstrap the virtualenv
cat << EOF > manage.py
#!/usr/bin/env python
import os
import sys
app_root = os.path.dirname(os.path.realpath(__file__))
activate_this = os.path.join(app_root, 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "capomastro.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
EOF
cat << EOF > canonical-requirements.txt
-r requirements.txt
python-openid==2.2.5
django-openid-auth==0.5.1
EOF
virtualenv .
echo $(git rev-parse HEAD) > revision
source bin/activate
bzr checkout --lightweight lp:~ce-infrastructure/bygmester/third-party
pip install -r canonical-requirements.txt --find-links file://`pwd`/third-party --no-index --index-url=file:///dev/null
virtualenv --relocatable .
tar czf ../${PROJECT}.tar.gz --exclude .git .
popd
rm -rf ${PROJECT}
rm -rf third-party
exit 0
|