(file) Return to RPMMakefile CVS log (file) (dir) Up to [Pegasus] / pegasus / rpm

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2