forked from kbaseattic/assembly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
146 lines (113 loc) · 3.65 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
TOP_DIR = ../..
DEPLOY_RUNTIME ?= /kb/runtime
TARGET ?= /kb/deployment
SERVICE = assembly
SERVICE_NAME = assembly
SERVICE_DIR = $(TARGET)/services/$(SERVICE)
VAR_DIR = $(SERVICE_DIR)/var
include $(TOP_DIR)/tools/Makefile.common
# 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 scripts/ar-*.pl)
WRAP_PYTHON_TOOL = wrap_python
WRAP_PYTHON_SCRIPT = bash $(TOOLS_DIR)/$(WRAP_PYTHON_TOOL).sh
SRC_PYTHON = $(wildcard scripts/arast.py)
SERVER_TESTS = $(wildcard server-tests/*.t)
CLIENT_TESTS = $(wildcard client-tests/*.t)
# SCRIPTS_TESTS = $(wildcard script-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:
# Test
test: test-sh test-scripts
# test: test-client test-scripts test-service
# @echo "running client and script tests"
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 deploy-libs deploy-scripts deploy-docs
# 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:
./scripts/install-basic-dependencies.sh
./scripts/add-comp.pl kiki velvet
deploy-dir:
if [ ! -d $(LIB_PYTHON) ] ; then mkdir -p $(LIB_PYTHON) ; fi
install-dep:
sh ./scripts/install-server-dependencies.sh
install-client-dep:
sh ./scripts/install-client-dependencies.sh
install-service-scripts:
cp ./scripts/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