1 martin 1.12 #//%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.13 #//
|
3 martin 1.12 #// Licensed to The Open Group (TOG) under one or more contributor license
4 #// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 #// this work for additional information regarding copyright ownership.
6 #// Each contributor licenses this file to you under the OpenPegasus Open
7 #// Source License; you may not use this file except in compliance with the
8 #// License.
|
9 martin 1.13 #//
|
10 martin 1.12 #// Permission is hereby granted, free of charge, to any person obtaining a
11 #// copy of this software and associated documentation files (the "Software"),
12 #// to deal in the Software without restriction, including without limitation
13 #// the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 #// and/or sell copies of the Software, and to permit persons to whom the
15 #// Software is furnished to do so, subject to the following conditions:
|
16 martin 1.13 #//
|
17 martin 1.12 #// The above copyright notice and this permission notice shall be included
18 #// in all copies or substantial portions of the Software.
|
19 martin 1.13 #//
|
20 martin 1.12 #// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.13 #// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.12 #// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 #// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 #// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 #// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 #// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.13 #//
|
28 martin 1.12 #//////////////////////////////////////////////////////////////////////////
|
29 w.otsuka 1.1 ###############################################################################
30 ##
31 ## RPM Makefile for building tog-pegasus rpms
32 ##
33 ## see the usage rule for documentation of rules etc.
34 ##
35 ##
36 ###############################################################################
37
38
|
39 denise.eckstein 1.5 include pegasus/env_var_Linux.status
40
|
41 w.otsuka 1.1 RELEASE:=$(shell lsb_release -r -s)
42 IDISTRO:=$(shell lsb_release -i -s)
43 PLATFORM:=$(shell /bin/rpm --eval %_target_cpu)
44 BRANCH:=$(PEGASUS_BUILD_BRANCH)
45 RPM:=rpm
|
46 denise.eckstein 1.4 ifndef PEGASUS_RPM_BUILD_DEBUG
47 RPMBUILD:=rpmbuild
48 else
49 RPMBUILD:=rpmbuild -vv
50 endif
|
51 w.otsuka 1.1 RM:=rm
52 MV:=mv
53 CP:=cp
54 GREP:=grep
55 ECHO:=echo
|
56 denise.eckstein 1.14 ECHO-E:=echo -e
|
57 s.kodali 1.17 TOG_INSTALLED_RPMS:=$(shell $(RPM) -qa|grep $(PEGASUS_FLAVOR)-pegasus)
|
58 w.otsuka 1.1
59 ifdef PEGASUS_BUILD_BRANCH
60 ifeq ($(PEGASUS_BUILD_BRANCH),MAIN)
61 PEGASUS_RPM_CVS_TAG:=HEAD
62 else
63 PEGASUS_RPM_CVS_TAG:=$(PEGASUS_BUILD_BRANCH)
64 endif
65 else
66 PEGASUS_RPM_CVS_TAG:=HEAD
67 endif
68
69 ifeq ($(IDISTRO),RedHatEnterpriseServer)
70 DISTRO:=REDHAT
|
71 denise.eckstein 1.9 export PEGASUS_DISTRO_SUFFIX:= \
|
72 denise.eckstein 1.15 $(if $(filter $(RELEASE),4.92 4.93 5 5.1 5.2 5.3),el5,xxx)
|
73 w.otsuka 1.1 else
74 ifeq ($(findstring RedHat,$(IDISTRO)),RedHat)
75 DISTRO:=REDHAT
76 ifeq ($(RELEASE),4)
77 export PEGASUS_DISTRO_SUFFIX=rhel4
78 else
79 ifeq ($(RELEASE),3)
80 export PEGASUS_DISTRO_SUFFIX=rhel3
81 else
82 export PEGASUS_DISTRO_SUFFIX=xxx
83 endif
84 endif
85 else
86 ifeq ($(findstring SUSE,$(IDISTRO)),SUSE)
87 DISTRO:=SUSE
88 ifeq ($(RELEASE),9)
89 export PEGASUS_DISTRO_SUFFIX=sles9
90 else
91 ifeq ($(RELEASE),10)
92 export PEGASUS_DISTRO_SUFFIX=sles10
93 else
94 w.otsuka 1.1 export PEGASUS_DISTRO_SUFFIX=xxx
95 endif
96 endif
97 endif
98 endif
99 endif
100
101 ###############################################################################
102 #
103 # The user may set PEGASUS_RPM_DIRECTORY to the path of their rpm build target.
|
104 kumpf 1.16 # The source tar file will then be in
|
105 w.otsuka 1.1 # PEGASUS_RPM_DIRECTORY/SOURCES/tog-pegasus.
106 # If PEGASUS_RPM_DIRECTORY is not defined the rpm build target path will be
107 # defaulted to the well-known locations on redhat and suse systems.
108 #
109 ###############################################################################
110 ifndef PEGASUS_RPM_DIRECTORY
111 ifeq ($(DISTRO),REDHAT)
112 PEGASUS_RPM_DIRECTORY:=/usr/src/redhat
113 else
114 ifeq ($(DISTRO),SUSE)
115 PEGASUS_RPM_DIRECTORY:=/usr/src/packages
116 endif
117 endif
118 TOG_PEGASUS_DIR:=""
119 else
|
120 s.kodali 1.17 TOG_PEGASUS_DIR:=$(PEGASUS_FLAVOR)-pegasus
|
121 w.otsuka 1.1 endif
122
|
123 denise.eckstein 1.5 VERSION:=$(PEGASUS_PRODUCT_VERSION)-$(PEGASUS_PACKAGE_VERSION)
|
124 s.kodali 1.17 CORE_RPM:=$(PEGASUS_FLAVOR)-pegasus-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
125 SDK_RPM:=$(PEGASUS_FLAVOR)-pegasus-devel-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
126 TEST_RPM:=$(PEGASUS_FLAVOR)-pegasus-test-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
127 SRC_RPM:=$(PEGASUS_FLAVOR)-pegasus-$(VERSION).src.rpm
128 RPM_SRC_DIR:=$(shell echo $(PEGASUS_FLAVOR)-pegasus-$(PEGASUS_PRODUCT_VERSION))
|
129 w.otsuka 1.1
130 USAGE = @$(ECHO) $(1)
131
|
132 kumpf 1.16 usage:
|
133 w.otsuka 1.1 $(USAGE)
134 $(USAGE)"RPMMakefile targets:"
135 $(USAGE)""
136 $(USAGE)"exportSRC - cvs export of pegasus"
137 $(USAGE)"createSRCRPM - creates source rpm"
138 $(USAGE)"createBINRPM - creates binary rpms including the test"
139 $(USAGE)" rpm from the source rpm"
140 $(USAGE)"buildRPM - createSRCRPM createBINRPM"
141 $(USAGE)"buildall - exportSRC buildRPM"
|
142 w.otsuka 1.3 $(USAGE)"list - list installed tog-pegasus rpms"
143 $(USAGE)"tests - runs sample tests and test rpm tests"
144 $(USAGE)"install - installs tog-pegasus core and devel rpms"
145 $(USAGE)"world - cleanRPM buildall install tests"
146 $(USAGE)"cleanRPM - uninstalls tog-pegasus rpms"
|
147 w.otsuka 1.1 $(USAGE)""
148 $(USAGE)"Input variables:"
149 $(USAGE)"PEGASUS_BUILD_BRANCH - pegasus branch to build"
150 $(USAGE)" HEAD is used if MAIN is specified"
151
|
152 denise.eckstein 1.9 CORE_PATTERN = \"core*\"
153 define checkForCores
154 @if [ "`find $1 $2 -name $(CORE_PATTERN)`" != "" ]; \
155 then echo "*** One or more core files found:" \
156 "`find $1 $2 -name $(CORE_PATTERN)`"; \
157 exit 1; fi;
158 @if [ "$(PEGASUS_CORE_DIR)" != "" ] && \
159 [ "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`" \
160 != "" ]; then echo "*** One or more core files found:" \
161 "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`";\
162 exit 1; fi
163 endef
164
|
165 denise.eckstein 1.11 define removeRPM
166 @if [ -n "`rpm -qa | grep $1-[0-9]`" ]; then \
167 rpm -e `rpm -qa | grep $1-[0-9]`; \
168 fi
169 endef
170
|
171 denise.eckstein 1.10 define startCIMServer
|
172 s.kodali 1.17 @/etc/init.d/$(PEGASUS_FLAVOR)-pegasus status > /dev/null 2>&1; \
|
173 denise.eckstein 1.10 if [ $$? != 0 ]; then \
|
174 s.kodali 1.17 /etc/init.d/$(PEGASUS_FLAVOR)-pegasus start; \
|
175 denise.eckstein 1.10 fi
176 endef
177
178 define stopCIMServer
|
179 s.kodali 1.17 @/etc/init.d/$(PEGASUS_FLAVOR)-pegasus status > /dev/null 2>&1; \
|
180 denise.eckstein 1.10 if [ $$? == 0 ]; then \
|
181 s.kodali 1.17 /etc/init.d/$(PEGASUS_FLAVOR)-pegasus stop; \
|
182 denise.eckstein 1.10 fi
183 endef
184
185
|
186 w.otsuka 1.1 exportSRC:
187 @cvs -d:pserver:anon@cvs.opengroup.org:/cvs/MSB export -r $(PEGASUS_RPM_CVS_TAG) pegasus
188
|
189 denise.eckstein 1.14 enableSQLiteRepository:
190 $(ECHO-E) "" \
191 >> pegasus/env_var_Linux.status
192 $(ECHO-E) "PEGASUS_USE_SQLITE_REPOSITORY = true" \
193 >> pegasus/env_var_Linux.status
194 ifdef SQLITE_HOME
195 $(ECHO-E) "SQLITE_HOME = $(SQLITE_HOME)" \
196 >> pegasus/env_var_Linux.status
197 endif
198
|
199 w.otsuka 1.1 createSRCRPM:
200
|
201 denise.eckstein 1.5 ifndef PEGASUS_PRODUCT_VERSION
202 @$(ECHO) "PEGASUS_PRODUCT_VERSION is not defined"
|
203 w.otsuka 1.1 @exit 2
204 endif
|
205 denise.eckstein 1.8 @$(MV) pegasus $(RPM_SRC_DIR)
206 @$(CP) $(RPM_SRC_DIR)/rpm/tog-pegasus.spec \
|
207 kumpf 1.16 $(PEGASUS_RPM_DIRECTORY)/SPECS
|
208 s.kodali 1.17 @tar czf $(PEGASUS_FLAVOR)-pegasus-$(VERSION).tar.gz $(RPM_SRC_DIR)
209 @$(CP) $(PEGASUS_FLAVOR)-pegasus-$(VERSION).tar.gz $(PEGASUS_RPM_DIRECTORY)/SOURCES/$(TOG_PEGASUS_DIR)
|
210 w.otsuka 1.1 @$(RPMBUILD) -bs $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
211
212 createBINRPM:
213 @$(RPM) -i $(PEGASUS_RPM_DIRECTORY)/SRPMS/$(SRC_RPM)
214 @$(RPMBUILD) -bb --define 'LINUX_VERSION $(PEGASUS_DISTRO_SUFFIX)' --define 'PEGASUS_BUILD_TEST_RPM 1' $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
215
|
216 kumpf 1.16 list:
|
217 s.kodali 1.17 @$(RPM) -qa|$(GREP) $(PEGASUS_FLAVOR)-pegasus
|
218 w.otsuka 1.1
|
219 w.otsuka 1.3 tests:
220 # Start cimserver
|
221 denise.eckstein 1.10 -$(call stopCIMServer)
222 $(call startCIMServer)
|
223 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
224 w.otsuka 1.3
225 # Run some sanity tests
226 # osinfo, cimserver -v, cimprovider -l -s, cimconfig -l -c etc
227 @$(ECHO) "+++++ Running sanity checks +++++"
228 @$(ECHO) "+++++ Running osinfo +++++"
229 $(PEGASUS_BIN_DIR)/osinfo
|
230 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
231 w.otsuka 1.3
232 @$(ECHO) "+++++ Running cimserver -v +++++"
233 $(PEGASUS_SBIN_DIR)/cimserver -v
|
234 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
235 w.otsuka 1.3
236 @$(ECHO) "+++++ Running cimconfig +++++"
237 $(PEGASUS_SBIN_DIR)/cimconfig -l -c
|
238 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
239 w.otsuka 1.3
240 @$(ECHO) "+++++ Running cimprovider +++++"
241 $(PEGASUS_BIN_DIR)/cimprovider -l -s
|
242 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
243 w.otsuka 1.3
244 @$(ECHO) "+++++ Stopping cimserver +++++"
|
245 denise.eckstein 1.10 @$(call stopCIMServer)
|
246 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
247 w.otsuka 1.3
248 @$(ECHO) "+++++ Starting cimserver +++++"
|
249 denise.eckstein 1.10 $(call startCIMServer)
|
250 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
251 w.otsuka 1.3
252 # Run samples
253 @$(ECHO) "+++++ Running samples +++++"
254 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile
255 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile setupSDK
256 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile testSDK
|
257 yi.zhou 1.6 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile unsetupSDK
|
258 denise.eckstein 1.9 $(call checkForCores,$(PEGASUS_SAMPLES_DIR),)
|
259 w.otsuka 1.3
260 # Install the test RPM after running SDK tests. This is because
261 # the test RPM over-writes the repository.
262 @$(ECHO) "+++++ Installing Test RPM +++++"
263 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(TEST_RPM)
|
264 denise.eckstein 1.5 $(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile setupTEST
265 $(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile tests
|
266 denise.eckstein 1.9 $(call checkForCores,$(PEGASUS_TEST_DIR),)
|
267 w.otsuka 1.3
268 # Install rpms
269 install:
270 @$(ECHO) "+++++ Installing RPMs +++++"
271 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(CORE_RPM)
272 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(SDK_RPM)
273 $(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
274
275 cleanRPM:
|
276 s.kodali 1.17 $(call removeRPM,$(PEGASUS_FLAVOR)-pegasus-test);
|
277 denise.eckstein 1.10 -$(call startCIMServer)
|
278 s.kodali 1.17 $(call removeRPM,$(PEGASUS_FLAVOR)-pegasus-devel);
279 $(call removeRPM,$(PEGASUS_FLAVOR)-pegasus);
|
280 denise.eckstein 1.8 -$(RM) -Rf $(RPM_SRC_DIR).old
281 ifneq ($(wildcard $(RPM_SRC_DIR)), )
282 $(MV) $(RPM_SRC_DIR) $(RPM_SRC_DIR).old
283 endif
|
284 w.otsuka 1.3
285 buildRPM: cleanRPM createSRCRPM createBINRPM
286
287 buildall: exportSRC buildRPM
|
288 w.otsuka 1.1
|
289 w.otsuka 1.3 world: buildall install tests
|