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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2