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