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 TOG_INSTALLED_RPMS:=$(shell $(RPM) -qa|grep tog-pegasus)
57
58 ifdef PEGASUS_BUILD_BRANCH
59 ifeq ($(PEGASUS_BUILD_BRANCH),MAIN)
60 PEGASUS_RPM_CVS_TAG:=HEAD
61 else
62 PEGASUS_RPM_CVS_TAG:=$(PEGASUS_BUILD_BRANCH)
63 endif
64 else
65 PEGASUS_RPM_CVS_TAG:=HEAD
66 endif
67
68 ifeq ($(IDISTRO),RedHatEnterpriseServer)
69 DISTRO:=REDHAT
|
70 denise.eckstein 1.9 export PEGASUS_DISTRO_SUFFIX:= \
71 $(if $(filter $(RELEASE),4.92 4.93 5),el5,xxx)
|
72 w.otsuka 1.1 else
73 ifeq ($(findstring RedHat,$(IDISTRO)),RedHat)
74 DISTRO:=REDHAT
75 ifeq ($(RELEASE),4)
76 export PEGASUS_DISTRO_SUFFIX=rhel4
77 else
78 ifeq ($(RELEASE),3)
79 export PEGASUS_DISTRO_SUFFIX=rhel3
80 else
81 export PEGASUS_DISTRO_SUFFIX=xxx
82 endif
83 endif
84 else
85 ifeq ($(findstring SUSE,$(IDISTRO)),SUSE)
86 DISTRO:=SUSE
87 ifeq ($(RELEASE),9)
88 export PEGASUS_DISTRO_SUFFIX=sles9
89 else
90 ifeq ($(RELEASE),10)
91 export PEGASUS_DISTRO_SUFFIX=sles10
92 else
93 w.otsuka 1.1 export PEGASUS_DISTRO_SUFFIX=xxx
94 endif
95 endif
96 endif
97 endif
98 endif
99
100 ###############################################################################
101 #
102 # The user may set PEGASUS_RPM_DIRECTORY to the path of their rpm build target.
103 # The source tar file will then be in
104 # PEGASUS_RPM_DIRECTORY/SOURCES/tog-pegasus.
105 # If PEGASUS_RPM_DIRECTORY is not defined the rpm build target path will be
106 # defaulted to the well-known locations on redhat and suse systems.
107 #
108 ###############################################################################
109 ifndef PEGASUS_RPM_DIRECTORY
110 ifeq ($(DISTRO),REDHAT)
111 PEGASUS_RPM_DIRECTORY:=/usr/src/redhat
112 else
113 ifeq ($(DISTRO),SUSE)
114 w.otsuka 1.1 PEGASUS_RPM_DIRECTORY:=/usr/src/packages
115 endif
116 endif
117 TOG_PEGASUS_DIR:=""
118 else
119 TOG_PEGASUS_DIR:=tog-pegasus
120 endif
121
|
122 denise.eckstein 1.5 VERSION:=$(PEGASUS_PRODUCT_VERSION)-$(PEGASUS_PACKAGE_VERSION)
|
123 w.otsuka 1.1 CORE_RPM:=tog-pegasus-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
124 SDK_RPM:=tog-pegasus-devel-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
125 TEST_RPM:=tog-pegasus-test-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
126 SRC_RPM:=tog-pegasus-$(VERSION).src.rpm
|
127 denise.eckstein 1.8 RPM_SRC_DIR:=$(shell echo tog-pegasus-$(PEGASUS_PRODUCT_VERSION))
|
128 w.otsuka 1.1
129 USAGE = @$(ECHO) $(1)
130
131 usage:
132 $(USAGE)
133 $(USAGE)"RPMMakefile targets:"
134 $(USAGE)""
135 $(USAGE)"exportSRC - cvs export of pegasus"
136 $(USAGE)"createSRCRPM - creates source rpm"
137 $(USAGE)"createBINRPM - creates binary rpms including the test"
138 $(USAGE)" rpm from the source rpm"
139 $(USAGE)"buildRPM - createSRCRPM createBINRPM"
140 $(USAGE)"buildall - exportSRC buildRPM"
|
141 w.otsuka 1.3 $(USAGE)"list - list installed tog-pegasus rpms"
142 $(USAGE)"tests - runs sample tests and test rpm tests"
143 $(USAGE)"install - installs tog-pegasus core and devel rpms"
144 $(USAGE)"world - cleanRPM buildall install tests"
145 $(USAGE)"cleanRPM - uninstalls tog-pegasus rpms"
|
146 w.otsuka 1.1 $(USAGE)""
147 $(USAGE)"Input variables:"
148 $(USAGE)"PEGASUS_BUILD_BRANCH - pegasus branch to build"
149 $(USAGE)" HEAD is used if MAIN is specified"
150
|
151 denise.eckstein 1.9 CORE_PATTERN = \"core*\"
152 define checkForCores
153 @if [ "`find $1 $2 -name $(CORE_PATTERN)`" != "" ]; \
154 then echo "*** One or more core files found:" \
155 "`find $1 $2 -name $(CORE_PATTERN)`"; \
156 exit 1; fi;
157 @if [ "$(PEGASUS_CORE_DIR)" != "" ] && \
158 [ "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`" \
159 != "" ]; then echo "*** One or more core files found:" \
160 "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`";\
161 exit 1; fi
162 endef
163
|
164 denise.eckstein 1.11 define removeRPM
165 @if [ -n "`rpm -qa | grep $1-[0-9]`" ]; then \
166 rpm -e `rpm -qa | grep $1-[0-9]`; \
167 fi
168 endef
169
|
170 denise.eckstein 1.10 define startCIMServer
171 @/etc/init.d/tog-pegasus status > /dev/null 2>&1; \
172 if [ $$? != 0 ]; then \
173 /etc/init.d/tog-pegasus start; \
174 fi
175 endef
176
177 define stopCIMServer
178 @/etc/init.d/tog-pegasus status > /dev/null 2>&1; \
179 if [ $$? == 0 ]; then \
180 /etc/init.d/tog-pegasus stop; \
181 fi
182 endef
183
184
|
185 w.otsuka 1.1 exportSRC:
186 @cvs -d:pserver:anon@cvs.opengroup.org:/cvs/MSB export -r $(PEGASUS_RPM_CVS_TAG) pegasus
187
188 createSRCRPM:
189
|
190 denise.eckstein 1.5 ifndef PEGASUS_PRODUCT_VERSION
191 @$(ECHO) "PEGASUS_PRODUCT_VERSION is not defined"
|
192 w.otsuka 1.1 @exit 2
193 endif
|
194 denise.eckstein 1.8 @$(MV) pegasus $(RPM_SRC_DIR)
195 @$(CP) $(RPM_SRC_DIR)/rpm/tog-pegasus.spec \
196 $(PEGASUS_RPM_DIRECTORY)/SPECS
197 @tar czf tog-pegasus-$(VERSION).tar.gz $(RPM_SRC_DIR)
|
198 w.otsuka 1.1 @$(CP) tog-pegasus-$(VERSION).tar.gz $(PEGASUS_RPM_DIRECTORY)/SOURCES/$(TOG_PEGASUS_DIR)
199 @$(RPMBUILD) -bs $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
200
201 createBINRPM:
202 @$(RPM) -i $(PEGASUS_RPM_DIRECTORY)/SRPMS/$(SRC_RPM)
203 @$(RPMBUILD) -bb --define 'LINUX_VERSION $(PEGASUS_DISTRO_SUFFIX)' --define 'PEGASUS_BUILD_TEST_RPM 1' $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
204
205 list:
206 @$(RPM) -qa|$(GREP) tog-pegasus
207
|
208 w.otsuka 1.3 tests:
209 # Start cimserver
|
210 denise.eckstein 1.10 -$(call stopCIMServer)
211 $(call startCIMServer)
|
212 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
213 w.otsuka 1.3
214 # Run some sanity tests
215 # osinfo, cimserver -v, cimprovider -l -s, cimconfig -l -c etc
216 @$(ECHO) "+++++ Running sanity checks +++++"
217 @$(ECHO) "+++++ Running osinfo +++++"
218 $(PEGASUS_BIN_DIR)/osinfo
|
219 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
220 w.otsuka 1.3
221 @$(ECHO) "+++++ Running cimserver -v +++++"
222 $(PEGASUS_SBIN_DIR)/cimserver -v
|
223 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
224 w.otsuka 1.3
225 @$(ECHO) "+++++ Running cimconfig +++++"
226 $(PEGASUS_SBIN_DIR)/cimconfig -l -c
|
227 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
228 w.otsuka 1.3
229 @$(ECHO) "+++++ Running cimprovider +++++"
230 $(PEGASUS_BIN_DIR)/cimprovider -l -s
|
231 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
232 w.otsuka 1.3
233 @$(ECHO) "+++++ Stopping cimserver +++++"
|
234 denise.eckstein 1.10 @$(call stopCIMServer)
|
235 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
236 w.otsuka 1.3
237 @$(ECHO) "+++++ Starting cimserver +++++"
|
238 denise.eckstein 1.10 $(call startCIMServer)
|
239 denise.eckstein 1.9 $(call checkForCores,./,-maxdepth 1)
|
240 w.otsuka 1.3
241 # Run samples
242 @$(ECHO) "+++++ Running samples +++++"
243 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile
244 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile setupSDK
245 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile testSDK
|
246 yi.zhou 1.6 $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile unsetupSDK
|
247 denise.eckstein 1.9 $(call checkForCores,$(PEGASUS_SAMPLES_DIR),)
|
248 w.otsuka 1.3
249 # Install the test RPM after running SDK tests. This is because
250 # the test RPM over-writes the repository.
251 @$(ECHO) "+++++ Installing Test RPM +++++"
252 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(TEST_RPM)
|
253 denise.eckstein 1.5 $(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile setupTEST
254 $(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile tests
|
255 denise.eckstein 1.9 $(call checkForCores,$(PEGASUS_TEST_DIR),)
|
256 w.otsuka 1.3
257 # Install rpms
258 install:
259 @$(ECHO) "+++++ Installing RPMs +++++"
260 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(CORE_RPM)
261 $(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(SDK_RPM)
262 $(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
263
264 cleanRPM:
|
265 denise.eckstein 1.11 $(call removeRPM,tog-pegasus-test);
|
266 denise.eckstein 1.10 -$(call startCIMServer)
|
267 denise.eckstein 1.11 $(call removeRPM,tog-pegasus-devel);
268 $(call removeRPM,tog-pegasus);
|
269 denise.eckstein 1.8 -$(RM) -Rf $(RPM_SRC_DIR).old
270 ifneq ($(wildcard $(RPM_SRC_DIR)), )
271 $(MV) $(RPM_SRC_DIR) $(RPM_SRC_DIR).old
272 endif
|
273 w.otsuka 1.3
274 buildRPM: cleanRPM createSRCRPM createBINRPM
275
276 buildall: exportSRC buildRPM
|
277 w.otsuka 1.1
|
278 w.otsuka 1.3 world: buildall install tests
|