Package: vagrant
Version: 1.4.3-1.1
Severity: wishlist
Tags: patch

Hello,

The attached patch adds support for Debian-provided plugins, with the
contents of a gem installed to /usr/share/vagrant-plugins/. I have
tested this with vagrant-lxc¹ and it works fine for me.

¹ http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/vagrant-lxc.git

All a plugin has to do is install itself as a gem to
/usr/share/vagrant-plugins. For reference, here is the entire
debian/rules for vagrant-lxc:

----------------8<----------------8<----------------8<-----------------
#!/usr/bin/make -f

%:
  dh $@

version = $(shell dpkg-parsechangelog -SVersion | cut -d - -f 1)

gem = vagrant-lxc-$(version).gem
gemspec = $(gem)spec
plugindir = debian/vagrant-lxc/usr/share/vagrant-plugins

override_dh_auto_install:
  gem build $(gemspec)
  gem install -i $(plugindir) $(gem)
  $(RM) $(plugindir)/cache/*
  dh_auto_install

override_dh_auto_clean:
  $(RM) $(gem)
----------------8<----------------8<----------------8<-----------------

We can even turn this into a dh-vagrant-plugin at some point if we see a
demand for several other plugins.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages vagrant depends on:
ii  bsdtar             3.1.2-8
ii  curl               7.35.0-1
ii  openssh-client     1:6.5p1-4
ii  ruby-childprocess  0.3.9-2
ii  ruby-erubis        2.7.0-2
ii  ruby-i18n          0.6.9-1
ii  ruby-log4r         1.1.10-3
ii  ruby-net-scp       1.1.1-1
ii  ruby-net-ssh       1:2.6.8-1
ii  ruby1.9.1          1.9.3.484-2

vagrant recommends no packages.

Versions of packages vagrant suggests:
ii  virtualbox  4.3.6-dfsg-2

-- no debconf information

-- 
Antonio Terceiro <[email protected]>
diff -Nru vagrant-1.4.3/debian/changelog vagrant-1.4.3/debian/changelog
--- vagrant-1.4.3/debian/changelog	2014-01-22 20:26:57.000000000 -0300
+++ vagrant-1.4.3/debian/changelog	2014-02-26 10:34:25.000000000 -0300
@@ -1,3 +1,11 @@
+vagrant (1.4.3-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/patches/03_debian_plugins.patch: support for Debian-provided
+    plugins
+
+ -- Antonio Terceiro <[email protected]>  Wed, 26 Feb 2014 10:33:58 -0300
+
 vagrant (1.4.3-1) unstable; urgency=low
 
   [ Sebastien Badia ]
diff -Nru vagrant-1.4.3/debian/patches/03_debian_plugins.patch vagrant-1.4.3/debian/patches/03_debian_plugins.patch
--- vagrant-1.4.3/debian/patches/03_debian_plugins.patch	1969-12-31 21:00:00.000000000 -0300
+++ vagrant-1.4.3/debian/patches/03_debian_plugins.patch	2014-02-26 10:19:21.000000000 -0300
@@ -0,0 +1,33 @@
+--- a/lib/vagrant/environment.rb
++++ b/lib/vagrant/environment.rb
+@@ -110,7 +110,7 @@ module Vagrant
+       setup_home_path
+       @boxes_path = @home_path.join("boxes")
+       @data_dir   = @home_path.join("data")
+-      @gems_path  = @home_path.join("gems")
++      @gems_path  = [@home_path.join("gems"), '/usr/share/vagrant-plugins'].join(::File::PATH_SEPARATOR)
+       @tmp_path   = @home_path.join("tmp")
+ 
+       # Setup the local data directory. If a configuration path is given,
+--- a/plugins/commands/plugin/state_file.rb
++++ b/plugins/commands/plugin/state_file.rb
+@@ -22,6 +22,19 @@ module VagrantPlugins
+ 
+         @data["version"] ||= "1"
+         @data["installed"] ||= {}
++        @data["installed"].merge!(debian_plugins)
++      end
++
++      def debian_plugins
++	spec_pattern = '/usr/share/vagrant-plugins/specifications/*.gemspec'
++        Dir.glob(spec_pattern).inject({}) do |plugins,spec|
++          name = Gem::Specification.load(spec).name
++	  plugins[name] = {
++            "ruby_version" => RUBY_VERSION,
++            "vagrant_version" => ::Vagrant::VERSION,
++          }
++          plugins
++	end
+       end
+ 
+       # Add a plugin that is installed to the state file.
diff -Nru vagrant-1.4.3/debian/patches/series vagrant-1.4.3/debian/patches/series
--- vagrant-1.4.3/debian/patches/series	2014-01-22 20:26:57.000000000 -0300
+++ vagrant-1.4.3/debian/patches/series	2014-02-26 10:17:04.000000000 -0300
@@ -1,2 +1,3 @@
 01_source_root_path.patch
 02_disable_installer_warning.patch
+03_debian_plugins.patch

Attachment: signature.asc
Description: Digital signature

Reply via email to