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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2