Package: ruby-libvirt
Version: 0.5.1-3+b1
Severity: important
Tags: patch

Dear Maintainer,

With #795603 solved, we have rubygems integration in Stretch but not in
Jessie. Can we please backport the fix to Jessie? The attached patch
does that.

Cheers!

From e130a5f04e3415991fb5cb44d2388489cb2e8fcb Mon Sep 17 00:00:00 2001
From: anonym <ano...@riseup.net>
Date: Wed, 4 May 2016 11:02:45 +0200
Subject: [PATCH] Add gemspec and autopkg tests

---
 debian/changelog       | 14 ++++++++++++++
 debian/control         |  1 +
 debian/gemspec.rake    |  8 ++++++++
 debian/ruby-tests.rake | 12 ++++++++++++
 debian/rules           | 12 +++++++-----
 debian/tests/control   |  2 ++
 6 files changed, 44 insertions(+), 5 deletions(-)
 create mode 100644 debian/gemspec.rake
 create mode 100644 debian/ruby-tests.rake
 create mode 100644 debian/tests/control

diff --git a/debian/changelog b/debian/changelog
index 6f2a713..23f22e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+ruby-libvirt (0.5.1-4) jessie; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport Antonio Terceiro's fix for #795603 to Jessie:
+    - debian/rules: remove manual test run in favor of gem2deb's own
+      mechanism for running tests, avoiding building the C extension
+      twice on every Debian build.
+      - This also gives us autopkgtest support almost for free; so add
+        `Testsuite: autopkgtest` in debian/control
+    - debian/rules: call debian/gemspec.rake to build a gemspec during
+      the build
+
+ -- anonym <ano...@riseup.net>  Wed, 04 May 2016 10:57:13 +0200
+
 ruby-libvirt (0.5.1-3) unstable; urgency=medium
 
   * [a629df2] Set safer env vars.  We can't expect to have a $HOME and we don'
diff --git a/debian/control b/debian/control
index 6850953..4788b31 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Vcs-Git: git://anonscm.debian.org/git/pkg-libvirt/ruby-libvirt.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-libvirt/ruby-libvirt.git;a=summary
 Homepage: http://libvirt.org/ruby/
 XS-Ruby-Versions: all
+Testsuite: autopkgtest
 
 Package: ruby-libvirt
 Architecture: any
diff --git a/debian/gemspec.rake b/debian/gemspec.rake
new file mode 100644
index 0000000..dc1d957
--- /dev/null
+++ b/debian/gemspec.rake
@@ -0,0 +1,8 @@
+load 'Rakefile'
+
+gemspec = "ruby-libvirt-#{PKG_VERSION}.gemspec"
+
+task :gemspec => gemspec
+file gemspec do |t|
+  File.open(t.name, 'w') { |f| f.write(SPEC.to_ruby) }
+end
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
new file mode 100644
index 0000000..afde7f6
--- /dev/null
+++ b/debian/ruby-tests.rake
@@ -0,0 +1,12 @@
+topdir = File.dirname(File.dirname(__FILE__))
+ENV['XDG_RUNTIME_DIR'] = topdir
+ENV['XDG_CONFIG_HOME'] = topdir
+ENV['LIBVIRT_DEFAULT_URI'] = 'test:///default'
+ENV['RUBY_LIBVIRT_TEST_URI'] = 'test:///default'
+
+require 'gem2deb/rake/testtask'
+Gem2Deb::Rake::TestTask.new do |t|
+  t.test_files = [ 'tests/test_nodedevice.rb',
+                   'tests/test_open.rb',
+                   'tests/test_stream.rb' ]
+end
diff --git a/debian/rules b/debian/rules
index 22f52c6..5a258a8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,8 +4,10 @@
 %:
 	dh $@ --buildsystem=ruby --with ruby
 
-override_dh_auto_test:
-	XDG_RUNTIME_DIR=$(CURDIR) \
-	XDG_CONFIG_HOME=$(CURDIR) \
-	LIBVIRT_DEFAULT_URI=test:///default \
-	RUBY_LIBVIRT_TEST_URI=test:///default rake test
+override_dh_auto_install:
+	rake -f debian/gemspec.rake gemspec
+	dh_auto_install
+
+override_dh_auto_clean:
+	$(RM) *.gemspec
+	dh_auto_clean
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..4e11623
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Test-Command: rake -f debian/gemspec.rake gemspec && gem2deb-test-runner --autopkgtest --check-dependencies 2>&1
+Depends: @, libvirt-dev,pkg-config,rake,libvirt-daemon, gem2deb-test-runner
-- 
2.8.1

Reply via email to