-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (121 loc) · 3.9 KB
/
Makefile
File metadata and controls
160 lines (121 loc) · 3.9 KB
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
TOP_DIR = ../..
DEPLOY_RUNTIME ?= /kb/runtime
TARGET ?= /kb/deployment
SERVICE = assembly
SERVICE_NAME = assembly
SERVICE_DIR = $(TARGET)/services/$(SERVICE)
VAR_DIR = $(SERVICE_DIR)/var
ARAST_URL = http://kbase.us/services/assembly
ARAST_AUTH_SERVICE = KBase
include $(TOP_DIR)/tools/Makefile.common
TPAGE_ARGS = --define arast_url=$(ARAST_URL) \
--define arast_auth_service=$(ARAST_AUTH_SERVICE)
# to wrap scripts and deploy them to $(TARGET)/bin using tools in
# the dev_container. right now, these vars are defined in
# Makefile.common, so it's redundant here.
TOOLS_DIR = $(TOP_DIR)/tools
WRAP_PERL_TOOL = wrap_perl
WRAP_PERL_SCRIPT = bash $(TOOLS_DIR)/$(WRAP_PERL_TOOL).sh
SRC_PERL = $(wildcard client/*.pl)
WRAP_PYTHON_TOOL = wrap_python
WRAP_PYTHON_SCRIPT = bash $(TOOLS_DIR)/$(WRAP_PYTHON_TOOL).sh
SRC_PYTHON = $(wildcard client/*.py)
SERVER_TESTS = $(wildcard server-tests/*.t)
CLIENT_TESTS = $(wildcard client-tests/*.t)
SCRIPT_TESTS = $(wildcard test/*.t)
CLIENT_DIR = $(TARGET)/bin
CLIENT_EXE = $(CLIENT_DIR)/arast
MODULE_DIR = $(TARGET)/modules/assembly
LIB_PYTHON = $(MODULE_DIR)/lib/python2.7/site-packages
default: build-config
# Test
test: test-core
# test: test-scripts
# test: test-client test-scripts test-service
# @echo "running client and script tests"
test-core:
test/arast.t -d temp
test-sh:
cd test && ./test_arast_client.sh
test-client:
for t in $(CLIENT_TESTS) ; do \
if [ -f $$t ] ; then \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
test-scripts:
for t in $(SCRIPT_TESTS) ; do \
if [ -f $$t ] ; then \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
test-service:
for t in $(SERVER_TESTS) ; do \
if [ -f $$t ] ; then \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
# Deployment
deploy: deploy-client
# deploy: deploy-client deploy-service
# deploy-client: install-client-dep deploy-dir install-client deploy-client-scripts deploy-docs
deploy-client: install-client-dep build-config deploy-libs deploy-scripts deploy-docs
build-config:
$(TPAGE) $(TPAGE_ARGS) config.py.tt > lib/assembly/config.py
# deploy-libs:
# rsync --exclude '*.bak*' -arv lib/. $(TARGET)/lib/.
# deploy-scripts:
# export KB_TOP=$(TARGET); \
# export KB_RUNTIME=$(DEPLOY_RUNTIME); \
# export KB_PERL_PATH=$(TARGET)/lib bash ; \
# for src in $(SRC_PERL) ; do \
# basefile=`basename $$src`; \
# base=`basename $$src .pl`; \
# echo install $$src $$base ; \
# cp $$src $(TARGET)/plbin ; \
# $(WRAP_PERL_SCRIPT) "$(TARGET)/plbin/$$basefile" $(TARGET)/bin/$$base ; \
# done; \
# export KB_PYTHON_PATH=$(TARGET)/lib bash ; \
# for src in $(SRC_PYTHON) ; do \
# basefile=`basename $$src`; \
# base=`basename $$src .py`; \
# echo install $$src $$base ; \
# cp $$src $(TARGET)/pybin ; \
# $(WRAP_PYTHON_SCRIPT) "$(TARGET)/pybin/$$basefile" $(TARGET)/bin/$$base ; \
# done
deploy-docs:
mkdir -p $(TARGET)/services/$(SERVICE)/webroot
cp doc/*.html $(TARGET)/services/$(SERVICE)/webroot/.
cp doc/*.png $(TARGET)/services/$(SERVICE)/webroot/.
deploy-service: install-dep install-service-scripts deploy-mongo deploy-testworker
redeploy-service: clean install-dep create-scripts deploy-mongo
deploy-compute: install-dep
deploy-testworker:
./tools/install-basic-dependencies.sh
./tools/add-comp.pl kiki velvet
deploy-dir:
if [ ! -d $(LIB_PYTHON) ] ; then mkdir -p $(LIB_PYTHON) ; fi
install-dep:
sh ./tools/install-server-dependencies.sh
install-client-dep:
sh ./tools/install-client-dependencies.sh
install-service-scripts:
cp ./tools/start_service $(SERVICE_DIR)
deploy-mongo:
mkdir -p /data/db
sed -i "s/bind_ip = 127.0.0.1/bind_ip = 0.0.0.0/" /etc/mongodb.conf
service mongodb restart
clean:
rm -rfv $(SERVICE_DIR)
rm -f start_service stop_service
echo "OK ... Removed all deployed files."
include $(TOP_DIR)/tools/Makefile.common.rules