[puppet] Preserve timestamps when installing files

Todd Zullinger tmz at fedoraproject.org
Wed Jul 18 21:57:58 UTC 2012


commit e6d8c53229bbeb13fc2f863a1b166fca649f0a1a
Author: Todd Zullinger <tmz at pobox.com>
Date:   Thu Jul 12 00:37:23 2012 -0400

    Preserve timestamps when installing files

 ...Preserve-timestamps-when-installing-files.patch |   87 ++++++++++++++++++++
 puppet.spec                                        |    3 +
 2 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/0001-Preserve-timestamps-when-installing-files.patch b/0001-Preserve-timestamps-when-installing-files.patch
new file mode 100644
index 0000000..6fb536a
--- /dev/null
+++ b/0001-Preserve-timestamps-when-installing-files.patch
@@ -0,0 +1,87 @@
+From cfce8cf0baa7a96498f0ddc2c46170ed38c9aea7 Mon Sep 17 00:00:00 2001
+From: Todd Zullinger <tmz at pobox.com>
+Date: Thu, 12 Jul 2012 00:34:28 -0400
+Subject: [PATCH/puppet] Preserve timestamps when installing files
+
+Without the preserve option, ruby's FileUtils.install method uses the
+current time for all installed files.  For backup systems, package
+installs, and general pedantic sysadmins, preserving timestamps makes a
+small improvement in the world.
+---
+ install.rb |   16 ++++++++--------
+ 1 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/install.rb b/install.rb
+index a55d929..c77edff 100755
+--- a/install.rb
++++ b/install.rb
+@@ -84,7 +84,7 @@ def do_configs(configs, target, strip = 'conf/')
+     if $haveftools
+       File.install(cf, ocf, 0644, true)
+     else
+-      FileUtils.install(cf, ocf, {:mode => 0644, :verbose => true})
++      FileUtils.install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true})
+     end
+   end
+ 
+@@ -94,7 +94,7 @@ def do_configs(configs, target, strip = 'conf/')
+     if $haveftools
+       File.install(src_dll, dst_dll, 0644, true)
+     else
+-      FileUtils.install(src_dll, dst_dll, {:mode => 0644, :verbose => true})
++      FileUtils.install(src_dll, dst_dll, {:mode => 0644, :preserve => true, :verbose => true})
+     end
+ 
+     require 'win32/registry'
+@@ -130,7 +130,7 @@ def do_libs(libs, strip = 'lib/')
+     else
+       FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
+       FileUtils.chmod(0755, op)
+-      FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
++      FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
+     end
+   end
+ end
+@@ -146,7 +146,7 @@ def do_man(man, strip = 'man/')
+     else
+       FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
+       FileUtils.chmod(0755, om)
+-      FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
++      FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
+     end
+     gzip = %x{which gzip}
+     gzip.chomp!
+@@ -420,12 +420,12 @@ def install_binfile(from, op_file, target)
+     installed_wrapper = false
+ 
+     if File.exists?("#{from}.bat")
+-      FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
++      FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
+       installed_wrapper = true
+     end
+ 
+     if File.exists?("#{from}.cmd")
+-      FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :verbose => true)
++      FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true)
+       installed_wrapper = true
+     end
+ 
+@@ -439,13 +439,13 @@ set RUBY_BIN=%RUBY_BIN:\\=/%
+ "%RUBY_BIN%ruby.exe" -x "%RUBY_BIN%puppet" %*
+ EOS
+       File.open(tmp_file2.path, "w") { |cw| cw.puts cwv }
+-      FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
++      FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
+ 
+       tmp_file2.unlink
+       installed_wrapper = true
+     end
+   end
+-  FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :verbose => true)
++  FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true)
+   tmp_file.unlink
+ end
+ 
+-- 
+1.7.6
+
diff --git a/puppet.spec b/puppet.spec
index f8f5342..28563ce 100644
--- a/puppet.spec
+++ b/puppet.spec
@@ -24,6 +24,7 @@ Source3:        puppet-nm-dispatcher
 # https://projects.puppetlabs.com/issues/11325
 # https://github.com/puppetlabs/puppet/commit/a71208ba
 Patch0:         0001-Ruby-1.9.3-has-a-different-error-when-require-fails.patch
+Patch1:         0001-Preserve-timestamps-when-installing-files.patch
 
 Group:          System Environment/Base
 
@@ -84,6 +85,7 @@ The server can also function as a certificate authority and file server.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 patch -s -p1 < conf/redhat/rundir-perms.patch
 
 # Fix some rpmlint complaints
@@ -288,6 +290,7 @@ rm -rf %{buildroot}
 - Update to 2.7.17, fixes CVE-2012-3864, CVE-2012-3865, CVE-2012-3866,
   CVE-2012-3867
 - Improve NetworkManager compatibility, thanks to Orion Poplawski (#532085)
+- Preserve timestamps when installing files
 
 * Wed Apr 25 2012 Todd Zullinger <tmz at pobox.com> - 2.7.13-1
 - Update to 2.7.13


More information about the scm-commits mailing list