From d0469a432852807954112c791521205192aef714 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Wed, 15 Feb 2012 10:43:03 -0500 Subject: [PATCH] Preserve timestamps when installing files --- ...rve-timestamps-when-installing-files.patch | 70 +++++++++++++++++++ facter.spec | 4 ++ 2 files changed, 74 insertions(+) create mode 100644 0001-Preserve-timestamps-when-installing-files.patch diff --git a/0001-Preserve-timestamps-when-installing-files.patch b/0001-Preserve-timestamps-when-installing-files.patch new file mode 100644 index 0000000..c7f9ad6 --- /dev/null +++ b/0001-Preserve-timestamps-when-installing-files.patch @@ -0,0 +1,70 @@ +From 850bfabe67ab2ab62f0d3f16acc941a6043ca92d Mon Sep 17 00:00:00 2001 +From: Todd Zullinger +Date: Wed, 15 Feb 2012 10:07:11 -0500 +Subject: [PATCH/facter] 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 | 12 ++++++------ + 1 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/install.rb b/install.rb +index ab233c3..e1785a2 100755 +--- a/install.rb ++++ b/install.rb +@@ -102,7 +102,7 @@ def do_libs(libs, strip = 'lib/') + op = File.dirname(olf) + 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 + +@@ -113,7 +113,7 @@ def do_man(man, strip = 'man/') + om = File.dirname(omf) + 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}) + gzip = %x{which gzip} + gzip.chomp! + %x{#{gzip} -f #{omf}} +@@ -412,12 +412,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 + +@@ -431,13 +431,13 @@ set RUBY_BIN=%RUBY_BIN:\\=/% + "%RUBY_BIN%ruby.exe" -x "%RUBY_BIN%facter" %* + EOS + File.open(tmp_file2, "w") { |cw| cw.puts cwv } +- FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true) ++ FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true) + + File.unlink(tmp_file2) + installed_wrapper = true + end + end +- FileUtils.install(tmp_file, File.join(target, op_file), :mode => 0755, :verbose => true) ++ FileUtils.install(tmp_file, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true) + File.unlink(tmp_file) + end + +-- +1.7.6 + diff --git a/facter.spec b/facter.spec index 4b73121..5ca74c8 100644 --- a/facter.spec +++ b/facter.spec @@ -21,6 +21,8 @@ Source0: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.g Source1: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.gz.asc # https://bugzilla.redhat.com/790849 Patch0: 0001-Make-ec2-facts-work-on-CentOS-again.patch +# https://github.com/puppetlabs/facter/pull/171 +Patch1: 0001-Preserve-timestamps-when-installing-files.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ruby >= 1.8.1 @@ -51,6 +53,7 @@ operating system. Additional facts can be added through simple Ruby scripts %prep %setup -q %patch0 -p1 +%patch1 -p1 %build @@ -84,6 +87,7 @@ rspec spec - Make spec file work for EPEL and Fedora - Drop BuildArch: noarch and make dmidecode/pciutils deps arch-specific - Make ec2 facts work on CentOS again (#790849, thanks to Jeremy Katz) +- Preserve timestamps when installing files * Thu Feb 02 2012 Bohuslav Kabrda - 1.6.5-2 - Rebuilt for Ruby 1.9.3.