---
contrib/deltacloud-configure.spec | 2 +-
rake/rpmtask.rb | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/contrib/deltacloud-configure.spec b/contrib/deltacloud-configure.spec
index 670d401..d88d43a 100644
--- a/contrib/deltacloud-configure.spec
+++ b/contrib/deltacloud-configure.spec
@@ -4,7 +4,7 @@
Summary: DeltaCloud Configure Puppet Recipe
Name: deltacloud-configure
Version: 2.0.0
-Release: 2%{?dist}
+Release: 2%{?dist}%{timestamp}
Group: Applications/Internet
License: GPLv2+
diff --git a/rake/rpmtask.rb b/rake/rpmtask.rb
index ff2ee66..0dd361c 100644
--- a/rake/rpmtask.rb
+++ b/rake/rpmtask.rb
@@ -18,6 +18,9 @@ module Rake
# RPM build dir
attr_accessor :topdir
+ # Include a timestamp in the rpm
+ attr_accessor :include_timestamp
+
def initialize(rpm_spec)
init(rpm_spec)
yield self if block_given?
@@ -25,6 +28,7 @@ module Rake
end
def init(rpm_spec)
+ @include_timestamp = false
@rpm_spec = rpm_spec
# parse this out of the rpmbuild macros,
@@ -63,13 +67,17 @@ module Rake
directory "#{@topdir}/SPECS"
desc "Build the rpms"
- task :rpms => [rpm_file]
+ task :rpms, [:include_timestamp] => [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, [:include_timestamp] => [:package,
"#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do |t,args|
+ @include_timestamp = args.include_timestamp != "false"
cp "#{package_dir}/#{@name}-#{(a)version}.tgz",
"#{@topdir}/SOURCES/"
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba
#{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'timestamp .#{@include_timestamp ?
Time.now.strftime("%Y%m%d%k%M%s").gsub(/\s/, '') : ''}'
" +
+ "-ba #{@rpm_spec}"
end
end
--
1.7.2.3
Show replies by thread