added patch 0007-Support-system-installed-plugins.patch, removed patch 0008-Read-data-from-usr-share-vagrant.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization:vagrant/vagrant?expand=0&rev=15
This commit is contained in:
Johannes Kastl 2018-07-09 19:03:43 +00:00 committed by Git OBS Bridge
parent 40dbb8af41
commit 57899b4da6
4 changed files with 109 additions and 38 deletions

View File

@ -0,0 +1,98 @@
From 176ae85a2d5ac3f7ce0c3b9436eec8c8285275b7 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Wed, 27 May 2015 09:36:17 -0300
Subject: [PATCH] Support system-installed plugins
Plugins must be installed as regular Ruby libraries, and they must
contain /usr/share/vagrant-plugins/plugins.d/$PLUGINNAME.json with the
following content:
{
"${PLUGINNAME}": {
"ruby_version":"$(ruby -e 'puts RUBY_VERSION')",
"vagrant_version":"$(cat /usr/share/vagrant/version.txt)",
"gem_version":"",
"require":"",
"sources":[]
}
}
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---
lib/vagrant/plugin/manager.rb | 4 ++--
lib/vagrant/plugin/state_file.rb | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/lib/vagrant/plugin/manager.rb b/lib/vagrant/plugin/manager.rb
index 64891bd37..0ff370d3f 100644
--- a/lib/vagrant/plugin/manager.rb
+++ b/lib/vagrant/plugin/manager.rb
@@ -18,7 +18,7 @@ module Vagrant
# Returns the path to the [StateFile] for system plugins.
def self.system_plugins_file
- dir = Vagrant.installer_embedded_dir
+ dir = '/usr/share/vagrant-plugins'
return nil if !dir
Pathname.new(dir).join("plugins.json")
end
@@ -33,7 +33,7 @@ module Vagrant
system_path = self.class.system_plugins_file
@system_file = nil
- @system_file = StateFile.new(system_path) if system_path && system_path.file?
+ @system_file = StateFile.new(system_path, true) if system_path && system_path.file?
end
# Installs another plugin into our gem directory.
diff --git a/lib/vagrant/plugin/state_file.rb b/lib/vagrant/plugin/state_file.rb
index 85db50b92..9e12591e3 100644
--- a/lib/vagrant/plugin/state_file.rb
+++ b/lib/vagrant/plugin/state_file.rb
@@ -7,8 +7,9 @@ module Vagrant
# This is a helper to deal with the plugin state file that Vagrant
# uses to track what plugins are installed and activated and such.
class StateFile
- def initialize(path)
+ def initialize(path, system = false)
@path = path
+ @system = system
@data = {}
if @path.exist?
@@ -24,6 +25,21 @@ module Vagrant
@data["version"] ||= "1"
@data["installed"] ||= {}
+ load_extra_plugins
+ end
+
+ def load_extra_plugins
+ extra_plugins = Dir.glob(@path.dirname.join('plugins.d', '*.json'))
+ extra_plugins.each do |filename|
+ json = File.read(filename)
+ begin
+ plugin_data = JSON.parse(json)
+ @data["installed"].merge!(plugin_data)
+ rescue JSON::ParserError => e
+ raise Vagrant::Errors::PluginStateFileParseError,
+ path: filename, message: e.message
+ end
+ end
end
# Add a plugin that is installed to the state file.
@@ -102,6 +118,10 @@ module Vagrant
f.close
FileUtils.mv(f.path, @path)
end
+ rescue Errno::EACCES
+ # Ignore permission denied against system-installed plugins; regular
+ # users are not supposed to write there.
+ raise unless @system
end
protected
--
2.18.0

View File

@ -1,36 +0,0 @@
From 3597147739d63a6ed9006ab461bcb92afc8f834f Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Sat, 11 Oct 2014 16:55:21 -0300
Subject: [PATCH] Read data from /usr/share/vagrant
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---
lib/vagrant/shared_helpers.rb | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/vagrant/shared_helpers.rb b/lib/vagrant/shared_helpers.rb
index 5522272d3..305d73db1 100644
--- a/lib/vagrant/shared_helpers.rb
+++ b/lib/vagrant/shared_helpers.rb
@@ -85,7 +85,17 @@ module Vagrant
#
# @return [Pathname]
def self.source_root
- @source_root ||= Pathname.new(File.expand_path('../../../', __FILE__))
+ @source_root ||=
+ begin
+ source = Pathname.new(File.expand_path('../../../', __FILE__))
+ if source.join('debian/control').exist?
+ # working inside source package
+ source
+ else
+ # installed
+ Pathname.new('/usr/share/vagrant')
+ end
+ end
end
# This returns the path to the ~/.vagrant.d folder where Vagrant's
--
2.13.0

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jul 9 19:02:32 UTC 2018 - opensuse_buildservice@ojkastl.de
- added patch 0007-Support-system-installed-plugins.patch, removed patch 0008-Read-data-from-usr-share-vagrant.patch
patch has been ported from Debians package for 2.0.2
https://packages.debian.org/sid/vagrant
-------------------------------------------------------------------
Sun Jul 8 19:38:30 UTC 2018 - opensuse_buildservice@ojkastl.de

View File

@ -42,7 +42,8 @@ Recommends: vagrant-libvirt
Patch2: 0002-bin-vagrant-silence-warning-about-installer.patch
Patch3: 0003-Use-a-private-temporary-dir.patch
Patch4: 0004-linux-cap-halt-don-t-wait-for-shutdown-h-now-to-fini.patch
Patch8: 0008-Read-data-from-usr-share-vagrant.patch
Patch7: 0007-Support-system-installed-plugins.patch
#Patch8: 0008-Read-data-from-usr-share-vagrant.patch
Patch9: 0009-plugins-don-t-abuse-require_relative.patch
#
#
@ -186,7 +187,8 @@ Optional dependency offering bash completion for vagrant
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch8 -p1
%patch7 -p1
#%patch8 -p1
%patch9 -p1
#
#