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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2