-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
254 lines (228 loc) · 14.9 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
# Copyright 2008 Red Hat, Inc. and/or its affiliates.
#
# Licensed to you under the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the files README and
# LICENSE_GPL_v2 which accompany this distribution.
#
MVN=$(shell which mvn)
BUILD_FLAGS=-P gwt-admin,gwt-user
DEPLOY_FLAGS=-f deploy.xml
JBOSS_HOME=/usr/local/jboss-5.1.0.GA
EAR_DIR=/usr/share/ovirt-engine/engine.ear
EAR_SRC_DIR=ear/target/engine
PY_SITE_PKGS:=$(shell python -c "from distutils.sysconfig import get_python_lib as f;print f()")
APP_VERSION:=$(shell cat pom.xml | grep '<engine.version>' | awk -F\> '{print $$2}' | awk -F\< '{print $$1}')
RPM_VERSION:=$(shell echo $(APP_VERSION) | sed "s/-/_/")
#RPM_RELEASE:=$(shell echo $(APP_VERSION) | awk -F\. '{print $$3"%{?dist}"}')
SPEC_FILE_IN=packaging/fedora/spec/ovirt-engine.spec.in
SPEC_FILE=ovirt-engine.spec
RPMBUILD=$(shell bash -c "pwd -P")/rpmbuild
SRCRPMBUILD=$(shell bash -c "pwd -P")/srcrpmbuild
OUTPUT_DIR=$(shell bash -c "pwd -P")/output
TARBALL=ovirt-engine-$(RPM_VERSION).tar.gz
SRPM=$(OUTPUT_DIR)/ovirt-engine-$(RPM_VERSION)*.src.rpm
ARCH=$(shell uname -i)
BUILD_FILE=$(shell bash -c "pwd -P")/build_mvn
CURR_DIR=$(shell bach -c "pwd -P")
all: build_mvn
build_mvn:
export MAVEN_OPTS="-XX:MaxPermSize=512m"
$(MVN) install $(BUILD_FLAGS) -D skipTests
touch $(BUILD_FILE)
clean:
$(MVN) clean
rm -rf $(RPMBUILD) $(SPEC_FILE) $(OUTPUT_DIR) $(SRCRPMBUILD) $(BUILD_FILE)
test:
$(MVN) install $(BUILD_FLAGS)
install: build_mvn create_dirs install_ear install_quartz install_tools \
install_config install_log_collector install_iso_uploader \
install_sysprep install_notification_service install_db_scripts \
install_misc install_setup install_sec
tarball: $(TARBALL)
$(TARBALL):
tar zcf $(TARBALL) `git ls-files`
srpm: $(SRPM)
$(SRPM): tarball $(SPEC_FILE_IN)
mkdir -p $(OUTPUT_DIR)
sed 's/^Version:.*/Version: $(RPM_VERSION)/' $(SPEC_FILE_IN) > $(SPEC_FILE)
mkdir -p $(SRCRPMBUILD)/{SPECS,RPMS,SRPMS,SOURCES,BUILD,BUILDROOT}
cp -f $(SPEC_FILE) $(SRCRPMBUILD)/SPECS/
cp -f $(TARBALL) $(SRCRPMBUILD)/SOURCES/
rpmbuild -bs --define="_topdir $(SRCRPMBUILD)" --define="_sourcedir ." $(SPEC_FILE)
mv $(SRCRPMBUILD)/SRPMS/*.rpm $(OUTPUT_DIR)
rm -rf $(SRCRPMBUILD) $(SPEC_FILE) $(TARBALL)
rpm: $(SRPM)
rm -rf $(RPMBUILD)
mkdir -p $(RPMBUILD)/{SPECS,RPMS,SRPMS,SOURCES,BUILD,BUILDROOT}
rpmbuild --define="_topdir $(RPMBUILD)" --rebuild $<
mv $(RPMBUILD)/RPMS/$(ARCH)/*.rpm $(OUTPUT_DIR)
rm -rf $(RPMBUILD)
create_dirs:
@echo "*** Creating Directories"
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/{sysprep,kerberos,scripts,3rd-party-lib,engine.ear,conf,dbscripts,resources,ovirt-isos,iso-uploader,log-collector,db-backups,engine.ear}
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/engine-config/lib
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/notifier/lib
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/engine-manage-domains/lib
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/log-collector/schemas
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/iso-uploader/schemas
@mkdir -p $(PREFIX)/usr/share/java
@mkdir -p $(PREFIX)/usr/bin
@mkdir -p $(PREFIX)/usr/share/man/man8
@mkdir -p $(PREFIX)$(PY_SITE_PKGS)/sos/plugins
@mkdir -p $(PREFIX)/etc/ovirt-engine/notifier
@mkdir -p $(PREFIX)/var/log/ovirt-engine/notifier
@mkdir -p $(PREFIX)/var/log/ovirt-engine/engine-manage-domains
@mkdir -p $(PREFIX)/var/run/ovirt-engine/notifier
@mkdir -p $(PREFIX)/var/lock/ovirt-engine
@mkdir -p $(PREFIX)/etc/init.d/
@mkdir -p $(PREFIX)/etc/cron.daily/
@mkdir -p $(PREFIX)/etc/ovirt-engine/{engine-config,engine-manage-domains}
@mkdir -p $(PREFIX)$(EAR_DIR)
@mkdir -p $(PREFIX)$(JBOSS_HOME)/common/lib
@mkdir -p $(PREFIX)$(JBOSS_HOME)/server/default/deploy
@mkdir -p $(PREFIX)$(JBOSS_HOME)/server/default/conf
@mkdir -p $(PREFIX)/usr/share/ovirt-engine/resources/jboss/
@mkdir -p $(PREFIX)/etc/pki/ovirt-engine/{keys,private,requests,certs}
install_ear:
@echo "*** Deploying EAR to $(PREFIX)"
mkdir -p $(PREFIX)$(EAR_DIR)
cp -rf $(EAR_SRC_DIR)/* $(PREFIX)$(EAR_DIR)
install_quartz:
@echo "*** Deploying quartz.jar to $(PREFIX)"
cp -f ear/target/quartz/quartz*.jar $(PREFIX)$(JBOSS_HOME)/common/lib/
install_tools:
@echo "*** Installing Common Tools"
cp -f ./backend/manager/tools/engine-tools-common/target/engine-tools-common-$(APP_VERSION).jar $(PREFIX)/usr/share/java/
rm -f $(PREFIX)/usr/share/java/engine-tools-common.jar
ln -s /usr/share/java/engine-tools-common-$(APP_VERSION).jar $(PREFIX)/usr/share/java/engine-tools-common.jar
install_setup:
@echo "*** Deploying setup executables"
cp -f ./packaging/fedora/setup/engine-config-install.properties $(PREFIX)/usr/share/ovirt-engine/conf
chmod 644 $(PREFIX)/usr/share/ovirt-engine/conf/engine-config-install.properties
cp -f ./packaging/fedora/setup/iptables.default $(PREFIX)/usr/share/ovirt-engine/conf
chmod 755 $(PREFIX)/usr/share/ovirt-engine/conf/iptables.default
cp -f ./packaging/fedora/setup/nfs.sysconfig $(PREFIX)/usr/share/ovirt-engine/conf
chmod 755 $(PREFIX)/usr/share/ovirt-engine/conf/nfs.sysconfig
cp -f ./packaging/fedora/setup/engine-setup.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/engine-setup.py
cp -f ./packaging/fedora/setup/nfsutils.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/nfsutils.py
cp -f ./packaging/fedora/setup/basedefs.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/basedefs.py
cp -f ./packaging/fedora/setup/engine_validators.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/engine_validators.py
cp -f ./packaging/fedora/setup/common_utils.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/common_utils.py
cp -f ./packaging/fedora/setup/resources/jboss/web-conf.js $(PREFIX)/etc/ovirt-engine
chmod 755 $(PREFIX)/etc/ovirt-engine/web-conf.js
cp -f ./packaging/fedora/setup/output_messages.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/output_messages.py
ln -s /usr/share/ovirt-engine/scripts/engine-setup.py $(PREFIX)/usr/bin/engine-setup
cp -af ./packaging/fedora/setup/resources/jboss/* $(PREFIX)/usr/share/ovirt-engine/resources/jboss/
cp -f ./packaging/fedora/setup/engine-cleanup.py $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/engine-cleanup.py
ln -s /usr/share/ovirt-engine/scripts/engine-cleanup.py $(PREFIX)/usr/bin/engine-cleanup
sed -i "s/MYVERSION/$(RPM_VERSION)/" $(PREFIX)/usr/share/ovirt-engine/resources/jboss/engineVersion.js
install_sec:
cd backend/manager/3rdparty/pub2ssh/; chmod +x pubkey2ssh.sh; mkdir -p bin; ./pubkey2ssh.sh; cd -
rm -rf $(PREFIX)/etc/pki/engine-config/*.bat
cp -f ./backend/manager/3rdparty/pub2ssh/bin/pubkey2ssh $(PREFIX)/etc/pki/ovirt-engine
chmod 755 $(PREFIX)/etc/pki/ovirt-engine
cp -a ./backend/manager/conf/ca/* $(PREFIX)/etc/pki/ovirt-engine
install_config:
@echo "*** Deploying engine-config & engine-manage-domains"
cp -f ./backend/manager/tools/engine-config/src/main/resources/engine-config $(PREFIX)/usr/share/ovirt-engine/engine-config/
chmod 750 $(PREFIX)/usr/share/ovirt-engine/engine-config/engine-config
cp -f ./backend/manager/tools/engine-config/src/main/resources/engine-config.conf $(PREFIX)/etc/ovirt-engine/engine-config/
chmod 755 $(PREFIX)/etc/ovirt-engine/engine-config/engine-config.conf
cp -f ./backend/manager/tools/engine-config/src/main/resources/engine-config.*properties $(PREFIX)/etc/ovirt-engine/engine-config/
chmod 644 $(PREFIX)/etc/ovirt-engine/engine-config/engine-config.*properties
cp -f ./backend/manager/tools/engine-config/src/main/resources/log4j.xml $(PREFIX)/etc/ovirt-engine/engine-config/
chmod 644 $(PREFIX)/etc/ovirt-engine/engine-config/log4j.xml
cp -f ./backend/manager/tools/engine-config/target/engine-config-$(APP_VERSION).jar $(PREFIX)/usr/share/ovirt-engine/engine-config/lib/
rm -f $(PREFIX)/usr/share/ovirt-engine/engine-config/lib/engine-config.jar
ln -s /usr/share/ovirt-engine/engine-config/lib/engine-config-$(APP_VERSION).jar $(PREFIX)/usr/share/ovirt-engine/engine-config/lib/engine-config.jar
cp -f ./backend/manager/modules/engineencryptutils/target/engineencryptutils-$(APP_VERSION).jar $(PREFIX)/usr/share/ovirt-engine/engine-config/lib/
cp -f ./ear/target/engine/lib/engine-compat.jar $(PREFIX)/usr/share/ovirt-engine/engine-config/lib/
rm -f $(PREFIX)/usr/bin/engine-config
ln -s /usr/share/ovirt-engine/engine-config/engine-config $(PREFIX)/usr/bin/engine-config
cp -f ./backend/manager/conf/kerberos/engine-manage-domains $(PREFIX)/usr/share/ovirt-engine/engine-manage-domains/
chmod 750 $(PREFIX)/usr/share/ovirt-engine/engine-manage-domains/engine-manage-domains
cp -f ./backend/manager/modules/utils/src/main/resources/engine-manage-domains.conf $(PREFIX)/etc/ovirt-engine/engine-manage-domains/
chmod 755 $(PREFIX)/etc/ovirt-engine/engine-manage-domains/engine-manage-domains.conf
cp -f ./backend/manager/modules/utils/src/main/resources/engine-manage-domains/log4j.xml $(PREFIX)/etc/ovirt-engine/engine-manage-domains/
chmod 644 $(PREFIX)/etc/ovirt-engine/engine-manage-domains/log4j.xml
cp -f ./ear/target/engine/lib/engine-compat.jar $(PREFIX)/usr/share/ovirt-engine/engine-manage-domains/lib/
rm -f $(PREFIX)/usr/bin/engine-manage-domains
ln -s /usr/share/ovirt-engine/engine-manage-domains/engine-manage-domains $(PREFIX)/usr/bin/engine-manage-domains
install_log_collector:
@echo "*** Deploying log collector"
cp -f ./backend/manager/tools/engine-logcollector/src/rhev/logcollector.py $(PREFIX)/usr/share/ovirt-engine/log-collector/
chmod 755 $(PREFIX)/usr/share/ovirt-engine/log-collector/logcollector.py
/usr/bin/gzip -c ./backend/manager/tools/engine-logcollector/src/rhev/engine-log-collector.8 > $(PREFIX)/usr/share/man/man8/engine-log-collector.8.gz
chmod 644 $(PREFIX)/usr/share/man/man8/engine-log-collector.8.gz
cp -f ./backend/manager/tools/engine-logcollector/src/rhev/logcollector.conf $(PREFIX)/etc/ovirt-engine/
chmod 600 $(PREFIX)/etc/ovirt-engine/logcollector.conf
cp -f ./backend/manager/tools/engine-tools-common-lib/src/rhev/schemas/api.py $(PREFIX)/usr/share/ovirt-engine/log-collector/schemas
cp -f ./backend/manager/tools/engine-tools-common-lib/src/rhev/schemas/hypervisors.py $(PREFIX)/usr/share/ovirt-engine/log-collector/schemas
cp -f ./backend/manager/tools/engine-tools-common-lib/src/rhev/schemas/__init__.py $(PREFIX)/usr/share/ovirt-engine/log-collector/schemas
chmod 755 $(PREFIX)/usr/share/ovirt-engine/log-collector/schemas/*
cp -f ./backend/manager/tools/engine-logcollector/src/sos/plugins/jboss.py $(PREFIX)$(PY_SITE_PKGS)/sos/plugins
cp -f ./backend/manager/tools/engine-logcollector/src/sos/plugins/engine.py $(PREFIX)$(PY_SITE_PKGS)/sos/plugins
cp -f ./backend/manager/tools/engine-logcollector/src/sos/plugins/postgresql.py $(PREFIX)$(PY_SITE_PKGS)/sos/plugins
chmod 755 $(PREFIX)$(PY_SITE_PKGS)/sos/plugins/*
rm -f $(PREFIX)/usr/bin/engine-log-collector
ln -s /usr/share/ovirt-engine/log-collector/logcollector.py $(PREFIX)/usr/bin/engine-log-collector
install_iso_uploader:
@echo "*** Deploying iso uploader"
cp -f ./backend/manager/tools/engine-iso-uploader/src/engine-iso-uploader.py $(PREFIX)/usr/share/ovirt-engine/iso-uploader/
chmod 755 $(PREFIX)/usr/share/ovirt-engine/iso-uploader/engine-iso-uploader.py
/usr/bin/gzip -c ./backend/manager/tools/engine-iso-uploader/src/engine-iso-uploader.8 > $(PREFIX)/usr/share/man/man8/engine-iso-uploader.8.gz
chmod 644 $(PREFIX)/usr/share/man/man8/engine-iso-uploader.8.gz
cp -f ./backend/manager/tools/engine-iso-uploader/src/isouploader.conf $(PREFIX)/etc/ovirt-engine/
chmod 600 $(PREFIX)/etc/ovirt-engine/isouploader.conf
cp -f ./backend/manager/tools/engine-tools-common-lib/src/rhev/schemas/api.py $(PREFIX)/usr/share/ovirt-engine/iso-uploader/schemas
cp -f ./backend/manager/tools/engine-tools-common-lib/src/rhev/schemas/__init__.py $(PREFIX)/usr/share/ovirt-engine/iso-uploader/schemas
chmod 755 $(PREFIX)/usr/share/ovirt-engine/iso-uploader/schemas/*
rm -f $(PREFIX)/usr/bin/engine-iso-uploader
ln -s /usr/share/ovirt-engine/iso-uploader/engine-iso-uploader.py $(PREFIX)/usr/bin/engine-iso-uploader
install_sysprep:
@echo "*** Deploying sysperp"
cp -f ./backend/manager/conf/sysprep/* $(PREFIX)/usr/share/ovirt-engine/sysprep
chmod 644 $(PREFIX)/usr/share/ovirt-engine/sysprep/*
install_notification_service:
@echo "*** Deploying notification service"
cp -f ./backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/log4j.xml $(PREFIX)/etc/ovirt-engine/notifier/
chmod 644 $(PREFIX)/etc/ovirt-engine/notifier/log4j.xml
cp -f ./backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.conf $(PREFIX)/etc/ovirt-engine/notifier/
chmod 640 $(PREFIX)/etc/ovirt-engine/notifier/notifier.conf
cp -f ./backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh $(PREFIX)/usr/share/ovirt-engine/notifier/
chmod 755 $(PREFIX)/usr/share/ovirt-engine/notifier/notifier.sh
cp -f ./backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd $(PREFIX)/etc/init.d/
chmod 755 $(PREFIX)/etc/init.d/engine-notifierd
cp -f ./backend/manager/tools/engine-notifier/engine-notifier-service/target/engine-notifier-service-$(APP_VERSION).jar $(PREFIX)/usr/share/ovirt-engine/notifier/engine-notifier.jar
chmod 644 $(PREFIX)/usr/share/ovirt-engine/notifier/engine-notifier.jar
install_db_scripts:
@echo "*** Deploying Database scripts"
cp -a ./backend/manager/dbscripts/* $(PREFIX)/usr/share/ovirt-engine/dbscripts
install_misc:
@echo "*** Copying additional files"
cp -f ./backend/manager/conf/jaas.conf $(PREFIX)/usr/share/ovirt-engine/conf
chmod 644 $(PREFIX)/usr/share/ovirt-engine/conf/jaas.conf
cp -f ./backend/manager/conf/engine.conf $(PREFIX)/etc/ovirt-engine/
chmod 640 $(PREFIX)/etc/ovirt-engine/engine.conf
cp -f ./backend/manager/conf/jboss-log4j.xml $(PREFIX)/usr/share/ovirt-engine/conf
chmod 644 $(PREFIX)/usr/share/ovirt-engine/conf/jboss-log4j.xml
cp -f ./backend/manager/conf/kerberos/* $(PREFIX)/usr/share/ovirt-engine/kerberos
chmod 644 $(PREFIX)/usr/share/ovirt-engine/kerberos/*
rm -rf $(PREFIX)/usr/share/ovirt-engine/keberos/*.bat
cp -f ./backend/manager/conf/vds_installer.py $(PREFIX)/usr/share/ovirt-engine/scripts
cp -f ./packaging/ovirtlogrot.sh $(PREFIX)/usr/share/ovirt-engine/scripts
chmod 755 $(PREFIX)/usr/share/ovirt-engine/scripts/vds_installer.py
ln -s /usr/share/java/postgresql-jdbc.jar $(PREFIX)$(JBOSS_HOME)/common/lib/postgresql-jdbc.jar
cp -f ./backend/manager/conf/jboss-log4j.xml $(PREFIX)/usr/share/ovirt-engine/conf
cp -f ./packaging/fedora/setup/resources/postgres/postgres-ds.xml $(PREFIX)/usr/share/ovirt-engine/conf
cp -f ./LICENSE $(PREFIX)/usr/share/ovirt-engine
cp -f ./packaging/ovirtlogrot.sh ${PREFIX}/usr/share/ovirt-engine/scripts/
cp -f ./packaging/resources/ovirt-cron ${PREFIX}/etc/cron.daily/