(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 karl            1.17.4.1 ###############################################################################
 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                              DISTRO:=REDHAT
 78 denise.eckstein 1.9          export PEGASUS_DISTRO_SUFFIX:= \
 79 karl            1.17.4.1         $(if $(filter $(RELEASE),4.92 4.93 5 5.1 5.2 5.3),el5,$(if $(filter $(RELEASE),6 6.0),el6,xxx))
 80 w.otsuka        1.1      else
 81                              ifeq ($(findstring RedHat,$(IDISTRO)),RedHat)
 82                                  DISTRO:=REDHAT
 83 karl            1.17.4.1         ifeq ($(findstring 6, $(RELEASE)),6)
 84                                     export PEGASUS_DISTRO_SUFFIX=rhel6
 85                                  else
 86                                      ifeq ($(findstring 5, $(RELEASE)),5)
 87                                          export PEGASUS_DISTRO_SUFFIX=rhel5
 88                                      else
 89                                          ifeq ($(findstring 4, $(RELEASE)),4)
 90 w.otsuka        1.1                 export PEGASUS_DISTRO_SUFFIX=rhel4
 91                                  else
 92 karl            1.17.4.1                    ifeq ($(findstring 3, $(RELEASE)),3)
 93 w.otsuka        1.1                      export PEGASUS_DISTRO_SUFFIX=rhel3
 94                                      else
 95                                          export PEGASUS_DISTRO_SUFFIX=xxx
 96                                      endif
 97                                  endif
 98 karl            1.17.4.1             endif
 99                                  endif
100 w.otsuka        1.1          else
101                                  ifeq ($(findstring SUSE,$(IDISTRO)),SUSE)
102                                      DISTRO:=SUSE
103                                      ifeq ($(RELEASE),9)
104                                          export PEGASUS_DISTRO_SUFFIX=sles9
105                                      else
106                                          ifeq ($(RELEASE),10)
107                                              export PEGASUS_DISTRO_SUFFIX=sles10
108                                          else
109 karl            1.17.4.1                    ifeq ($(RELEASE),11)
110                                                 export PEGASUS_DISTRO_SUFFIX=sles11
111                                             else
112 w.otsuka        1.1                          export PEGASUS_DISTRO_SUFFIX=xxx
113                                          endif
114                                      endif
115                                  endif
116                              endif
117                          endif
118 karl            1.17.4.1 endif
119 w.otsuka        1.1      
120                          ###############################################################################
121                          #
122                          # The user may set PEGASUS_RPM_DIRECTORY to the path of their rpm build target.
123 kumpf           1.16     # The source tar file will then be in
124 w.otsuka        1.1      # PEGASUS_RPM_DIRECTORY/SOURCES/tog-pegasus.
125                          # If PEGASUS_RPM_DIRECTORY is not defined the rpm build target path will be
126                          # defaulted to the well-known locations on redhat and suse systems.
127                          #
128                          ###############################################################################
129                          ifndef PEGASUS_RPM_DIRECTORY
130                            ifeq ($(DISTRO),REDHAT)
131                              PEGASUS_RPM_DIRECTORY:=/usr/src/redhat
132                            else
133                              ifeq ($(DISTRO),SUSE)
134                                PEGASUS_RPM_DIRECTORY:=/usr/src/packages
135                              endif
136                            endif
137                            TOG_PEGASUS_DIR:=""
138                          else
139 s.kodali        1.17       TOG_PEGASUS_DIR:=$(PEGASUS_FLAVOR)-pegasus
140 w.otsuka        1.1      endif
141                          
142 denise.eckstein 1.5      VERSION:=$(PEGASUS_PRODUCT_VERSION)-$(PEGASUS_PACKAGE_VERSION)
143 s.kodali        1.17     CORE_RPM:=$(PEGASUS_FLAVOR)-pegasus-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
144                          SDK_RPM:=$(PEGASUS_FLAVOR)-pegasus-devel-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
145                          TEST_RPM:=$(PEGASUS_FLAVOR)-pegasus-test-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
146                          SRC_RPM:=$(PEGASUS_FLAVOR)-pegasus-$(VERSION).src.rpm
147                          RPM_SRC_DIR:=$(shell echo $(PEGASUS_FLAVOR)-pegasus-$(PEGASUS_PRODUCT_VERSION))
148 w.otsuka        1.1      
149                          USAGE = @$(ECHO) $(1)
150                          
151 kumpf           1.16     usage:
152 w.otsuka        1.1      	$(USAGE)
153                          	$(USAGE)"RPMMakefile targets:"
154                          	$(USAGE)""
155                          	$(USAGE)"exportSRC            - cvs export of pegasus"
156                          	$(USAGE)"createSRCRPM         - creates source rpm"
157                          	$(USAGE)"createBINRPM         - creates binary rpms including the test"
158                          	$(USAGE)"                       rpm from the source rpm"
159                          	$(USAGE)"buildRPM             - createSRCRPM createBINRPM"
160                          	$(USAGE)"buildall             - exportSRC buildRPM"
161 w.otsuka        1.3      	$(USAGE)"list                 - list installed tog-pegasus rpms"
162                          	$(USAGE)"tests                - runs sample tests and test rpm tests"
163                          	$(USAGE)"install              - installs tog-pegasus core and devel rpms"
164                          	$(USAGE)"world                - cleanRPM buildall install tests"
165                          	$(USAGE)"cleanRPM             - uninstalls tog-pegasus rpms"
166 w.otsuka        1.1      	$(USAGE)""
167                          	$(USAGE)"Input variables:"
168                          	$(USAGE)"PEGASUS_BUILD_BRANCH - pegasus branch to build"
169                          	$(USAGE)"                       HEAD is used if MAIN is specified"
170                          
171 denise.eckstein 1.9      CORE_PATTERN = \"core*\"
172                          define checkForCores
173                          	@if [ "`find $1 $2  -name $(CORE_PATTERN)`" != "" ]; \
174                                       then echo "*** One or more core files found:" \
175                                          "`find $1 $2 -name $(CORE_PATTERN)`"; \
176                                          exit 1; fi;
177                          	@if [ "$(PEGASUS_CORE_DIR)" != "" ] && \
178                                       [ "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`" \
179                                          != "" ]; then echo "*** One or more core files found:" \
180                                          "`find $(PEGASUS_CORE_DIR) -maxdepth 1 -name $(CORE_PATTERN)`";\
181                                          exit 1; fi
182                          endef
183                          
184 denise.eckstein 1.11     define removeRPM
185                          	@if [ -n "`rpm -qa | grep $1-[0-9]`" ]; then \
186                                     rpm -e `rpm -qa | grep $1-[0-9]`; \
187                                  fi
188                          endef
189                          
190 denise.eckstein 1.10     define startCIMServer
191 s.kodali        1.17     	@/etc/init.d/$(PEGASUS_FLAVOR)-pegasus status > /dev/null 2>&1; \
192 denise.eckstein 1.10             if [ $$? != 0 ]; then \
193 s.kodali        1.17                 /etc/init.d/$(PEGASUS_FLAVOR)-pegasus start; \
194 denise.eckstein 1.10             fi
195                          endef
196                          
197                          define stopCIMServer
198 s.kodali        1.17     	@/etc/init.d/$(PEGASUS_FLAVOR)-pegasus status > /dev/null 2>&1; \
199 denise.eckstein 1.10             if [ $$? == 0 ]; then \
200 s.kodali        1.17                 /etc/init.d/$(PEGASUS_FLAVOR)-pegasus stop; \
201 denise.eckstein 1.10             fi
202                          endef
203                          
204                          
205 w.otsuka        1.1      exportSRC:
206                          	@cvs -d:pserver:anon@cvs.opengroup.org:/cvs/MSB export -r $(PEGASUS_RPM_CVS_TAG) pegasus
207                          
208 denise.eckstein 1.14     enableSQLiteRepository:
209                          	$(ECHO-E) "" \
210                                      >> pegasus/env_var_Linux.status
211                          	$(ECHO-E) "PEGASUS_USE_SQLITE_REPOSITORY = true" \
212                                      >> pegasus/env_var_Linux.status
213                          ifdef SQLITE_HOME
214                          	$(ECHO-E) "SQLITE_HOME = $(SQLITE_HOME)" \
215                                      >> pegasus/env_var_Linux.status
216                          endif
217                          
218 w.otsuka        1.1      createSRCRPM:
219                          
220 denise.eckstein 1.5      ifndef PEGASUS_PRODUCT_VERSION
221                          	@$(ECHO) "PEGASUS_PRODUCT_VERSION is not defined"
222 w.otsuka        1.1      	@exit 2
223                          endif
224 denise.eckstein 1.8      	@$(MV) pegasus $(RPM_SRC_DIR)
225                          	@$(CP) $(RPM_SRC_DIR)/rpm/tog-pegasus.spec \
226 kumpf           1.16                 $(PEGASUS_RPM_DIRECTORY)/SPECS
227 s.kodali        1.17     	@tar czf $(PEGASUS_FLAVOR)-pegasus-$(VERSION).tar.gz $(RPM_SRC_DIR)
228                          	@$(CP) $(PEGASUS_FLAVOR)-pegasus-$(VERSION).tar.gz $(PEGASUS_RPM_DIRECTORY)/SOURCES/$(TOG_PEGASUS_DIR)
229 w.otsuka        1.1      	@$(RPMBUILD) -bs $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
230                          
231                          createBINRPM:
232                          	@$(RPM) -i $(PEGASUS_RPM_DIRECTORY)/SRPMS/$(SRC_RPM)
233                          	@$(RPMBUILD) -bb --define 'LINUX_VERSION $(PEGASUS_DISTRO_SUFFIX)' --define 'PEGASUS_BUILD_TEST_RPM 1' $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
234                          
235 kumpf           1.16     list:
236 s.kodali        1.17     	@$(RPM) -qa|$(GREP) $(PEGASUS_FLAVOR)-pegasus
237 w.otsuka        1.1      
238 w.otsuka        1.3      tests:
239                          	# Start cimserver
240 denise.eckstein 1.10     	-$(call stopCIMServer)
241                          	$(call startCIMServer)
242 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
243 w.otsuka        1.3      
244                          	# Run some sanity tests
245                          	# osinfo, cimserver -v, cimprovider -l -s, cimconfig -l -c etc
246                          	@$(ECHO) "+++++ Running sanity checks +++++"
247                          	@$(ECHO) "+++++ Running osinfo +++++"
248                          	$(PEGASUS_BIN_DIR)/osinfo
249 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
250 w.otsuka        1.3      
251                          	@$(ECHO) "+++++ Running cimserver -v +++++"
252                          	$(PEGASUS_SBIN_DIR)/cimserver -v
253 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
254 w.otsuka        1.3      
255                          	@$(ECHO) "+++++ Running cimconfig +++++"
256                          	$(PEGASUS_SBIN_DIR)/cimconfig -l -c
257 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
258 w.otsuka        1.3      
259                          	@$(ECHO) "+++++ Running cimprovider +++++"
260                          	$(PEGASUS_BIN_DIR)/cimprovider -l -s
261 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
262 w.otsuka        1.3      
263                          	@$(ECHO) "+++++ Stopping cimserver +++++"
264 denise.eckstein 1.10     	@$(call stopCIMServer)
265 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
266 w.otsuka        1.3      
267                          	@$(ECHO) "+++++ Starting cimserver +++++"
268 denise.eckstein 1.10     	$(call startCIMServer)
269 denise.eckstein 1.9      	$(call checkForCores,./,-maxdepth 1)
270 w.otsuka        1.3      
271                          	# Run samples
272                          	@$(ECHO) "+++++ Running samples +++++"
273                          	$(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile
274                          	$(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile setupSDK
275                          	$(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile testSDK
276 yi.zhou         1.6      	$(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile unsetupSDK
277 denise.eckstein 1.9      	$(call checkForCores,$(PEGASUS_SAMPLES_DIR),)
278 w.otsuka        1.3      
279                          	# Install the test RPM after running SDK tests. This is because
280                          	# the test RPM over-writes the repository.
281                          	@$(ECHO) "+++++ Installing Test RPM +++++"
282                          	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(TEST_RPM)
283 denise.eckstein 1.5      	$(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile setupTEST
284                          	$(MAKE) --directory=$(PEGASUS_TEST_DIR) -f Makefile tests
285 denise.eckstein 1.9      	$(call checkForCores,$(PEGASUS_TEST_DIR),)
286 w.otsuka        1.3      
287                          # Install rpms
288                          install:
289                          	@$(ECHO) "+++++ Installing RPMs +++++"
290                          	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(CORE_RPM)
291                          	$(RPM) -ih $(PEGASUS_RPM_DIRECTORY)/RPMS/$(PLATFORM)/$(SDK_RPM)
292                          	$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
293                          
294                          cleanRPM:
295 s.kodali        1.17     	$(call removeRPM,$(PEGASUS_FLAVOR)-pegasus-test);
296 denise.eckstein 1.10     	-$(call startCIMServer)
297 s.kodali        1.17     	$(call removeRPM,$(PEGASUS_FLAVOR)-pegasus-devel);
298                          	$(call removeRPM,$(PEGASUS_FLAVOR)-pegasus);
299 denise.eckstein 1.8      	-$(RM) -Rf $(RPM_SRC_DIR).old
300                          ifneq ($(wildcard $(RPM_SRC_DIR)), )
301                          	$(MV) $(RPM_SRC_DIR) $(RPM_SRC_DIR).old
302                          endif
303 w.otsuka        1.3      
304                          buildRPM: cleanRPM createSRCRPM createBINRPM
305                          
306                          buildall: exportSRC buildRPM
307 w.otsuka        1.1      
308 w.otsuka        1.3      world: buildall install tests

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2