Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/vagrant/files/, app-emulation/vagrant/
Date: Thu, 23 Jun 2016 21:53:08
Message-Id: 1466716682.a48f6b99381ac753738bec83430df4f96267c25b.monsieurp@gentoo
1 commit: a48f6b99381ac753738bec83430df4f96267c25b
2 Author: Tomas Mozes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Thu Jun 23 10:29:14 2016 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 23 21:18:02 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a48f6b99
7
8 app-emulation/vagrant: version bump to 1.8.4
9
10 Package-Manager: portage-2.3.0_rc1
11 Closes: https://github.com/gentoo/gentoo/pull/1728
12
13 Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>
14
15 app-emulation/vagrant/Manifest | 1 +
16 app-emulation/vagrant/files/vagrant-1.8.4 | 46 +++++++++
17 ...agrant-1.8.4-install-plugins-in-isolation.patch | 114 +++++++++++++++++++++
18 app-emulation/vagrant/vagrant-1.8.4.ebuild | 87 ++++++++++++++++
19 4 files changed, 248 insertions(+)
20
21 diff --git a/app-emulation/vagrant/Manifest b/app-emulation/vagrant/Manifest
22 index 24578f1..c72fb6d 100644
23 --- a/app-emulation/vagrant/Manifest
24 +++ b/app-emulation/vagrant/Manifest
25 @@ -1 +1,2 @@
26 DIST vagrant-1.8.1.tar.gz 2873082 SHA256 12cfa43eb82399d3dd1c3fd24691797fa30187fc142474580c72e5c9f83b9dfd SHA512 efbb74e26b4678075b1cbcc1a8e0bdef929f8c7de186dec1931a5cd52f944a046992491681573283c6cab7e48bf25fce86b0da96df17063d2398b69401fa0f08 WHIRLPOOL 237cbec487f820f00c8bd5b57c44c2f2ffd3b716988f64265124c52e3fe1ef696f93a5e61004ee7c57531bfb1765c47d56c53b61880c761ddf5efc5b6545c261
27 +DIST vagrant-1.8.4.tar.gz 1736344 SHA256 a5ded3bc343ac1f30e09decab0c844639de45b16578600bdc4a0cdfe73b4d223 SHA512 0465a2e9eea87d5e7a13666dad32b8d4bc0bcd3ebcd0a752ad330e6e2aaeeeaab37e139f1de6bad859b1e8088a7ad9e12f395b95e679e6babf86c38a470d8568 WHIRLPOOL 35124df7062c70a80bf77a73bc6b4d551a8a965dd3a75181510ebc78c985432ea9517c9d8573eea60534aff827d4ddf983bfc355ed9f8bcc799dd9773c2b89e9
28
29 diff --git a/app-emulation/vagrant/files/vagrant-1.8.4 b/app-emulation/vagrant/files/vagrant-1.8.4
30 new file mode 100644
31 index 0000000..7306d3b
32 --- /dev/null
33 +++ b/app-emulation/vagrant/files/vagrant-1.8.4
34 @@ -0,0 +1,46 @@
35 +#!/usr/bin/env bash
36 +#
37 +# This is a wrapper to properly execute Vagrant within the embedded
38 +# Vagrant installation directory. This sets up proper environmental variables
39 +# so that everything loads and compiles to proper directories.
40 +
41 +VAGRANT_DIR="$( ruby -e 'print Gem::default_path[-1] + "/gems/vagrant-1.8.4"' )"
42 +
43 +# Export GEM_HOME based on VAGRANT_HOME
44 +#
45 +# This needs to be set because Bundler includes gem paths
46 +# from RubyGems' Gem.paths.
47 +if [ -z $VAGRANT_HOME ]; then
48 + VAGRANT_HOME=$(eval echo "~/.vagrant.d")
49 +fi
50 +export GEM_HOME="$VAGRANT_HOME/gems"
51 +
52 +# SSL certs
53 +export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
54 +
55 +# Export an environmental variable to say we're in a Vagrant
56 +# installer created environment.
57 +export VAGRANT_INSTALLER_ENV=1
58 +
59 +# This is currently used only in Vagrant::Plugin::Manager.system_plugins_file
60 +# to locate plugins configuration file.
61 +export VAGRANT_INSTALLER_EMBEDDED_DIR="/var/lib/vagrant"
62 +export VAGRANT_INSTALLER_VERSION="2"
63 +
64 +# Determine the OS that we're on, which is used in some later checks.
65 +# It is very important we do this _before_ setting the PATH below
66 +# because uname dependencies can conflict on some platforms.
67 +OS=$(uname -s 2>/dev/null)
68 +
69 +# Export the OS as an environmental variable that Vagrant can access
70 +# so that it can behave better.
71 +export VAGRANT_DETECTED_OS="${OS}"
72 +
73 +VAGRANT_EXECUTABLE="${VAGRANT_DIR}/bin/vagrant"
74 +VAGRANT_LAUNCHER="${VAGRANT_DIR}/lib/vagrant/pre-rubygems.rb"
75 +
76 +# Export the VAGRANT_EXECUTABLE so that pre-rubygems can optimize a bit
77 +export VAGRANT_EXECUTABLE
78 +
79 +# Call the actual Vagrant bin with our arguments
80 +exec ruby "${VAGRANT_LAUNCHER}" "$@"
81
82 diff --git a/app-emulation/vagrant/files/vagrant-1.8.4-install-plugins-in-isolation.patch b/app-emulation/vagrant/files/vagrant-1.8.4-install-plugins-in-isolation.patch
83 new file mode 100644
84 index 0000000..7673073
85 --- /dev/null
86 +++ b/app-emulation/vagrant/files/vagrant-1.8.4-install-plugins-in-isolation.patch
87 @@ -0,0 +1,114 @@
88 +--- bin/vagrant
89 ++++ bin/vagrant
90 +@@ -69,6 +69,11 @@
91 + require "bundler"
92 + begin
93 + $vagrant_bundler_runtime = Bundler.setup(:default, :plugins)
94 ++# Invalidate the cached Gemfile.lock if necessary and try again
95 ++rescue Bundler::GemNotFound
96 ++ FileUtils.rm File.expand_path("~/.vagrant.d/Gemfile") if File.exists? File.expand_path("~/.vagrant.d/Gemfile")
97 ++ FileUtils.rm File.expand_path("~/.vagrant.d/Gemfile.lock") if File.exists? File.expand_path("~/.vagrant.d/Gemfile.lock")
98 ++ $vagrant_bundler_runtime = Bundler.setup(:default, :plugins)
99 + rescue Bundler::GemNotFound
100 + $stderr.puts "Bundler, the underlying system used to manage Vagrant plugins,"
101 + $stderr.puts "is reporting that a plugin or its dependency can't be found."
102 +--- lib/vagrant/bundler.rb 2016-06-13 10:21:40.000000000 +0200
103 ++++ lib/vagrant/bundler.rb 2016-06-23 08:19:22.466039136 +0200
104 +@@ -65,6 +65,13 @@
105 + @configfile = tempfile("vagrant-configfile")
106 + @configfile.close
107 +
108 ++ # Ensure the path to user's Gemfile exists
109 ++ gemfile = Vagrant.user_data_path.join("Gemfile")
110 ++ unless File.exists? gemfile
111 ++ FileUtils.mkdir_p(File.dirname(gemfile))
112 ++ File.open(gemfile, 'w') {}
113 ++ end
114 ++
115 + # Build up the Gemfile for our Bundler context. We make sure to
116 + # lock Vagrant to our current Vagrant version. In addition to that,
117 + # we add all our plugin dependencies.
118 +@@ -151,7 +158,7 @@
119 +
120 + # Clean removes any unused gems.
121 + def clean(plugins)
122 +- gemfile = build_gemfile(plugins)
123 ++ gemfile = build_gemfile(plugins, false, true)
124 + lockfile = "#{gemfile.path}.lock"
125 + definition = ::Bundler::Definition.build(gemfile, lockfile, nil)
126 + root = File.dirname(gemfile.path)
127 +@@ -182,11 +189,23 @@
128 + # Builds a valid Gemfile for use with Bundler given the list of
129 + # plugins.
130 + #
131 ++ # @param [Hash|Bool] update Hash of gems to update or true for all
132 ++ # @param [Bool] invalidate Invalidate Gemfile.lock
133 + # @return [Tempfile]
134 +- def build_gemfile(plugins)
135 ++ def build_gemfile(plugins, update = false, invalidate = false)
136 + sources = plugins.values.map { |p| p["sources"] }.flatten.compact.uniq
137 +
138 +- f = tempfile("vagrant-gemfile")
139 ++ # Determine what gems to update
140 ++ if update.is_a? Hash
141 ++ update_gems = update[:gems]
142 ++ elsif update === true
143 ++ update_gems = plugins.map{ |p| p[0] }
144 ++ else
145 ++ update_gems = []
146 ++ end
147 ++
148 ++ gemfile = Vagrant.user_data_path.join("Gemfile")
149 ++ f = File.open(gemfile, "w+")
150 + f.tap do |gemfile|
151 + sources.each do |source|
152 + next if source == ""
153 +@@ -195,6 +214,19 @@
154 +
155 + gemfile.puts(%Q[gem "vagrant", "= #{VERSION}"])
156 +
157 ++ locked_gems = []
158 ++
159 ++ # Use Gemfile.lock to lock the gem versions
160 ++ if ENV["VAGRANT_INTERNAL_BUNDLERIZED"] && File.exist?("#{gemfile.path}.lock") && !invalidate
161 ++ lockfile = ::Bundler::LockfileParser.new(::Bundler.read_file("#{gemfile.path}.lock"))
162 ++ lockfile.specs.each do |s|
163 ++ if s.name != 'vagrant' && !(update_gems.include? s.name)
164 ++ gemfile.puts(%Q[gem "#{s.name}", "#{s.version.to_s}"])
165 ++ end
166 ++ end
167 ++ locked_gems = lockfile.specs.map(&:name) - update_gems
168 ++ end
169 ++
170 + gemfile.puts("group :plugins do")
171 + plugins.each do |name, plugin|
172 + version = plugin["gem_version"]
173 +@@ -205,10 +237,18 @@
174 + opts[:require] = plugin["require"]
175 + end
176 +
177 +- gemfile.puts(%Q[gem "#{name}", #{version.inspect}, #{opts.inspect}])
178 ++ gemfile.puts(%Q[gem "#{name}", #{version.inspect}, #{opts.inspect}]) unless locked_gems.include? name
179 + end
180 + gemfile.puts("end")
181 + gemfile.close
182 ++
183 ++ # Create Gemfile.lock if missing and re-generate Gemfile
184 ++ if !File.exist?("#{f.path}.lock") && File.exist?(f.path)
185 ++ lockfile = "#{f.path}.lock"
186 ++ ENV['BUNDLE_GEMFILE'] = f.path
187 ++ definition = ::Bundler::Definition.build(f.path, lockfile, false)
188 ++ end
189 ++ f
190 + end
191 + end
192 +
193 +@@ -219,7 +259,7 @@
194 + # can be a hash of options. See Bundler.definition.
195 + # @return [Array<Gem::Specification>]
196 + def internal_install(plugins, update, **extra)
197 +- gemfile = build_gemfile(plugins)
198 ++ gemfile = build_gemfile(plugins, update)
199 + lockfile = "#{gemfile.path}.lock"
200 + definition = ::Bundler::Definition.build(gemfile, lockfile, update)
201 + root = File.dirname(gemfile.path)
202
203 diff --git a/app-emulation/vagrant/vagrant-1.8.4.ebuild b/app-emulation/vagrant/vagrant-1.8.4.ebuild
204 new file mode 100644
205 index 0000000..dc0b196
206 --- /dev/null
207 +++ b/app-emulation/vagrant/vagrant-1.8.4.ebuild
208 @@ -0,0 +1,87 @@
209 +# Copyright 1999-2016 Gentoo Foundation
210 +# Distributed under the terms of the GNU General Public License v2
211 +# $Id$
212 +
213 +EAPI="5"
214 +USE_RUBY="ruby20 ruby21"
215 +
216 +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.md"
217 +RUBY_FAKEGEM_GEMSPEC="vagrant.gemspec"
218 +RUBY_FAKEGEM_EXTRAINSTALL="keys plugins templates version.txt"
219 +RUBY_FAKEGEM_TASK_DOC=""
220 +
221 +inherit bash-completion-r1 ruby-fakegem eutils
222 +
223 +DESCRIPTION="A tool for building and distributing development environments"
224 +HOMEPAGE="http://vagrantup.com/"
225 +SRC_URI="https://github.com/mitchellh/vagrant/archive/v${PV}.tar.gz -> ${P}.tar.gz"
226 +
227 +LICENSE="MIT"
228 +SLOT="0"
229 +KEYWORDS="~amd64 ~x86"
230 +IUSE="+virtualbox"
231 +
232 +RDEPEND="${RDEPEND}
233 + app-arch/libarchive
234 + net-misc/curl
235 + virtualbox? ( || ( app-emulation/virtualbox app-emulation/virtualbox-bin ) )"
236 +
237 +ruby_add_rdepend "
238 + >=dev-ruby/bundler-1.12.5
239 + >=dev-ruby/childprocess-0.5.0
240 + >=dev-ruby/erubis-2.7.0
241 + >=dev-ruby/i18n-0.6.0:* <dev-ruby/i18n-0.8.0:*
242 + >=dev-ruby/listen-3.0.2
243 + >=dev-ruby/hashicorp-checkpoint-0.1.1
244 + >=dev-ruby/log4r-1.1.9 <dev-ruby/log4r-1.1.11
245 + >=dev-ruby/net-ssh-3.0.1
246 + >=dev-ruby/net-sftp-2.1
247 + >=dev-ruby/net-scp-1.1.0
248 + >=dev-ruby/rest-client-1.6.0 <dev-ruby/rest-client-2.0
249 + >=dev-ruby/nokogiri-1.6.7.1
250 + >=dev-ruby/mime-types-2.6.2:* <dev-ruby/mime-types-3:*
251 +"
252 +
253 +ruby_add_bdepend "
254 + dev-ruby/rake
255 +"
256 +
257 +all_ruby_prepare() {
258 + # remove bundler support
259 + sed -i '/[Bb]undler/d' Rakefile || die
260 + rm Gemfile || die
261 +
262 + # loosen dependencies
263 + sed -e '/hashicorp-checkpoint\|listen\|net-ssh\|net-scp/s/~>/>=/' \
264 + -e '/nokogiri\|bundler/s/=/>=/' \
265 + -i ${PN}.gemspec || die
266 +
267 + # remove windows-specific gems
268 + sed -e '/wdm\|winrm/d' \
269 + -i ${PN}.gemspec || die
270 +
271 + # remove bsd-specific gems
272 + sed -e '/rb-kqueue/d' \
273 + -i ${PN}.gemspec || die
274 +
275 + # see https://github.com/mitchellh/vagrant/pull/5877
276 + epatch "${FILESDIR}"/${P}-install-plugins-in-isolation.patch
277 +
278 + # disable embedded CA certs and use system ones
279 + epatch "${FILESDIR}"/${PN}-1.8.1-disable-embedded-cacert.patch
280 +
281 + # fix rvm issue (bug #474476)
282 + epatch "${FILESDIR}"/${PN}-1.8.1-rvm.patch
283 +}
284 +
285 +all_ruby_install() {
286 + newbashcomp contrib/bash/completion.sh ${PN}
287 + all_fakegem_install
288 +
289 + # provide executable similar to upstream:
290 + # https://github.com/mitchellh/vagrant-installers/blob/master/substrate/modules/vagrant_installer/templates/vagrant.erb
291 + newbin "${FILESDIR}/${P}" "${PN}"
292 +
293 + # directory for plugins.json
294 + dodir /var/lib/vagrant
295 +}