[DRE-commits] [gem2deb] 01/01: Remove rdoc stamp files at install time
zeha at debian.org
zeha at debian.org
Thu Apr 9 08:33:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
zeha pushed a commit to branch reproducible
in repository gem2deb.
commit c45b5be1936ebbad7bc4c904e171c123caadcba0
Author: Christian Hofstaedtler <zeha at debian.org>
Date: Wed Apr 8 18:43:11 2015 +0200
Remove rdoc stamp files at install time
The rdoc stamp files are hindering the reproducible build effort.
Instead of depriving rdoc itself of it's minimal rebuild functionality,
we remove the stamp files at package build time. We assume that the
stamp files only end up inside /usr/share/doc/<package>, and that they're
installed no later than dh_installdocs.
---
bin/dh_ruby_fixdocs | 61 ++++++++++++++++++++++++++++
debhelper7/Debian/Debhelper/Sequence/ruby.pm | 2 +
test/integration/dh_ruby_fixdocs_test.rb | 46 +++++++++++++++++++++
3 files changed, 109 insertions(+)
diff --git a/bin/dh_ruby_fixdocs b/bin/dh_ruby_fixdocs
new file mode 100755
index 0000000..a3e62d2
--- /dev/null
+++ b/bin/dh_ruby_fixdocs
@@ -0,0 +1,61 @@
+#!/usr/bin/ruby
+#
+# Copyright © 2015, Christian Hofstaedtler <zeha at debian.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+require 'gem2deb'
+require 'gem2deb/dh_ruby'
+include Gem2Deb
+
+`dh_listpackages`.split.each do |package|
+ Dir.glob("debian/#{package}/usr/share/doc/**/created.rid").each do |path|
+ next if File.directory?(path)
+ File.unlink(path)
+ end
+end
+__END__
+=head1 NAME
+
+dh_ruby_fixdocs - remove unused files from rdoc directories
+
+=head1 SYNOPSIS
+
+B<dh_ruby_fixdocs>
+
+=head1 DESCRIPTION
+
+B<dh_ruby_fixdocs> is called by the I<ruby> dh sequence. You should
+not call it directly.
+
+=head1 SEE ALSO
+
+L<B<gem2deb>>(1), L<B<dh_ruby>>(1)
+
+=head1 COPYRIGHT AND AUTHORS
+
+Copyright (c) 2015, Christian Hofstaedtler <zeha at debian.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/debhelper7/Debian/Debhelper/Sequence/ruby.pm b/debhelper7/Debian/Debhelper/Sequence/ruby.pm
index 25ef16d..5c924a7 100644
--- a/debhelper7/Debian/Debhelper/Sequence/ruby.pm
+++ b/debhelper7/Debian/Debhelper/Sequence/ruby.pm
@@ -7,6 +7,8 @@ use Debian::Debhelper::Dh_Lib;
insert_after("dh_shlibdeps", "dh_ruby_fixdepends");
+insert_after("dh_installdocs", "dh_ruby_fixdocs");
+
add_command_options("dh_compress", "-X.rb");
1
diff --git a/test/integration/dh_ruby_fixdocs_test.rb b/test/integration/dh_ruby_fixdocs_test.rb
new file mode 100644
index 0000000..7f6e53d
--- /dev/null
+++ b/test/integration/dh_ruby_fixdocs_test.rb
@@ -0,0 +1,46 @@
+require_relative '../test_helper'
+
+class DhRubyFixDocsTest < Gem2DebTestCase
+
+ should 'remove created.rid from doc folder' do
+ docfiles = prepare('foo') do
+ docfiles = Dir.glob("debian/foo/**/*")
+ assert docfiles.any? { |filename| filename =~ /created.rid/ }, "#{docfiles.inspect} expected to include created.rid after prepare"
+
+ run_command('dh_ruby_fixdocs')
+
+ Dir.glob("debian/foo/**/*")
+ end
+
+ assert docfiles.none? { |filename| filename =~ /created.rid/ }, "#{docfiles.inspect} expected to not include created.rid"
+ end
+
+ def prepare(package)
+ pkgdir = File.join(tmpdir, package)
+ FileUtils.mkdir(pkgdir)
+ Dir.chdir(pkgdir) do
+ FileUtils.mkdir 'debian'
+
+ File.open('debian/control', 'w') do |control|
+ control.puts("Source: #{package}")
+ control.puts('Maintainer: The Maintainer <maintainer at example.com>')
+ control.puts('XS-Ruby-Versions: all')
+ control.puts
+ control.puts("Package: #{package}")
+ control.puts('Architecture: any')
+ control.puts('Depends: ${shlibs:Depends}, ruby | ruby-interpreter')
+ control.puts('Description: example package')
+ control.puts(' Just for testing')
+ end
+
+ FileUtils.mkdir_p 'debian/foo/usr/share/doc/foo/rdoc'
+ File.open('debian/foo/usr/share/doc/foo/rdoc/created.rid', 'w') do |f|
+ f.puts("Stub rdoc timestamp file")
+ end
+
+ yield
+ end
+ end
+
+end
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git
More information about the Pkg-ruby-extras-commits
mailing list