4 rpms
authorthierry <thierry@8c455092-636d-4788-adf5-e71def0336e8>
Fri, 5 Mar 2010 16:44:14 +0000 (16:44 +0000)
committerthierry <thierry@8c455092-636d-4788-adf5-e71def0336e8>
Fri, 5 Mar 2010 16:44:14 +0000 (16:44 +0000)
Makefile
omf-resctl.spec

index 604e8b6..8e624a8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,50 +1,54 @@
 # $Id: Makefile 16421 2010-01-04 11:29:55Z thierry $
 # $URL: svn+ssh://thierry@svn.planet-lab.org/svn/madwifi/trunk/Makefile $
 #
-WEBFETCH       := curl -H Pragma: -O -R -S --fail --show-error
-SHA1SUM                = sha1sum
+WEBFETCH               := curl -H Pragma: -O -R -S --fail --show-error
+SHA1SUM                        := sha1sum
 
-# default - overridden by the build
-SPECFILE       = omf-resctl.spec
+ALL += omf-resctl
+omf-resctl-URL         := http://pkg.mytestbed.net/yum/base/8/i386/omf-resctl-5.3-1ubuntu2-2.noarch.rpm
+omf-resctl-SHA1SUM     := 6f48dd1cb7505ba9301c55f9889fd78842510b68
+omf-resctl             := $(notdir $(omf-resctl-URL))
+ALL += omf-common
+omf-common-URL         := http://pkg.mytestbed.net/yum/base/8/i386/omf-common-5.3-1ubuntu3-2.noarch.rpm
+omf-common-SHA1SUM     := aceaca433ffa6b3ea2b8f62dd57fc739ed01c442
+omf-common             := $(notdir $(omf-common-URL))
+ALL += liblog4r
+liblog4r-URL           := http://pkg.mytestbed.net/yum/base/8/i386/liblog4r-ruby1.8-1.2-1.noarch.rpm
+liblog4r-SHA1SUM       := daf29f5e23665d835a922cb2dda693ba9aca4e07
+liblog4r               := $(notdir $(liblog4r-URL))
+ALL += libxmpp4r
+libxmpp4r-URL          := http://pkg.mytestbed.net/yum/base/8/i386/libxmpp4r-ruby1.8-1.0-1.noarch.rpm
+libxmpp4r-SHA1SUM      := 7db1a6260435aca494f9b5e36517568a7f63e5c8
+libxmpp4r              := $(notdir $(libxmpp4r-URL))
 
-main.URL       := http://pkg.mytestbed.net/yum/base/8/i386/omf-resctl-5.3-1ubuntu2-2.noarch.rpm
-main.SHA1SUM    := 6f48dd1cb7505ba9301c55f9889fd78842510b68
-main.FILE      := $(notdir $(main.URL))
+all: $(ALL)
+.PHONY: all
 
-# Thierry - when called from within the build, PWD is /build
-SOURCEFILES := $(main.FILE)
-
-$(main.FILE): #FORCE
-       @if [ ! -e "$@" ] ; then echo "$(WEBFETCH) $(main.URL)" ; $(WEBFETCH) $(main.URL) ; fi
-       @if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi
-       @if test "$$(sha1sum $@ | awk '{print $$1}')" != "$(main.SHA1SUM)" ; then \
-           echo "sha1sum of the downloaded $@ does not match the one from 'Makefile'" ; \
-           echo "Local copy: $$(sha1sum $@)" ; \
-           echo "In Makefile: $(main.SHA1SUM)" ; \
-           exit 1 ; \
+##############################
+define download_target
+$(1): $($(1))
+.PHONY: $($(1))
+$($(1)): 
+       @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi
+       @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
+       @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
+           echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
+           echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
+           echo "In Makefile: $($(1)-SHA1SUM)" ; \
+           false ; \
        else \
-           ls -l $@ ; \
+           ls -l $($(1)) ; \
        fi
+endef
 
-sources: $(SOURCEFILES)
-.PHONY: sources
-
-#PWD=$(shell pwd)
-#PREPARCH ?= noarch
-#RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
-#trees: sources
-#      rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
-#
-#srpm: sources
-#      rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
-#
-#TARGET ?= $(shell uname -m)
-#rpm: sources
-#      rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
-#
-#clean:
-#      rm -f *.rpm *.tgz *.bz2 *.gz
+$(eval $(call download_target,omf-resctl))
+$(eval $(call download_target,omf-common))
+$(eval $(call download_target,liblog4r))
+$(eval $(call download_target,libxmpp4r))
 
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
 ++%: varname=$(subst +,,$@)
 ++%:
        @echo "$(varname)=$($(varname))"
index 35c9907..c92e586 100644 (file)
@@ -1,7 +1,7 @@
 #
-# $Id: madwifi.spec 16422 2010-01-04 11:33:08Z thierry $
+# $Id$
 #
-%define url $URL: svn+ssh://thierry@svn.planet-lab.org/svn/madwifi/trunk/madwifi.spec $
+%define url $URL$
 
 # Marc E. Fiuczynski <mef@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
@@ -9,28 +9,27 @@
 
 %define name omf-resctl
 %define version 5.3
-%define release 1ubuntu2-2
 %define taglevel 1
 
-%define actual_name %{name}-%{version}-%{release}
+%define plc_name %{name}-%{version}-%{taglevel}
+%define actual_name omf-resctl-5.3-1ubuntu2-2
 
 Summary: OMF Resource Controller - for slivers
 Name: %{name}
 Version: %{version}
-Release: %{release}
+Release: %{taglevel}
 License: GPL
-Group: System Environment/Kernel
-Source0: %{actual_name}.noarch.rpm
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+Group: System Environment/Base
+Source0: %{plc_name}.tar.bz2
+BuildRoot: %{_tmppath}/%{plc_name}-buildroot
 
 Vendor: NICTA
-Packager: PlanetLab <devel@planet-lab.eu>
-Distribution: PlanetLab %{plrelease}
+Packager: PlanetLab <devel@planet-lab.org>
+Distribution: %{pldistro} %{plrelease}
 URL: %(echo %{url} | cut -d ' ' -f 2)
+BuildArch: noarch
 
 Requires: imagezip
-Requires: liblog4r-ruby1.8  
-Requires: libxmpp4r-ruby1.8  
 Requires: pciutils  
 Requires: ruby  
 Requires: wget  
@@ -38,31 +37,73 @@ Requires: wireless-tools
 Requires: rpmlib(CompressedFileNames) <= 3.0.4-1
 Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1
 
-Requires: omf-common-5.3  
+Requires: omf-common  
+Requires: liblog4r
+Requires: libxmpp4r
 
-%description The OMF Resource Controller (RC) is the experiment-side
-of the Experiment Eontroller (EC) that lets experimenter control their
+%description 
+The OMF Resource Controller (RC) is the experiment-side of the
+Experiment Eontroller (EC) that lets experimenter control their
 resources. It relies on an XMPP server for exchanging with its EC.
 
+####################
+%define common_actual_name omf-common-5.3-1ubuntu3-2
+
+%package -n omf-common
+Summary: OMF common utilities 
+Group: System Environment/Base
+%description -n omf-common
+Provides utilities common to various OMF components
+
+####################
+%define liblog4r_actual_name liblog4r-ruby1.8-1.2-1
+
+%package -n liblog4r
+Summary:  A logging library for Ruby
+Group: System Environment/Base
+%description -n liblog4r
+A logging library for Ruby, needed by OMF software
+
+####################
+%define libxmpp4r_actual_name libxmpp4r-ruby1.8-1.0-1
+
+%package -n libxmpp4r
+Summary:  XMPP/Jabber library for Ruby
+Group: System Environment/Base
+%description -n libxmpp4r
+An XMPP/Jabber library for Ruby, needed by OMF software
+
+####################
+
 %prep
-%setup -n %{actual_name}
+%setup -n %{plc_name}
 
 %build
 rm -rf $RPM_BUILD_ROOT
 
-make sources
 mkdir unwrap
-cd unwrap
-rpm2cpio ../omf-resctl*.rmp | cpio -diu
+
+make omf-resctl 
+(cd unwrap; rpm2cpio ../%{actual_name}.noarch.rpm | cpio -diu)
+make omf-common
+(cd unwrap ; rpm2cpio ../%{common_actual_name}.noarch.rpm | cpio -diu)
+make liblog4r 
+(cd unwrap; rpm2cpio ../%{liblog4r_actual_name}.noarch.rpm | cpio -diu)
+make libxmpp4r 
+(cd unwrap; rpm2cpio ../%{libxmpp4r_actual_name}.noarch.rpm | cpio -diu)
+
+# cleanup svn sequels
+find unwrap -type d -name .svn -print0 | xargs -0 rm -rf
 
 %install
 rm -fr $RPM_BUILD_ROOT
 
-rsync -av unwrap/ $RPM_BUILD_ROOT
+rsync -a unwrap/ $RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+####################
 %files
 %defattr(-,root,root)
 /etc
@@ -70,8 +111,36 @@ rm -rf $RPM_BUILD_ROOT
 /usr/share/omf-resctl-%{version}
 /usr/share/doc
 
+#
 %post
-# tweak config in /etc/omf-resctl-5.3/
 mkdir /etc/omf-resctl-5.3/
+# xxx tweak config in /etc/omf-resctl-5.3/
+/sbin/chkconfig --add omf-resctl-5.3
+service omf-resctl-5.3 restart
+
+####################
+%files -n omf-common
+%defattr(-,root,root)
+/usr/share/omf-common-%{version}
+/usr/share/doc/omf-common-%{version}
+
+#
+%post -n omf-common
+ln -s /usr/bin/ruby /usr/bin/ruby1.8
+
+####################
+%files -n liblog4r
+%defattr(-,root,root)
+/usr/lib/ruby/1.8/log4r.rb
+/usr/lib/ruby/1.8/log4r
+/usr/share/doc/liblog4r-ruby1.8
+
+####################
+%files -n libxmpp4r
+%defattr(-,root,root)
+/usr/lib/ruby/1.8/xmpp4r.rb
+/usr/lib/ruby/1.8/xmpp4r
+/usr/share/doc/libxmpp4r-ruby1.8
 
+####################
 %changelog