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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2