vagrant/vagrant.spec

217 lines
7.4 KiB
RPMSpec
Raw Normal View History

#
# spec file for package vagrant
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012 Laurent Bigonville <bigon@debian.org>, License GPL-2.0+
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define mod_name vagrant
%define mod_full_name %{mod_name}-%{version}
%{!?vim_data_dir:%global vim_data_dir /usr/share/vim/%(readlink /usr/share/vim/current)}
Name: vagrant
Version: 1.9.1
Release: 0
Summary: Build and distribute virtualized development environments
License: MIT
Group: Development/Languages/Ruby
Url: https://github.com/mitchellh/vagrant
Source0: https://github.com/mitchellh/vagrant/archive/v%{version}/%{mod_name}-%{version}.tar.gz
Source2: vagrant.1
Source3: README.SUSE
Source99: %{name}-rpmlintrc
Provides: rubygem-vagrant = %{version}
Obsoletes: rubygem-vagrant < %{version}
Recommends: vagrant-libvirt
#
Patch1: 0001-Disable-Checkpoint.patch
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
Patch5: 0005-Support-system-installed-plugins.patch
Patch6: 0006-Relax-dependency-resolution.patch
Patch7: 0007-Update-command.rb.patch
Patch8: 0008-Read-data-from-usr-share-vagrant.patch
Patch9: 0009-plugins-don-t-abuse-require_relative.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# force only one ruby version
%define rb_build_versions %rb_default_ruby
%define rb_build_abi %rb_default_ruby_abi
#
BuildRequires: %{ruby >= 2.0.0}
BuildRequires: %{rubygem bundler}
BuildRequires: %{rubygem childprocess}
# Prevent have choice for rubygem(ruby:2.2.0:erubis)
BuildRequires: %{rubygem erubis >= 2.7}
BuildRequires: %{rubygem i18n}
BuildRequires: %{rubygem listen}
BuildRequires: %{rubygem log4r}
# Prevent have choice for rubygem(ruby:2.2.0:net-scp)
BuildRequires: %{rubygem net-scp >= 1.2}
BuildRequires: %{rubygem net-sftp}
BuildRequires: %{rubygem net-ssh}
# Prevent have choice for rubygem(ruby:2.2.0:nokogiri)
BuildRequires: %{rubygem nokogiri >= 1.7}
# Prevent have choice for rubygem(ruby:2.1.0:mime-types) >= 1.16
BuildRequires: %{rubygem mime-types >= 2}
BuildRequires: ruby-macros >= 5
# inotify should go here
#BuildRequires: %{rubygem rb-kqueue}
BuildRequires: %{rubygem rest-client}
#
Requires: %{rubygem childprocess}
# Prevent have choice for rubygem(ruby:2.2.0:erubis)
Requires: %{rubygem erubis >= 2.7}
Requires: %{rubygem i18n}
Requires: %{rubygem listen}
Requires: %{rubygem log4r}
# Prevent have choice for rubygem(ruby:2.2.0:net-scp)
Requires: %{rubygem net-scp >= 1.2}
Requires: %{rubygem net-sftp}
Requires: %{rubygem net-ssh}
# Prevent have choice for rubygem(ruby:2.2.0:nokogiri)
Requires: %{rubygem nokogiri >= 1.7}
# inotify should go here
#Requires: %{rubygem rb-kqueue0}
Requires: %{rubygem rest-client}
# We don't require rubygem mime-types since it's pulled in transitively
#
Requires: bsdtar
Requires: curl
Requires: openssh
#
%description
Vagrant is a tool for building and distributing virtualized development
environments.
%package vim
Summary: Vagrantfile syntax files for the vim editor
Group: Development/Languages/Ruby
Supplements: packageand(vagrant:vim)
BuildRequires: vim
Requires: vim
BuildArch: noarch
%description vim
Optional dependency offering vim syntax files for Vagrantfile
%package emacs
Summary: Vagrantfile syntax files for the emacs editor
Group: Development/Languages/Ruby
Supplements: packageand(vagrant:emacs_program)
BuildRequires: emacs-nox
Requires: emacs_program
BuildArch: noarch
%description emacs
Optional dependency offering emacs syntax files for Vagrantfile
%package bash-completion
Summary: Vagrant bash autocompletion
Group: Development/Languages/Ruby
Supplements: packageand(vagrant:bash)
Requires: bash
BuildArch: noarch
%description bash-completion
Optional dependency offering bash completion for vagrant
%prep
%setup -q -n %{mod_full_name}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
cp %{SOURCE3} .
%build
mv %{mod_name}.gemspec %{mod_full_name}.gemspec
%gem_build
mv %{mod_full_name}.gem %{_sourcedir}
bundle exec bin/vagrant --version
%install
# Tumbleweed OR Leap 42.2+
%if %suse_version >= 1320 || 0%{?sle_version} >= 120200
%gem_install -f --no-symlink-binaries
%else
%gem_install -f
%endif
%{__mkdir_p} %{buildroot}%{_mandir}/man1
install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/vagrant.1
install -D -d -m 0755 \
%{buildroot}%{_sysconfdir}/bash_completion.d/ \
%{buildroot}%{vim_data_dir}/plugin/ \
%{buildroot}%{_datadir}/emacs/site-lisp/
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/contrib/bash/completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/%{mod_name}.sh
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/contrib/vim/vagrantfile.vim %{buildroot}%{vim_data_dir}/plugin/%{mod_name}.vim
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/contrib/emacs/vagrant.el %{buildroot}%{_datadir}/emacs/site-lisp/%{mod_name}.el
# Tumbleweed OR Leap 42.2+
%if %suse_version >= 1320 || 0%{?sle_version} >= 120200
mv -v %{buildroot}%{_bindir}/vagrant.%{rb_default_ruby_suffix} %{buildroot}%{_bindir}/vagrant
%endif
mkdir -p %{buildroot}%{_datadir}/%{name}
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/keys %{buildroot}%{_datadir}/%{name}/keys
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/plugins %{buildroot}%{_datadir}/%{name}/plugins
mv %{buildroot}%{gem_base}/gems/%{mod_full_name}/templates %{buildroot}%{_datadir}/%{name}/templates
chmod -x %{buildroot}%{_datadir}/%{name}/templates/locales/en.yml
install -m 644 version.txt %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/%{name}-plugins/plugins.d
echo "{}" > %{buildroot}%{_datadir}/%{name}-plugins/plugins.json
rm -rf %{buildroot}%{gem_base}/gems/%{mod_full_name}/.travis.yml
rm -rf %{buildroot}%{gem_base}/gems/%{mod_full_name}/.gitignore
%files
%defattr(-,root,root,-)
%doc CHANGELOG.md LICENSE README.SUSE
%{_bindir}/vagrant
%{gem_base}/cache/%{mod_full_name}.gem
%{gem_base}/doc/%{mod_full_name}/
%{gem_base}/gems/%{mod_full_name}/
%{gem_base}/specifications/%{mod_full_name}.gemspec
%{_datadir}/%{name}
%dir %{_datadir}/%{name}-plugins
%dir %{_datadir}/%{name}-plugins/plugins.d
%{_datadir}/%{name}-plugins/plugins.json
%{_mandir}/man1/vagrant.*
%files vim
%defattr(-,root,root,-)
%{vim_data_dir}/plugin/%{mod_name}.vim
%files emacs
%defattr(-,root,root,-)
%{_datadir}/emacs/site-lisp/%{mod_name}.el
%files bash-completion
%defattr(-,root,root,-)
%config %{_sysconfdir}/bash_completion.d/%{mod_name}.sh
%changelog