2016-04-12 19:31:48 +02:00
|
|
|
Packaging Vagrant plugins
|
|
|
|
-------------------------
|
|
|
|
|
2019-04-11 20:03:08 +02:00
|
|
|
This convention is based on the Fedora vagrant package.
|
2016-04-12 19:31:48 +02:00
|
|
|
|
2019-04-11 20:03:08 +02:00
|
|
|
Vagrant plugins are ordinary rubygems, but they should not be packaged as
|
|
|
|
these. First off all, we don't need to build the plugin with a ruby version
|
|
|
|
other then the ruby version with which vagrant was built. Furthermore, vagrant
|
|
|
|
will _only_ recognize gems inside its own directory structure as plugins and not
|
|
|
|
arbitrary rubygems.
|
|
|
|
|
2020-05-13 10:57:29 +02:00
|
|
|
Note that we *must* explicitly specify the macros `rb_build_versions` and
|
|
|
|
`rb_build_abi` (and cannot use macros here!). Usually we can simply use the
|
|
|
|
default ruby here, but in case vagrant is incompatible with the default ruby, we
|
|
|
|
must override this in each plugin.
|
|
|
|
|
2019-04-11 20:03:08 +02:00
|
|
|
An example specfile for a vagrant plugin looks like this:
|
|
|
|
``` spec
|
2020-05-13 10:57:29 +02:00
|
|
|
%global rb_build_versions ruby26
|
|
|
|
%global rb_build_abi ruby:2.6.0
|
|
|
|
%global rb_ruby_suffix ruby2.6
|
2019-04-11 20:03:08 +02:00
|
|
|
|
|
|
|
Name: vagrant-MYPLUGIN
|
|
|
|
Version: $VERSION
|
|
|
|
Release: 0
|
|
|
|
%define mod_name %{name}
|
|
|
|
%define mod_full_name %{mod_name}-%{version}
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: %{rubygem gem2rpm}
|
|
|
|
BuildRequires: %{ruby}
|
|
|
|
BuildRequires: ruby-macros >= 5
|
|
|
|
|
|
|
|
BuildRequires: vagrant
|
|
|
|
BuildArch: noarch
|
|
|
|
Url: $URL
|
|
|
|
Source: $SRC
|
|
|
|
Source1: gem2rpm.yml
|
2020-05-13 10:57:29 +02:00
|
|
|
Summary: $SUMMARY
|
|
|
|
License: $LICENSE
|
2019-04-11 20:03:08 +02:00
|
|
|
|
|
|
|
%description
|
|
|
|
$DESCRIPTION
|
|
|
|
|
|
|
|
%global vagrant_plugin_name %{name}
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%gem_unpack
|
|
|
|
|
|
|
|
%build
|
|
|
|
%gem_build
|
|
|
|
|
|
|
|
%install
|
2020-05-13 10:57:29 +02:00
|
|
|
%vagrant_plugin_install
|
2019-04-11 20:03:08 +02:00
|
|
|
|
|
|
|
%files
|
|
|
|
%{vagrant_plugin_instdir}
|
|
|
|
%{vagrant_plugin_cache}
|
|
|
|
%{vagrant_plugin_spec}
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
|
|
|
|
```
|