From: Tomas Sedovic <tsedovic(a)redhat.com>
Building the rpms using `make rpms` now adds a timestamp and commit id to all
the built rpms -- including the Console and Connector.
---
Makefile.am | 5 +++--
services/image_factory/console/rake/rpmtask.rb | 7 +++++--
.../image_factory_connector/rake/rpmtask.rb | 12 ++++++++++--
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 4acec50..36de8b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,14 +37,15 @@ GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head)
RPMDIR = $$(rpm --eval '%{_rpmdir}')
RPM_FLAGS = --define "conductor_cache_dir $(CONDUCTOR_CACHE_DIR)"
RPM_FLAGS += $(if $(_conductor_dev),--define "extra_release .$(GIT_RELEASE)")
+RAKE_EXTRA_RELEASE = $(if $(_conductor_dev),"extra_release=.$(GIT_RELEASE)")
SUBDIRS = src/classad_plugin
ACLOCAL_AMFLAGS = -I m4
rpms: dist
- cd services/image_factory/console; rake rpms
- cd services/image_factory/image_factory_connector; rake rpms
+ cd services/image_factory/console; rake rpms $(RAKE_EXTRA_RELEASE)
+ cd services/image_factory/image_factory_connector; rake rpms $(RAKE_EXTRA_RELEASE)
rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
srpms: dist
diff --git a/services/image_factory/console/rake/rpmtask.rb b/services/image_factory/console/rake/rpmtask.rb
index d11283b..7534693 100644
--- a/services/image_factory/console/rake/rpmtask.rb
+++ b/services/image_factory/console/rake/rpmtask.rb
@@ -75,12 +75,15 @@ module Rake
task :rpms => [rpm_file]
# FIXME properly determine :package build artifact(s) to copy to sources dir
- file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do
+ file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do |t,args|
cp "#{package_dir}/#{@name}-#{@version}.tgz", "#{@topdir}/SOURCES/"
# FIXME - This seems like a hack, but we don't know the gem's name
cp "#{package_dir}/#{(a)name.gsub('rubygem-', '')}-#{(a)version}.gem", "#{@topdir}/SOURCES/"
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba #{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'extra_release #{args.extra_release}' " +
+ "-ba #{@rpm_spec}"
end
end
diff --git a/services/image_factory/image_factory_connector/rake/rpmtask.rb b/services/image_factory/image_factory_connector/rake/rpmtask.rb
index c88d461..416a42b 100644
--- a/services/image_factory/image_factory_connector/rake/rpmtask.rb
+++ b/services/image_factory/image_factory_connector/rake/rpmtask.rb
@@ -80,7 +80,12 @@ module Rake
task :rpms => [rpm_file]
# FIXME properly determine :package build artifact(s) to copy to sources dir
- file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do
+ file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do |t,args|
+ if args.extra_release.nil? || args.extra_release.empty?
+ extra_release = ''
+ else
+ extra_release = '.' + args.extra_release
+ end
cp "#{package_dir}/#{@name}-#{@version}.tgz", "#{@topdir}/SOURCES/"
@sources.each do |source|
# TODO - Is there a smarter way of doing this?
@@ -89,7 +94,10 @@ module Rake
cp "#{dir}/#{source}", "#{@topdir}/SOURCES/"
end
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba #{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'extra_release #{args.extra_release}' " +
+ "-ba #{@rpm_spec}"
end
end
--
1.7.4