(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 w.otsuka 1.3 HOME_DIR=$(shell pwd)
 42 w.otsuka 1.1 RELEASE:=$(shell lsb_release -r -s)
 43              IDISTRO:=$(shell lsb_release -i -s)
 44              PLATFORM:=$(shell /bin/rpm --eval %_target_cpu)
 45              BRANCH:=$(PEGASUS_BUILD_BRANCH)
 46              RPM:=rpm
 47              RPMBUILD:=rpmbuild
 48              RM:=rm
 49              MV:=mv
 50              CP:=cp
 51              GREP:=grep
 52              ECHO:=echo
 53              TOG_INSTALLED_RPMS:=$(shell $(RPM) -qa|grep tog-pegasus)
 54 w.otsuka 1.3 PEGASUS_BIN_DIR:=/usr/bin
 55              PEGASUS_SBIN_DIR:=/usr/sbin
 56              PEGASUS_SAMPLES_DIR:=/usr/share/Pegasus/samples
 57              PEGASUS_RPM_TEST_DIR:=/usr/share/Pegasus/test
 58              PEGASUS_TEST_BIN_DIR:=/usr/share/Pegasus/test/bin
 59              PEGASUS_SCRIPT_DIR:=/usr/share/Pegasus/scripts
 60              CIMSERVER_START_SERVICE:=$(PEGASUS_SBIN_DIR)/cimserver
 61              CIMSERVER_STOP_SERVICE:=$(PEGASUS_SBIN_DIR)/cimserver -s
 62 w.otsuka 1.1 
 63              ifndef PEGASUS_SRC_RELEASE
 64                  PEGASUS_SRC_RELEASE:=1
 65              endif
 66              
 67              ifdef PEGASUS_BUILD_BRANCH
 68                  ifeq ($(PEGASUS_BUILD_BRANCH),MAIN)
 69                      PEGASUS_RPM_CVS_TAG:=HEAD
 70                  else
 71                      PEGASUS_RPM_CVS_TAG:=$(PEGASUS_BUILD_BRANCH)
 72                  endif
 73              else
 74                      PEGASUS_RPM_CVS_TAG:=HEAD
 75              endif
 76              
 77              ifeq ($(IDISTRO),RedHatEnterpriseServer)
 78                  DISTRO:=REDHAT
 79                  export PEGASUS_DISTRO_SUFFIX:=$(if $(filter $(RELEASE),4.92 4.93 5),el5,\
 80                      xxx)
 81              else
 82                  ifeq ($(findstring RedHat,$(IDISTRO)),RedHat)
 83 w.otsuka 1.1         DISTRO:=REDHAT
 84                      ifeq ($(RELEASE),4)
 85                         export PEGASUS_DISTRO_SUFFIX=rhel4
 86                      else
 87                          ifeq ($(RELEASE),3)
 88                              export PEGASUS_DISTRO_SUFFIX=rhel3
 89                          else
 90                              export PEGASUS_DISTRO_SUFFIX=xxx
 91                          endif
 92                      endif
 93                  else
 94                      ifeq ($(findstring SUSE,$(IDISTRO)),SUSE)
 95                          DISTRO:=SUSE
 96                          ifeq ($(RELEASE),9)
 97                              export PEGASUS_DISTRO_SUFFIX=sles9
 98                          else
 99                              ifeq ($(RELEASE),10)
100                                  export PEGASUS_DISTRO_SUFFIX=sles10
101                              else
102                                  export PEGASUS_DISTRO_SUFFIX=xxx
103                              endif
104 w.otsuka 1.1             endif
105                      endif
106                  endif
107              endif
108              
109              ###############################################################################
110              #
111              # The user may set PEGASUS_RPM_DIRECTORY to the path of their rpm build target.
112              # The source tar file will then be in 
113              # PEGASUS_RPM_DIRECTORY/SOURCES/tog-pegasus.
114              # If PEGASUS_RPM_DIRECTORY is not defined the rpm build target path will be
115              # defaulted to the well-known locations on redhat and suse systems.
116              #
117              ###############################################################################
118              ifndef PEGASUS_RPM_DIRECTORY
119                ifeq ($(DISTRO),REDHAT)
120                  PEGASUS_RPM_DIRECTORY:=/usr/src/redhat
121                else
122                  ifeq ($(DISTRO),SUSE)
123                    PEGASUS_RPM_DIRECTORY:=/usr/src/packages
124                  endif
125 w.otsuka 1.1   endif
126                TOG_PEGASUS_DIR:=""
127              else
128                TOG_PEGASUS_DIR:=tog-pegasus
129              endif
130              
131              VERSION:=$(PEGASUS_RPM_VERSION)-$(PEGASUS_SRC_RELEASE)
132              CORE_RPM:=tog-pegasus-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
133              SDK_RPM:=tog-pegasus-devel-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
134              TEST_RPM:=tog-pegasus-test-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
135              SRC_RPM:=tog-pegasus-$(VERSION).src.rpm
136              
137              USAGE = @$(ECHO) $(1)
138              
139              usage: 
140              	$(USAGE)
141              	$(USAGE)"RPMMakefile targets:"
142              	$(USAGE)""
143              	$(USAGE)"exportSRC            - cvs export of pegasus"
144              	$(USAGE)"createSRCRPM         - creates source rpm"
145              	$(USAGE)"createBINRPM         - creates binary rpms including the test"
146 w.otsuka 1.1 	$(USAGE)"                       rpm from the source rpm"
147              	$(USAGE)"buildRPM             - createSRCRPM createBINRPM"
148              	$(USAGE)"buildall             - exportSRC buildRPM"
149 w.otsuka 1.3 	$(USAGE)"list                 - list installed tog-pegasus rpms"
150              	$(USAGE)"tests                - runs sample tests and test rpm tests"
151              	$(USAGE)"install              - installs tog-pegasus core and devel rpms"
152              	$(USAGE)"world                - cleanRPM buildall install tests"
153              	$(USAGE)"cleanRPM             - uninstalls tog-pegasus rpms"
154 w.otsuka 1.1 	$(USAGE)""
155              	$(USAGE)"Input variables:"
156              	$(USAGE)"PEGASUS_BUILD_BRANCH - pegasus branch to build"
157              	$(USAGE)"                       HEAD is used if MAIN is specified"
158              	$(USAGE)"PEGASUS_RPM_VERSION  - pegasus release version (Required)"
159              	$(USAGE)"PEGASUS_SRC_RELEASE  - pegasus source release number"
160              	$(USAGE)"                       defaults to 1 if not specified"
161              	$(USAGE)"PEGASUS_RPM_DIRECTORY- path to target binary rpm directory"
162              	$(USAGE)"                       if it is not defined"
163              	$(USAGE)"                       defaults to /usr/src/redhat"
164              	$(USAGE)"                       for Red Hat distributions"
165              	$(USAGE)"                       defaults to /usr/src/packages"
166              	$(USAGE)"                       for SUSE distributions"
167              	$(USAGE)""
168              
169              exportSRC:
170              	@cvs -d:pserver:anon@cvs.opengroup.org:/cvs/MSB export -r $(PEGASUS_RPM_CVS_TAG) pegasus
171              
172              createSRCRPM:
173              
174              ifndef PEGASUS_RPM_VERSION
175 w.otsuka 1.1 	@$(ECHO) "PEGASUS_RPM_VERSION is not defined"
176              	@exit 2
177              endif
178              	@$(MV) pegasus tog-pegasus-$(PEGASUS_RPM_VERSION)
179              	@$(CP) tog-pegasus-$(PEGASUS_RPM_VERSION)/rpm/tog-pegasus.spec $(PEGASUS_RPM_DIRECTORY)/SPECS 
180              	@tar czf tog-pegasus-$(VERSION).tar.gz tog-pegasus-$(PEGASUS_RPM_VERSION)
181              	@$(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              	@$(HOME_DIR)/check_for_core
196              
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              	-@$(HOME_DIR)/check_for_core
203              
204              	@$(ECHO) "+++++ Running cimserver -v +++++"
205              	$(PEGASUS_SBIN_DIR)/cimserver -v
206              	@$(HOME_DIR)/check_for_core
207              
208              	@$(ECHO) "+++++ Running cimconfig +++++"
209              	$(PEGASUS_SBIN_DIR)/cimconfig -l -c
210              	@$(HOME_DIR)/check_for_core
211              
212 w.otsuka 1.3 	@$(ECHO) "+++++ Running cimprovider +++++"
213              	$(PEGASUS_BIN_DIR)/cimprovider -l -s
214              	@$(HOME_DIR)/check_for_core
215              
216              	@$(ECHO) "+++++ Stopping cimserver +++++"
217              	@$(CIMSERVER_STOP_SERVICE)
218              	@$(HOME_DIR)/check_for_core
219              
220              	@$(ECHO) "+++++ Starting cimserver +++++"
221              	$(CIMSERVER_START_SERVICE)
222              	@$(HOME_DIR)/check_for_core
223              
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              	@$(HOME_DIR)/check_for_core
230              
231              	# Install the test RPM after running SDK tests. This is because
232              	# the test RPM over-writes the repository.
233 w.otsuka 1.3 	@$(ECHO) "+++++ Installing Test RPM +++++"
234              	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(TEST_RPM)
235              	$(MAKE) --directory=$(PEGASUS_RPM_TEST_DIR) -f Makefile setupTEST
236              	$(MAKE) --directory=$(PEGASUS_RPM_TEST_DIR) -f Makefile tests
237              	@$(HOME_DIR)/check_for_core
238              
239              # Install rpms
240              install:
241              	@$(ECHO) "+++++ Installing RPMs +++++"
242              	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(CORE_RPM)
243              	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(SDK_RPM)
244              	$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
245              
246              cleanRPM:
247 w.otsuka 1.1 	-$(RPM) -e $(filter tog-pegasus-test%,$(TOG_INSTALLED_RPMS))
248              	-$(RPM) -e $(filter tog-pegasus-devel%,$(TOG_INSTALLED_RPMS))
249              	-$(RPM) -e $(filter tog-pegasus-2%,$(TOG_INSTALLED_RPMS))
250 w.otsuka 1.3 	-$(RM) -Rf tog-pegasus-$(PEGASUS_RPM_VERSION).old
251              	-$(MV) tog-pegasus-$(PEGASUS_RPM_VERSION) tog-pegasus-$(PEGASUS_RPM_VERSION).old
252              
253              buildRPM: cleanRPM createSRCRPM createBINRPM
254              
255              buildall: exportSRC buildRPM
256 w.otsuka 1.1 
257 w.otsuka 1.3 world: buildall install tests

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2