[DRE-commits] [ruby-foreman] 04/15: Add new set of patches for new upstream version
Antonio Terceiro
terceiro at moszumanska.debian.org
Wed Feb 4 17:29:50 UTC 2015
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository ruby-foreman.
commit 42e58d7950a76d9ce5c63e41e7bc9400fbc8ae3e
Author: Antonio Terceiro <terceiro at debian.org>
Date: Wed Feb 4 12:57:37 2015 -0200
Add new set of patches for new upstream version
---
.../0001-Look-for-data-in-usr-share-foreman.patch | 42 +++++++
debian/patches/0001-Remove-taskman-script.patch | 26 -----
...0002-Don-t-use-bundler-when-running-tests.patch | 44 --------
...ng-build-dependencies-run-tests-recursive.patch | 35 ++++++
...03-Don-t-use-simplecov-when-running-tests.patch | 24 ----
debian/patches/0003-Port-tests-to-fakefs-0.4.patch | 122 +++++++++++++++++++++
.../0004-spec_helper-don-t-use-bundle-exec.patch | 46 ++++++++
debian/patches/series | 6 +-
8 files changed, 248 insertions(+), 97 deletions(-)
diff --git a/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch b/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch
new file mode 100644
index 0000000..c348856
--- /dev/null
+++ b/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch
@@ -0,0 +1,42 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Wed, 4 Feb 2015 10:38:51 -0200
+Subject: Look for data in /usr/share/foreman
+
+---
+ lib/foreman/export/base.rb | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/lib/foreman/export/base.rb
++++ b/lib/foreman/export/base.rb
+@@ -111,7 +111,7 @@ private ################################
+ elsif File.exist?(file_path = File.expand_path(File.join("~/.foreman/templates", file)))
+ File.read(file_path)
+ else
+- File.read(File.expand_path("../../../../data/export/#{exporter}/#{file}", __FILE__))
++ File.read(data_file("export/#{exporter}/#{file}"))
+ end
+ end
+
+@@ -123,7 +123,7 @@ private ################################
+ matchers = []
+ matchers << File.join(options[:template], name_without_first) if options[:template]
+ matchers << File.expand_path("~/.foreman/templates/#{name}")
+- matchers << File.expand_path("../../../../data/export/#{name}", __FILE__)
++ matchers << data_file("export/#{name}")
+ File.read(matchers.detect { |m| File.exists?(m) })
+ end
+ end
+@@ -153,4 +153,13 @@ private ################################
+ end
+ end
+
++ private
++
++ def data_file(path)
++ [
++ File.expand_path("../../../../data/#{path}", __FILE__),
++ "/usr/share/foreman/data/#{path}"
++ ].find { |f| File.exist?(f) }
++ end
++
+ end
diff --git a/debian/patches/0001-Remove-taskman-script.patch b/debian/patches/0001-Remove-taskman-script.patch
deleted file mode 100644
index 790b5a6..0000000
--- a/debian/patches/0001-Remove-taskman-script.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Per Andersson <avtobiff at gmail.com>
-Date: Mon, 10 Jun 2013 01:36:41 +0200
-Subject: Remove taskman script
-
-Unused leftovers from tmux support.
-
-See http://github.com/ddollar/foreman/issues/242
----
- bin/taskman | 8 --------
- 1 file changed, 8 deletions(-)
- delete mode 100755 bin/taskman
-
-diff --git a/bin/taskman b/bin/taskman
-deleted file mode 100755
-index ae33123..0000000
---- a/bin/taskman
-+++ /dev/null
-@@ -1,8 +0,0 @@
--#!/usr/bin/env ruby
--
--$:.unshift File.expand_path("../../lib", __FILE__)
--
--require "foreman/cli"
--
--Foreman::CLI.engine_class = Foreman::TmuxEngine
--Foreman::CLI.start
diff --git a/debian/patches/0002-Don-t-use-bundler-when-running-tests.patch b/debian/patches/0002-Don-t-use-bundler-when-running-tests.patch
deleted file mode 100644
index 1da5d86..0000000
--- a/debian/patches/0002-Don-t-use-bundler-when-running-tests.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From: Per Andersson <avtobiff at gmail.com>
-Date: Sun, 23 Jun 2013 17:49:17 +0200
-Subject: Don't use bundler when running tests
-
----
- Rakefile | 2 +-
- spec/spec_helper.rb | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/Rakefile b/Rakefile
-index 8f70115..3e11856 100644
---- a/Rakefile
-+++ b/Rakefile
-@@ -1,7 +1,7 @@
- $:.unshift File.expand_path("../lib", __FILE__)
- require "foreman"
-
--require "bundler/setup"
-+#require "bundler/setup"
-
- Dir[File.expand_path("../tasks/*.rake", __FILE__)].each do |task|
- load task
-diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
-index 70536cd..9336452 100644
---- a/spec/spec_helper.rb
-+++ b/spec/spec_helper.rb
-@@ -32,7 +32,7 @@ end
-
- def forked_foreman(args)
- rd, wr = IO.pipe("BINARY")
-- Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
-+ Process.spawn("bin/foreman #{args}", :out => wr, :err => wr)
- wr.close
- rd.read
- end
-@@ -57,7 +57,7 @@ def fork_and_capture(&blk)
- end
-
- def fork_and_get_exitstatus(args)
-- pid = Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
-+ pid = Process.spawn("bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
- Process.wait(pid)
- $?.exitstatus
- end
diff --git a/debian/patches/0002-tests-missing-build-dependencies-run-tests-recursive.patch b/debian/patches/0002-tests-missing-build-dependencies-run-tests-recursive.patch
new file mode 100644
index 0000000..4581188
--- /dev/null
+++ b/debian/patches/0002-tests-missing-build-dependencies-run-tests-recursive.patch
@@ -0,0 +1,35 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Wed, 4 Feb 2015 11:28:08 -0200
+Subject: tests: missing build dependencies + run tests recursively
+
+---
+ debian/control | 2 +-
+ debian/ruby-tests.rake | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/debian/control b/debian/control
+index 95d5280..82ce968 100644
+--- a/debian/control
++++ b/debian/control
+@@ -3,7 +3,7 @@ Section: ruby
+ Priority: optional
+ Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
+ Uploaders: Antonio Terceiro <terceiro at debian.org>
+-Build-Depends: debhelper (>= 7.0.50~), gem2deb, ruby-rspec, rake
++Build-Depends: debhelper (>= 7.0.50~), gem2deb, ruby-rspec, rake, ruby-timecop, ruby-fakefs, ruby-rr, ruby-simplecov
+ Standards-Version: 3.9.5
+ Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/foreman.git
+ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/foreman.git;a=summary
+diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
+index 99987ae..dcc1601 100644
+--- a/debian/ruby-tests.rake
++++ b/debian/ruby-tests.rake
+@@ -1,7 +1,7 @@
+ require 'rspec/core/rake_task'
+
+ RSpec::Core::RakeTask.new(:spec) do |spec|
+- spec.pattern = './spec/*_spec.rb'
++ spec.pattern = './spec/**/*_spec.rb'
+ end
+
+ task :default => :spec
diff --git a/debian/patches/0003-Don-t-use-simplecov-when-running-tests.patch b/debian/patches/0003-Don-t-use-simplecov-when-running-tests.patch
deleted file mode 100644
index 04b174a..0000000
--- a/debian/patches/0003-Don-t-use-simplecov-when-running-tests.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Per Andersson <avtobiff at gmail.com>
-Date: Sun, 23 Jun 2013 17:49:28 +0200
-Subject: Don't use simplecov when running tests
-
----
- spec/spec_helper.rb | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
-index 9336452..b9df554 100644
---- a/spec/spec_helper.rb
-+++ b/spec/spec_helper.rb
-@@ -1,7 +1,7 @@
--require "simplecov"
--SimpleCov.start do
-- add_filter "/spec/"
--end
-+#require "simplecov"
-+#SimpleCov.start do
-+# add_filter "/spec/"
-+#end
-
- require "rspec"
- require "timecop"
diff --git a/debian/patches/0003-Port-tests-to-fakefs-0.4.patch b/debian/patches/0003-Port-tests-to-fakefs-0.4.patch
new file mode 100644
index 0000000..e122d03
--- /dev/null
+++ b/debian/patches/0003-Port-tests-to-fakefs-0.4.patch
@@ -0,0 +1,122 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Wed, 4 Feb 2015 11:29:58 -0200
+Subject: Port tests to fakefs 0.4
+
+Submitted upstream at https://github.com/ddollar/foreman/pull/522
+---
+ spec/foreman/cli_spec.rb | 1 -
+ spec/foreman/engine_spec.rb | 12 ++++++------
+ spec/foreman/procfile_spec.rb | 1 +
+ spec/spec_helper.rb | 14 ++++++++++++++
+ 4 files changed, 21 insertions(+), 7 deletions(-)
+
+diff --git a/spec/foreman/cli_spec.rb b/spec/foreman/cli_spec.rb
+index d62c13c..4b22d74 100644
+--- a/spec/foreman/cli_spec.rb
++++ b/spec/foreman/cli_spec.rb
+@@ -66,7 +66,6 @@ describe "Foreman::CLI", :fakefs do
+ end
+
+ it "without a Procfile displays an error" do
+- FileUtils.rm_f "Procfile"
+ expect(foreman("check")).to eq("ERROR: Procfile does not exist.\n")
+ end
+ end
+diff --git a/spec/foreman/engine_spec.rb b/spec/foreman/engine_spec.rb
+index 6f534c7..8ac3536 100644
+--- a/spec/foreman/engine_spec.rb
++++ b/spec/foreman/engine_spec.rb
+@@ -62,14 +62,14 @@ describe "Foreman::Engine", :fakefs do
+
+ describe "environment" do
+ it "should read env files" do
+- File.open("/tmp/env", "w") { |f| f.puts("FOO=baz") }
++ write_file("/tmp/env") { |f| f.puts("FOO=baz") }
+ subject.load_env("/tmp/env")
+ expect(subject.env["FOO"]).to eq("baz")
+ end
+
+ it "should read more than one if specified" do
+- File.open("/tmp/env1", "w") { |f| f.puts("FOO=bar") }
+- File.open("/tmp/env2", "w") { |f| f.puts("BAZ=qux") }
++ write_file("/tmp/env1") { |f| f.puts("FOO=bar") }
++ write_file("/tmp/env2") { |f| f.puts("BAZ=qux") }
+ subject.load_env "/tmp/env1"
+ subject.load_env "/tmp/env2"
+ expect(subject.env["FOO"]).to eq("bar")
+@@ -77,7 +77,7 @@ describe "Foreman::Engine", :fakefs do
+ end
+
+ it "should handle quoted values" do
+- File.open("/tmp/env", "w") do |f|
++ write_file("/tmp/env") do |f|
+ f.puts 'FOO=bar'
+ f.puts 'BAZ="qux"'
+ f.puts "FRED='barney'"
+@@ -91,7 +91,7 @@ describe "Foreman::Engine", :fakefs do
+ end
+
+ it "should handle multiline strings" do
+- File.open("/tmp/env", "w") do |f|
++ write_file("/tmp/env") do |f|
+ f.puts 'FOO="bar\nbaz"'
+ end
+ subject.load_env "/tmp/env"
+@@ -103,7 +103,7 @@ describe "Foreman::Engine", :fakefs do
+ end
+
+ it "should set port from .env if specified" do
+- File.open("/tmp/env", "w") { |f| f.puts("PORT=9000") }
++ write_file("/tmp/env") { |f| f.puts("PORT=9000") }
+ subject.load_env "/tmp/env"
+ expect(subject.send(:base_port)).to eq(9000)
+ end
+diff --git a/spec/foreman/procfile_spec.rb b/spec/foreman/procfile_spec.rb
+index 0f2f420..51b0251 100644
+--- a/spec/foreman/procfile_spec.rb
++++ b/spec/foreman/procfile_spec.rb
+@@ -36,6 +36,7 @@ describe Foreman::Procfile, :fakefs do
+ it "can write to a file" do
+ subject["foo"] = "./foo"
+ subject["bar"] = "./bar"
++ Dir.mkdir('/tmp')
+ subject.save "/tmp/proc"
+ expect(File.read("/tmp/proc")).to eq("foo: ./foo\nbar: ./bar\n")
+ end
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index 3c510ed..2eaca35 100644
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -82,6 +82,7 @@ def write_foreman_config(app)
+ end
+
+ def write_procfile(procfile="Procfile", alpha_env="")
++ FileUtils.mkdir_p(File.dirname(procfile))
+ File.open(procfile, "w") do |file|
+ file.puts "alpha: ./alpha" + " #{alpha_env}".rstrip
+ file.puts "\n"
+@@ -92,6 +93,13 @@ def write_procfile(procfile="Procfile", alpha_env="")
+ File.expand_path(procfile)
+ end
+
++def write_file(file)
++ FileUtils.mkdir_p(File.dirname(file))
++ File.open(file, 'w') do |f|
++ yield(f)
++ end
++end
++
+ def write_env(env=".env", options={"FOO"=>"bar"})
+ File.open(env, "w") do |file|
+ options.each do |key, val|
+@@ -163,4 +171,10 @@ RSpec.configure do |config|
+ config.order = 'rand'
+ config.include FakeFS::SpecHelpers, :fakefs
+ config.mock_with :rr
++ config.before(:each) do
++ FileUtils.mkdir_p('/tmp')
++ end
++ config.after(:each) do
++ FileUtils.rm_rf('/tmp')
++ end
+ end
diff --git a/debian/patches/0004-spec_helper-don-t-use-bundle-exec.patch b/debian/patches/0004-spec_helper-don-t-use-bundle-exec.patch
new file mode 100644
index 0000000..05d6a5b
--- /dev/null
+++ b/debian/patches/0004-spec_helper-don-t-use-bundle-exec.patch
@@ -0,0 +1,46 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Wed, 4 Feb 2015 11:31:10 -0200
+Subject: spec_helper: don't use bundle exec
+
+This patch is mostl probably Debian-specific
+---
+ spec/spec_helper.rb | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -1,6 +1,3 @@
+-require "codeclimate-test-reporter"
+-CodeClimate::TestReporter.start
+-
+ require "simplecov"
+ SimpleCov.start do
+ add_filter "/spec/"
+@@ -12,6 +9,9 @@ require "fakefs/safe"
+ require "fakefs/spec_helpers"
+
+ $:.unshift File.expand_path("../../lib", __FILE__)
++unless ENV['ADTTMP']
++ ENV['PATH'] = 'bin:' + ENV['PATH']
++end
+
+ def mock_export_error(message)
+ expect { yield }.to raise_error(Foreman::Export::Exception, message)
+@@ -39,7 +39,7 @@ end
+
+ def forked_foreman(args)
+ rd, wr = make_pipe
+- Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
++ Process.spawn("foreman #{args}", :out => wr, :err => wr)
+ wr.close
+ rd.read
+ end
+@@ -64,7 +64,7 @@ def fork_and_capture(&blk)
+ end
+
+ def fork_and_get_exitstatus(args)
+- pid = Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
++ pid = Process.spawn("foreman #{args}", :out => "/dev/null", :err => "/dev/null")
+ Process.wait(pid)
+ $?.exitstatus
+ end
diff --git a/debian/patches/series b/debian/patches/series
index c676454..2b72c5d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,3 @@
-0001-Remove-taskman-script.patch
-0002-Don-t-use-bundler-when-running-tests.patch
-0003-Don-t-use-simplecov-when-running-tests.patch
+0001-Look-for-data-in-usr-share-foreman.patch
+0003-Port-tests-to-fakefs-0.4.patch
+0004-spec_helper-don-t-use-bundle-exec.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-foreman.git
More information about the Pkg-ruby-extras-commits
mailing list