[vagrant] Make vagrant non-rubygem package.

Vít Ondruch vondruch at fedoraproject.org
Wed Jan 21 13:36:26 UTC 2015


commit 94e6c8570d9b3e0735fa804a7b821f0e618286f4
Author: Vít Ondruch <vondruch at redhat.com>
Date:   Thu Oct 23 14:28:47 2014 +0200

    Make vagrant non-rubygem package.

 ...5.patch => vagrant-1.6.5-fix-dependencies.patch |   13 ++
 vagrant.spec                                       |  142 +++++--------------
 2 files changed, 51 insertions(+), 104 deletions(-)
---
diff --git a/vagrant-1.6.5.patch b/vagrant-1.6.5-fix-dependencies.patch
similarity index 87%
rename from vagrant-1.6.5.patch
rename to vagrant-1.6.5-fix-dependencies.patch
index 9d868bc..16c5489 100644
--- a/vagrant-1.6.5.patch
+++ b/vagrant-1.6.5-fix-dependencies.patch
@@ -1,3 +1,16 @@
+diff --git a/bin/vagrant b/bin/vagrant
+index 21630e1..4fc6b96 100755
+--- a/bin/vagrant
++++ b/bin/vagrant
+@@ -15,7 +15,7 @@ end
+ 
+ # Fast path the version of Vagrant
+ if argv.include?("-v") || argv.include?("--version")
+-  require "vagrant/version"
++  require_relative "../lib/vagrant/version"
+   puts "Vagrant #{Vagrant::VERSION}"
+   exit 0
+ end
 diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb
 index 05867da..ea8c056 100644
 --- a/lib/vagrant/bundler.rb
diff --git a/vagrant.spec b/vagrant.spec
index 7c14b83..f0e10cc 100644
--- a/vagrant.spec
+++ b/vagrant.spec
@@ -1,51 +1,26 @@
-%global gem_name vagrant
+%global bashcompletion_dir %(pkg-config --variable=completionsdir bash-completion 2> /dev/null || :)
+%global vagrant_dir %{_datadir}/%{name}
+%global vagrant_plugin_dir %{_sharedstatedir}/%{name}
 
-# Do not use auto-requires
-%global __requires_exclude_from %{gem_spec}
-
-Name: %{gem_name}
+Name: vagrant
 Version: 1.6.5
-Release: 10%{?dist}
+Release: 11%{?dist}
 Summary: Build and distribute virtualized development environments
 Group: Development/Languages
 License: MIT
 URL: http://vagrantup.com
-
-# Get the upstream sources:
-#   git clone https://github.com/mitchellh/vagrant.git
-#   git checkout v1.6.5
-#   gem build vagrant.gemspec
-Source0: https://github.com/mitchellh/%{gem_name}/archive/v%{version}/%{gem_name}-%{version}.tar.gz
+Source0: https://github.com/mitchellh/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
 
 # Upstream binstub with adjusted paths, the offical way how to run vagrant
 Source1: binstub
 
-# Upstream bash completion
-# https://raw.githubusercontent.com/mitchellh/vagrant/v1.6.5/contrib/bash/completion.sh
-Source3: completion.sh
-
-# Registration/unregistration of RPM-packaged or RubyGems-installed Vagrant plugins
-Source4: register.rb
-Source5: unregister.rb
-Source6: register_plugin.rb
-Source7: unregister_plugin.rb
-
-# Enable to (un)register RPM/RubyGems-installed plugins
-Patch0: 0001-Introduce-global-state.patch
-
-# Match dependencies we need
-#Patch1: 0001-Relax-dependencies.patch
-Patch1: vagrant-1.6.5-fix-dependencies.patch
-
-# English locales for registration of system-installed plugins
-Patch2: vagrant-1.6.5-locales.patch
-
-Patch100: vagrant-1.6.5.patch
+Patch0: vagrant-1.6.5-fix-dependencies.patch
 
 Requires: ruby(release)
 Requires: ruby(rubygems) >= 1.3.6
+# Vagrant does not work with JRuby ATM.
+Requires: ruby
 Requires: rubygem(bundler) >= 1.5.2
-#Requires: rubygem(json_pure)
 Requires: rubygem(hashicorp-checkpoint) >= 0.1.1
 Requires: rubygem(childprocess) >= 0.5.0
 Requires: rubygem(erubis) >= 2.7.0
@@ -54,7 +29,7 @@ Requires: rubygem(listen) >= 2.7.1
 Requires: rubygem(log4r)
 Requires: rubygem(net-ssh) >= 2.6.6
 Requires: rubygem(net-scp) >= 1.1.0
-#Requires: bsdtar
+Requires: bsdtar
 #Requires: curl
 #Requires: libffi
 #Requires: libxml2
@@ -78,7 +53,6 @@ Requires: rubygem(nokogiri) >= 1.6
 #Requires: rubygem(ffi) = 1.9.3
 #Requires: polkit-pkla-compat
 #Requires(pre): shadow-utils
-BuildRequires: rubygems-devel >= 1.3.6
 
 # For tests
 #BuildRequires: rubygem(listen) >= 2.7.1
@@ -96,8 +70,8 @@ BuildRequires: rubygems-devel >= 1.3.6
 #BuildRequires: rubygem(bundler)
 #BuildRequires: ruby-devel
 #BuildRequires: git
+BuildRequires: pkgconfig(bash-completion)
 BuildArch: noarch
-Provides: rubygem(%{gem_name}) = %{version}
 
 %description
 Vagrant is a tool for building and distributing virtualized development
@@ -116,81 +90,42 @@ Documentation for %{name}.
 %prep
 %setup -q
 
-%patch100 -p1
-
-#gem unpack %{SOURCE0}
-#
-#%setup -q -D -T -n  %{gem_name}-%{version}
-#
-#gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
+%patch0 -p1
 
-#%patch0 -p1
-#%patch1 -p1
-#%patch2 -p1
-#
-#sed -i '/dependency/ d' %{gem_name}.gemspec
+#sed -i '/dependency/ d' %{name}.gemspec
 
 # Add missing dependencies
 # These needs to be part of .gemspec so Bundler works as expected
-#sed -i -e "72i s\.add_dependency(\%q<json>)" %{gem_name}.gemspec
-#sed -i -e "72i s\.add_dependency(\%q<json_pure>)" %{gem_name}.gemspec
-
-#%%patch0 -p1
-#%%patch1 -p1
-#%%patch2 -p1
-#%%patch3 -p1
+#sed -i -e "72i s\.add_dependency(\%q<json>)" %{name}.gemspec
+#sed -i -e "72i s\.add_dependency(\%q<json_pure>)" %{name}.gemspec
 
 %build
 
 %install
-mkdir -p %{buildroot}%{_datadir}/%{gem_name}
+mkdir -p %{buildroot}%{vagrant_dir}
 cp -pa ./* \
-        %{buildroot}%{_datadir}/%{gem_name}/
-
+        %{buildroot}%{vagrant_dir}/
 
-find %{buildroot}%{_datadir}/%{gem_name}/bin -type f | xargs chmod a+x
 
-# The .gemspec search for .gitignore. May be the .gemspec should be adjusted.
-touch %{buildroot}%{_datadir}/%{gem_name}/.gitignore
+find %{buildroot}%{vagrant_dir}/bin -type f | xargs chmod a+x
 
+# TODO: The .gemspec search for .gitignore. May be the .gemspec should be adjusted.
+touch %{buildroot}%{vagrant_dir}/.gitignore
 
-        # gemfile.puts(%Q[gemspec :path => "#{File.expand_path '../../..', __FILE__}"])
-        # gemfile.puts(%Q[gem "vagrant", "= #{VERSION}"])
-
-
-# We need to change the bin stub generated by RubyGems to
-# something upstream uses for their package
-mkdir -p %{buildroot}%{_bindir}
-cat %{SOURCE1} > %{buildroot}%{_bindir}/vagrant
-chmod a+x %{buildroot}%{_bindir}/vagrant
-#mkdir -p %{buildroot}/etc/pki/tls
-#cat %{SOURCE2} > %{buildroot}/etc/pki/tls/vagrant-cacert.pem
-
-# Add missing dependencies
-# These needs to be part of .gemspec so Bundler works as expected
-#sed -i -e "72i s\.add_dependency(\%q<json>)" %{buildroot}%{gem_spec}
-#sed -i -e "72i s\.add_dependency(\%q<json_pure>)" %{buildroot}%{gem_spec}
-#sed -i -e "72i s\.add_dependency(\%q<net-http-persistent>)" %{buildroot}%{gem_spec}
-
+# Provide executable similar to upstream:
+# https://github.com/mitchellh/vagrant-installers/blob/master/substrate/modules/vagrant_installer/templates/vagrant.erb
+install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/vagrant
+sed -i 's|@vagrant_dir@|%{vagrant_dir}|' %{buildroot}%{_bindir}/vagrant
+sed -i 's|@vagrant_plugin_dir@|%{vagrant_plugin_dir}|' %{buildroot}%{_bindir}/vagrant
 
 # auto-completion
-install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/profile.d/vagrant.sh
+install -D -m 0644 %{buildroot}%{vagrant_dir}/contrib/bash/completion.sh \
+  %{buildroot}%{bashcompletion_dir}/%{name}
 
 # create the global home dir
-install -d -m 755 %{buildroot}/etc/vagrant
-echo "{}" > %{buildroot}/etc/vagrant/plugins.json
-
-# hot fix: BundlerUI is Bundler::UI
-#sed -i -e "s|BundlerUI|Bundler::UI|" %{buildroot}%{gem_instdir}/lib/vagrant/bundler.rb
-#sed -i -e "237s|Bundler::UI|::Bundler::UI|" %{buildroot}%{gem_instdir}/lib/vagrant/bundler.rb
-#sed -i -e "243,245d" %{buildroot}%{gem_instdir}/lib/vagrant/bundler.rb
-#
-## add global plugin registering commands
-#install -m 644 %{SOURCE4} %{buildroot}%{gem_instdir}/plugins/commands/plugin/command/
-#install -m 644 %{SOURCE5} %{buildroot}%{gem_instdir}/plugins/commands/plugin/command/
-#install -m 644 %{SOURCE6} %{buildroot}%{gem_instdir}/plugins/commands/plugin/action/
-#install -m 644 %{SOURCE7} %{buildroot}%{gem_instdir}/plugins/commands/plugin/action/
-#
+install -d -m 755 %{buildroot}%{_sharedstatedir}/%{name}
+#echo "{}" > %{buildroot}%{_sharedstatedir}/%{name}/plugins.json
+
 ## Fix getting the SSL cert path for the downloader
 #sed -i -e "s/downloader_options\[:ca_cert\] = env\[:box_download_ca_cert\]/downloader_options\[:ca_cert\] = (env\[:box_download_ca_cert\] || ENV\['SSL_CERT_FILE'\])/" %{buildroot}%{gem_instdir}/lib/vagrant/action/builtin/box_add.rb
 
@@ -220,20 +155,19 @@ echo "{}" > %{buildroot}/etc/vagrant/plugins.json
 %pre
 getent group vagrant >/dev/null || groupadd -r vagrant
  
-%post
-#vagrant plugin register vagrant-libvirt >/dev/null || :
-
 %files
-%{_datadir}/%{gem_name}
-%dir %{_sysconfdir}/vagrant 
-%{_bindir}/vagrant
-%config %{_sysconfdir}/profile.d/vagrant.sh
-# RPM/RubyGems-installed plugin registry
-%{_sysconfdir}/vagrant/plugins.json
+%{_datadir}/%{name}
+%{_bindir}/%{name}
+%{bashcompletion_dir}/%{name}
+%dir %{_sharedstatedir}/%{name}
+%ghost %{_sharedstatedir}/%{name}/plugins.json
 
 %files doc
 
 %changelog
+* Wed Oct 22 2014 Vít Ondruch <vondruch at redhat.com> - 1.6.5-11
+- Make vagrant non-rubygem package.
+
 * Tue Oct 14 2014 Josef Stribny <jstribny at redhat.com> - 1.6.5-10
 - rebuilt
 


More information about the scm-commits mailing list