This repository has been archived by the owner on Feb 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Makefile
257 lines (223 loc) · 7.98 KB
/
Makefile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#
# Copyright 2018 Google Inc. All Rights Reserved.
#
OSX_VERSION=$(shell sw_vers -productVersion 2>/dev/null | cut -d. -f1-2)
SIMIAN_VERSION=2.5
SIMIAN=simian-${SIMIAN_VERSION}
SDIST_TAR=dist/simian-${SIMIAN_VERSION}.tar
SDIST=${SDIST_TAR}.gz
MUNKI_VERSION=3.0.3.3352
MUNKI=munkitools-${MUNKI_VERSION}
MUNKIFILE=${MUNKI}.pkg
PYTHON_VERSION=2.7
PYTHON="/usr/bin/python${PYTHON_VERSION}"
TS=$(shell date '+%s')
BUILD_VERSION=$(shell (git rev-parse HEAD 2>/dev/null || echo ${SIMIAN_VERSION} | tr '.' '-') | cut -c1-12)
os_check:
@if [ -z "${OSX_VERSION}" ]; then echo Must run on OS X ; exit 1 ; fi
python_check:
@if [ ! -x "${PYTHON}" ]; then echo Cannot find ${PYTHON} ; exit 1 ; fi
virtualenv: python_check
${PYTHON} -c 'import virtualenv; exit(virtualenv.__version__ != "13.1.2")' || \
(sudo /usr/bin/easy_install-${PYTHON_VERSION} -U virtualenv==13.1.2 && \
sudo /usr/bin/easy_install-${PYTHON_VERSION} -U setuptools==18.6.1)
VE: virtualenv python_check
[ -d VE ] || \
${PYTHON} $(shell type -p virtualenv) --no-site-packages VE
src/tests/gae_server.zip:
rm -Rf tmp/gae_server
mkdir -p tmp/gae_server
curl -o tmp/master.zip https://codeload.github.com/GoogleCloudPlatform/python-compat-runtime/zip/739bf8f575afe68f4df0e446ed405aa767aa870d
unzip -q tmp/master.zip -d tmp/gae_server
cd tmp/gae_server/python-compat-runtime-*/appengine-compat/exported_appengine_sdk/ && zip -q -r ../../../../../src/tests/gae_server.zip *
test: m2crypto VE src/tests/gae_server.zip
[ -f test ] || \
VE/bin/python VE/bin/easy_install-${PYTHON_VERSION} "${PWD}"/simian_M2Crypto-*-py${PYTHON_VERSION}-macosx-${OSX_VERSION}*.egg && \
env SIMIAN_CONFIG_PATH="${PWD}/etc/simian/" \
VE/bin/python setup.py google_test && touch test && \
echo ALL TESTS COMPLETED SUCCESSFULLY
settings_check: test
VE/bin/python \
src/simian/util/validate_settings.py etc/simian/ \
src/ ./.eggs/pyasn1*.egg ./.eggs/tlslite*.egg
build: VE
VE/bin/python setup.py build
install: client_config build
VE/bin/python setup.py install
mkdir -p /etc/simian/ && cp -Rf etc/simian /etc && chmod 644 /etc/simian/*.cfg
clean_contents:
rm -rf contents.tar contents.tar.gz tmpcontents swig.tgz
clean_pkgs:
rm -rf tmppkgs
clean_sdist:
rm -rf ${SDIST} ${SDIST_TAR}
clean_test:
rm -f test
clean_ve:
rm -rf VE
clean: clean_contents clean_pkgs clean_sdist clean_test clean_ve
rm -rf ${SIMIAN}.dmg ${SIMIAN}-${MUNKI}.dmg dist/* build/* *.egg .eggs install_name_tool
${SDIST}: VE clean_sdist client_config
VE/bin/python setup.py sdist --formats=tar
gzip ${SDIST_TAR}
server_config:
src/simian/util/create_gae_bundle.sh $(PWD)
sed -i "" "s/^application:.*/application: `PYTHONPATH=. python src/simian/util/appid_generator.py`/" gae_bundle/app.yaml
src/simian/util/link_module.sh pytz
src/simian/util/link_module.sh tlslite
src/simian/util/link_module.sh pyasn1
src/simian/util/link_module.sh pyasn1_modules
src/simian/util/link_module.sh GoogleAppEngineCloudStorageClient
VE/bin/python src/simian/util/compile_js.py gae_bundle/simian/mac/admin/js/simian.js
client_config: settings_check
${MUNKIFILE}:
curl -o $@ https://munkibuilds.org/${MUNKI_VERSION}/$@
@xar -t -f "$@" > /dev/null || ( rm -f "$@" ; exit 1)
add_munkicontents: os_check ${MUNKIFILE}
pkgutil --expand ${MUNKIFILE} tmpcontents/
cd tmpcontents/ && \
for pkg in *.pkg ; do \
gzip -dc "$$pkg/Payload" | pax -r | rm -r $$pkg; done
contents.tar.gz: client_config
mkdir -p tmpcontents/etc/simian/ssl/certs
mkdir -p tmpcontents/etc/simian/ssl/private_keys
chmod 750 tmpcontents/etc/simian/ssl/private_keys
mkdir -p tmpcontents/usr/local/munki/
mkdir -p tmpcontents/usr/local/bin
# add entire config
cp -R etc/simian tmpcontents/etc
# sideline simian.cfg to avoid overwriting it on install
mv tmpcontents/etc/simian/settings.cfg tmpcontents/etc/simian/settings.cfg+
# add munki integration binaries
cp ./src/simian/munki/* tmpcontents/usr/local/munki
# add simianfacter
cp ./src/simian/util/simianfacter tmpcontents/usr/local/bin
# build tar
tar -v -c --exclude '*/.*' -f contents.tar -C tmpcontents .
# build gz
gzip -f contents.tar
install_name_tool:
cp /usr/bin/install_name_tool .
m2crypto:
for egg in \
M2Crypto-0.22.3-py2.7-macosx-10.9-intel.egg \
M2Crypto-0.22.3-py2.7-macosx-10.10-intel.egg \
M2Crypto-0.22.3-py2.7-macosx-10.11-intel.egg \
M2Crypto-0.22.3-py2.7-macosx-10.12-intel.egg \
M2Crypto-0.22.3-py2.7-macosx-10.13-intel.egg ; do \
[[ -f "simian_$${egg}" ]] || curl -o "simian_$${egg}" "https://storage.googleapis.com/m2crypto_eggs/$${egg}" ; \
done
vep: install_name_tool
${SIMIAN}.dmg: os_check ${SDIST} clean_contents contents.tar.gz m2crypto vep
rm -f $@
./tgz2dmg.sh contents.tar.gz $@ \
-id com.google.code.simian \
-version ${SIMIAN_VERSION} \
-pyver ${PYTHON_VERSION} \
-vep install_name_tool \
-R simian_M2Crypto-*-10.9-*.egg \
-R simian_M2Crypto-*-10.10-*.egg \
-R simian_M2Crypto-*-10.11-*.egg \
-R simian_M2Crypto-*-10.12-*.egg \
-R simian_M2Crypto-*-10.13-*.egg \
-R .eggs/WebOb-*.egg \
-R .eggs/google_apputils-*.egg \
-R .eggs/pyasn1-*.egg \
-R .eggs/pyasn1_modules-*.egg \
-R .eggs/python_dateutil-*.egg \
-R .eggs/python_gflags-*.egg \
-R .eggs/pytz-*.egg \
-R .eggs/requests-*.egg \
-R .eggs/tlslite-*.egg \
-r ${SDIST} \
-s postinstall \
-s preinstall \
-s roots.pem
${SIMIAN}.pkg: os_check ${SDIST} clean_contents contents.tar.gz m2crypto vep
rm -rf tmppkgs/$@
mkdir -p tmppkgs
./tgz2dmg.sh contents.tar.gz tmppkgs/$@ \
-pkgonly \
-id com.google.code.simian \
-version ${SIMIAN_VERSION} \
-pyver ${PYTHON_VERSION} \
-vep install_name_tool \
-R simian_M2Crypto-*-10.9-*.egg \
-R simian_M2Crypto-*-10.10-*.egg \
-R simian_M2Crypto-*-10.11-*.egg \
-R simian_M2Crypto-*-10.12-*.egg \
-R simian_M2Crypto-*-10.13-*.egg \
-R .eggs/WebOb-*.egg \
-R .eggs/google_apputils-*.egg \
-R .eggs/pyasn1-*.egg \
-R .eggs/pyasn1_modules-*.egg \
-R .eggs/python_dateutil-*.egg \
-R .eggs/python_gflags-*.egg \
-R .eggs/pytz-*.egg \
-R .eggs/requests-*.egg \
-R .eggs/tlslite-*.egg \
-r ${SDIST} \
-s postinstall \
-s preinstall \
-s roots.pem
${SIMIAN}-and-${MUNKI}.pkg: os_check ${SDIST} clean_contents m2crypto add_munkicontents contents.tar.gz vep
rm -rf tmppkgs/$@
mkdir -p tmppkgs
./tgz2dmg.sh contents.tar.gz tmppkgs/$@ \
-pkgonly \
-id com.google.code.simian.and.munkitools \
-version ${SIMIAN_VERSION}.${MUNKI_VERSION} \
-pyver ${PYTHON_VERSION} \
-vep install_name_tool \
-R simian_M2Crypto-*-10.9-*.egg \
-R simian_M2Crypto-*-10.10-*.egg \
-R simian_M2Crypto-*-10.11-*.egg \
-R simian_M2Crypto-*-10.12-*.egg \
-R simian_M2Crypto-*-10.13-*.egg \
-R .eggs/WebOb-*.egg \
-R .eggs/google_apputils-*.egg \
-R .eggs/pyasn1-*.egg \
-R .eggs/pyasn1_modules-*.egg \
-R .eggs/python_dateutil-*.egg \
-R .eggs/python_gflags-*.egg \
-R .eggs/pytz-*.egg \
-R .eggs/requests-*.egg \
-R .eggs/tlslite-*.egg \
-r ${SDIST} \
-s postinstall \
-s preinstall \
-s roots.pem
${SIMIAN}-and-${MUNKI}.dmg: os_check ${SDIST} clean_contents m2crypto add_munkicontents contents.tar.gz vep
rm -f $@
./tgz2dmg.sh contents.tar.gz $@ \
-id com.google.code.simian.and.munkitools \
-version ${SIMIAN_VERSION}.${MUNKI_VERSION} \
-pyver ${PYTHON_VERSION} \
-vep install_name_tool \
-R simian_M2Crypto-*-10.9-*.egg \
-R simian_M2Crypto-*-10.10-*.egg \
-R simian_M2Crypto-*-10.11-*.egg \
-R simian_M2Crypto-*-10.12-*.egg \
-R simian_M2Crypto-*-10.13-*.egg \
-R .eggs/WebOb-*.egg \
-R .eggs/google_apputils-*.egg \
-R .eggs/pyasn1-*.egg \
-R .eggs/pyasn1_modules-*.egg \
-R .eggs/python_dateutil-*.egg \
-R .eggs/python_gflags-*.egg \
-R .eggs/pytz-*.egg \
-R .eggs/requests-*.egg \
-R .eggs/tlslite-*.egg \
-r ${SDIST} \
-s postinstall \
-s preinstall \
-s roots.pem
simian-pkg: ${SIMIAN}.pkg
pkg: ${SIMIAN}-and-${MUNKI}.pkg
dmg: ${SIMIAN}-and-${MUNKI}.dmg
release: server_config
appcfg.py --version=${BUILD_VERSION} update gae_bundle/
appcfg.py --version=${BUILD_VERSION} set_default_version gae_bundle/
release_with_oauth: server_config
appcfg.py --version=${BUILD_VERSION} --oauth2 update gae_bundle/
appcfg.py --version=${BUILD_VERSION} --oauth2 set_default_version gae_bundle/