[DRE-commits] [gem2deb] 01/04: dh-make-ruby: never overwrite debian/copyright
Antonio Terceiro
terceiro at moszumanska.debian.org
Wed Mar 2 20:23:34 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository gem2deb.
commit 8f0dc106ff02594186853867dfd43a81c671e348
Author: Antonio Terceiro <terceiro at debian.org>
Date: Wed Mar 2 16:28:30 2016 -0300
dh-make-ruby: never overwrite debian/copyright
---
bin/dh-make-ruby | 2 +-
debian/changelog | 9 +++++++++
lib/gem2deb/dh_make_ruby.rb | 6 +++++-
test/unit/dh_make_ruby_test.rb | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/bin/dh-make-ruby b/bin/dh-make-ruby
index 5e56387..4c1ad02 100755
--- a/bin/dh-make-ruby
+++ b/bin/dh-make-ruby
@@ -97,7 +97,7 @@ this option an explicit package u.
=item B<-w>, B<--overwrite>
Overwrites packaging files that already exists but would be created by
-dh-make-ruby if they didn't.
+dh-make-ruby if they didn't. Exception: I<debian/copyright> is never touched.
=item B<--ruby-versions VERSIONS>
diff --git a/debian/changelog b/debian/changelog
index cfe3005..1177d4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+gem2deb (0.26.3) UNRELEASED; urgency=medium
+
+ * dh-make-ruby:
+ - with -w/--overwrite, never overwrite debian/copyright, since it will be
+ always replace a human-reviewed debian/copyright with a completely dumb
+ boilerplate.
+
+ -- Antonio Terceiro <terceiro at debian.org> Wed, 02 Mar 2016 16:26:58 -0300
+
gem2deb (0.26.2) unstable; urgency=medium
* dh-make-ruby: bump Standards-Version in generated debian/control files to
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 948388a..07a3a8c 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -298,8 +298,12 @@ module Gem2Deb
end
end
+ NEVER_OVERWRITE = %w[
+ debian/copyright
+ ]
+
def maybe_create(filename)
- if File.exist?(filename) && !overwrite
+ if File.exist?(filename) && (!overwrite || NEVER_OVERWRITE.include?(filename))
return
end
File.open(filename, 'w') { |f| yield f }
diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb
index 05ed56b..3398d6c 100644
--- a/test/unit/dh_make_ruby_test.rb
+++ b/test/unit/dh_make_ruby_test.rb
@@ -175,6 +175,44 @@ class DhMakeRubyTest < Gem2DebTestCase
end
end
+ context 'dh-make-ruby --overwrite' do
+ setup do
+ @pwd = Dir.pwd
+ @tmpdir = Dir.mktmpdir
+ Dir.chdir @tmpdir
+ Dir.mkdir('debian')
+ @dmr = Gem2Deb::DhMakeRuby.new('.')
+ end
+ teardown do
+ Dir.chdir @pwd
+ FileUtils.rm_rf @tmpdir
+ end
+ should 'create file' do
+ @dmr.overwrite = false
+ @dmr.maybe_create('debian/rules') { |f| f.puts('hello') }
+ assert_file_exists 'debian/rules'
+ end
+ should 'overwrite if overwrite is true' do
+ @dmr.overwrite = true
+ @dmr.maybe_create('debian/rules') { |f| f.puts('hello 1') }
+ @dmr.maybe_create('debian/rules') { |f| f.puts('hello 2') }
+ assert_equal 'hello 2', File.read('debian/rules').strip
+ end
+ should 'not overwrite if overwrite is false' do
+ @dmr.overwrite = false
+ @dmr.maybe_create('debian/rules') { |f| f.puts('hello 1') }
+ @dmr.maybe_create('debian/rules') { |f| f.puts('hello 2') }
+ assert_equal 'hello 1', File.read('debian/rules').strip
+ end
+ should 'never overwrite debian/copyright' do
+ @dmr.overwrite = true
+ @dmr.maybe_create('debian/copyright') { |f| f.puts('hello 1') }
+ @dmr.maybe_create('debian/copyright') { |f| f.puts('hello 2') }
+ assert_equal 'hello 1', File.read('debian/copyright').strip
+ end
+
+ end
+
protected
def packages
--
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