summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2014-11-26 13:14:23 +0100
committerVít Ondruch <vondruch@redhat.com>2015-01-21 12:53:03 +0100
commitc25ecdf5593e4cec28141a134c8519ba727e06f2 (patch)
treebdc3049e879b384b4ee5115d4e1047b2537dba8b
parent6e020089a4e36f67901d00f5493a9c9d3cf3e2e0 (diff)
downloadfedora-vagrant-c25ecdf5593e4cec28141a134c8519ba727e06f2.tar.gz
fedora-vagrant-c25ecdf5593e4cec28141a134c8519ba727e06f2.tar.xz
fedora-vagrant-c25ecdf5593e4cec28141a134c8519ba727e06f2.zip
Split the macros into two files.
The plugin registration part has to be available when plugin is installed.
-rw-r--r--macros.vagrant20
-rw-r--r--macros.vagrant_plugin19
-rw-r--r--vagrant.spec7
3 files changed, 25 insertions, 21 deletions
diff --git a/macros.vagrant b/macros.vagrant
index 0868b11..08df448 100644
--- a/macros.vagrant
+++ b/macros.vagrant
@@ -1,8 +1,3 @@
-%vagrant_dir %{_datadir}/%{name}
-
-%vagrant_plugin_conf_dir %{_sharedstatedir}/%{name}
-%vagrant_plugin_conf %{vagrant_plugin_conf_dir}/plugins.json
-
# Common locations for Vagrant plugin gems
%vagrant_plugin_dir %{vagrant_dir}/gems
%vagrant_plugin_instdir %{vagrant_plugin_dir}/gems/%{vagrant_plugin_name}-%{version}
@@ -30,18 +25,3 @@ gem install \\\
--backtrace \\\
%{-n*}%{!?-n:%{vagrant_plugin_name}-%{version}.gem} \
%{nil}
-
-# Macros to (un)register Vagrant gem
-%vagrant_plugin_register() \
-%{_bindir}/ruby -e ' \\\
-$LOAD_PATH.unshift "%{vagrant_dir}/lib"; \\\
-require "vagrant/plugin/manager"; \\\
-Vagrant::Plugin::StateFile.new(Pathname.new(File.expand_path "%{vagrant_plugin_conf}")).add_plugin "%1";' \
-%{nil}
-
-%vagrant_plugin_unregister() \
-%{_bindir}/ruby -e ' \\\
-$LOAD_PATH.unshift "%{vagrant_dir}/lib"; \\\
-require "vagrant/plugin/manager"; \\\
-Vagrant::Plugin::StateFile.new(Pathname.new(File.expand_path "%{vagrant_plugin_conf}")).remove_plugin "%1";' \
-%{nil}
diff --git a/macros.vagrant_plugin b/macros.vagrant_plugin
new file mode 100644
index 0000000..c72457f
--- /dev/null
+++ b/macros.vagrant_plugin
@@ -0,0 +1,19 @@
+%vagrant_dir %{_datadir}/%{name}
+
+%vagrant_plugin_conf_dir %{_sharedstatedir}/%{name}
+%vagrant_plugin_conf %{vagrant_plugin_conf_dir}/plugins.json
+
+# Macros to (un)register Vagrant gem
+%vagrant_plugin_register() \
+%{_bindir}/ruby -e ' \\\
+$LOAD_PATH.unshift "%{vagrant_dir}/lib"; \\\
+require "vagrant/plugin/manager"; \\\
+Vagrant::Plugin::StateFile.new(Pathname.new(File.expand_path "%{vagrant_plugin_conf}")).add_plugin "%1";' \
+%{nil}
+
+%vagrant_plugin_unregister() \
+%{_bindir}/ruby -e ' \\\
+$LOAD_PATH.unshift "%{vagrant_dir}/lib"; \\\
+require "vagrant/plugin/manager"; \\\
+Vagrant::Plugin::StateFile.new(Pathname.new(File.expand_path "%{vagrant_plugin_conf}")).remove_plugin "%1";' \
+%{nil}
diff --git a/vagrant.spec b/vagrant.spec
index 250f8ae..98b9daa 100644
--- a/vagrant.spec
+++ b/vagrant.spec
@@ -22,11 +22,13 @@ Source2: https://github.com/mitchellh/%{name}-spec/archive/%{vagrant_spec_commit
# for RubyGems and Bundler are in place
Source3: patches.rb
-Source4: macros.vagrant
+Source4: macros.vagrant_plugin
+Source5: macros.vagrant
# The load directive is supported since RPM 4.12, i.e. F21+. The build process
# fails on older Fedoras.
%{?load:%{SOURCE4}}
+%{?load:%{SOURCE5}}
Patch0: vagrant-1.6.5-fix-dependencies.patch
@@ -125,6 +127,8 @@ sed -i -e "11irequire 'vagrant/patches'" %{buildroot}%{vagrant_dir}/lib/vagrant.
# Install Vagrant macros
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/
cp %{SOURCE4} %{buildroot}%{_rpmconfigdir}/macros.d/
+sed -i "s/%%{name}/%{name}/" %{buildroot}%{_rpmconfigdir}/macros.d/macros.%{name}_plugin
+cp %{SOURCE5} %{buildroot}%{_rpmconfigdir}/macros.d/
sed -i "s/%%{name}/%{name}/" %{buildroot}%{_rpmconfigdir}/macros.d/macros.%{name}
@@ -170,6 +174,7 @@ getent group vagrant >/dev/null || groupadd -r vagrant
%{bashcompletion_dir}/%{name}
%dir %{_sharedstatedir}/%{name}
%ghost %{_sharedstatedir}/%{name}/plugins.json
+%{_rpmconfigdir}/macros.d/macros.%{name}_plugin
%files doc
%doc CONTRIBUTING.md CHANGELOG.md README.md