From b9b99ac59dbc8dec442e6bdf0691a7cfa1e22c1a Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: May 25 2020 07:01:57 +0000 Subject: [PATCH 1/2] Fixup man page and add `--help` sanity check. Resolves: rhbz#1801305 Removed stderr no-discard (will be dropped), and in case of help2man failure (usually dependencies) will run the executable to output the error. --- diff --git a/vagrant.spec b/vagrant.spec index 1070a03..1ef35c2 100644 --- a/vagrant.spec +++ b/vagrant.spec @@ -203,7 +203,8 @@ export GEM_PATH="%{gem_dir}:%{buildroot}/usr/share/vagrant/gems" # Needed to display help page without a warning. export VAGRANT_INSTALLER_ENV=1 mkdir -p %{buildroot}%{_mandir}/man1 -help2man --no-discard-stderr -N -s1 -o %{buildroot}%{_mandir}/man1/%{name}.1 \ +help2man -N -s1 -o %{buildroot}%{_mandir}/man1/%{name}.1 \ + %{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name} || \ %{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name} %endif @@ -254,6 +255,13 @@ rm -rf test/unit/plugins/hosts/bsd # Rake solves the requires issues for tests rake -f tasks/test.rake test:unit +%if %{with help2man} +# Check `--help` output, using which man page is created +export GEM_PATH="%{gem_dir}:%{buildroot}/usr/share/vagrant/gems" +export VAGRANT_INSTALLER_ENV=1 +%{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name} --help 2>/dev/null \ + | grep -q '^Usage: vagrant ' +%endif %post -p %{_bindir}/ruby begin From 325c1c7a7be5f0f968eae7f29ef6792d84617fff Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: May 26 2020 00:26:29 +0000 Subject: [PATCH 2/2] Update to Vagrant 2.2.9. Added support for podman via docker podman-docker wrapper (https://github.com/hashicorp/vagrant/pull/11356). --- diff --git a/sources b/sources index 9bf74d3..33458a6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (vagrant-2.2.6.tar.gz) = 6d8b5b1d4e5cc482404cf4c59e1b7cf9502a9819569b5098e44874733cee706f26adb4ac7994abe7e3307ca69d3003e2604dc859ce460c53d766d78b8d9fe22a +SHA512 (vagrant-2.2.9.tar.gz) = 15e230bcf336615f0d49a2c40db36f7f26a9f0f6fd42d2ce801f28afc663aadded4fa373e33f9102b21ee70d98563fc68e2b24ffa6c3eec321f58b2c42b0d260 SHA512 (vagrant-spec-abfc34474d122235d56e4c6b6fb5d3e35bedfa90.tar.gz) = cbb60d661d34b37bc5d414da0b2a31f39e2910c11251e334da5efbd8f010b5bd428bc1ae476fcb9b42ec4e8f8c6265292ba3f8f543625178ecb85aad06e8856f diff --git a/vagrant-2.2.5-do-not-load-dependencies.patch b/vagrant-2.2.5-do-not-load-dependencies.patch deleted file mode 100644 index ea61dfd..0000000 --- a/vagrant-2.2.5-do-not-load-dependencies.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 38a48ea0dd01532b3ad17e9ed10c15598bc6ce32 Mon Sep 17 00:00:00 2001 -From: Pavel Valena -Date: Mon, 1 Jul 2019 17:44:54 +0200 -Subject: [PATCH] Do not list / load dependencies if `vagrant` spec is not - loaded - -in `vagrant_internal_specs` as this fails, due to `find` returning `nil`. ---- - lib/vagrant/bundler.rb | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb -index 7ba48435fa..c0fabdcead 100644 ---- a/lib/vagrant/bundler.rb -+++ b/lib/vagrant/bundler.rb -@@ -421,8 +421,9 @@ def generate_vagrant_set - def vagrant_internal_specs - # activate any dependencies up front so we can always - # pin them when resolving -- Gem::Specification.find { |s| s.name == "vagrant" && s.activated? }. -- runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list } -+ if (vs = Gem::Specification.find { |s| s.name == "vagrant" && s.activated? }) -+ vs.runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list } -+ end - # discover all the gems we have available - list = {} - directories = [Gem::Specification.default_specifications_dir] diff --git a/vagrant-2.2.9-do-not-load-dependencies.patch b/vagrant-2.2.9-do-not-load-dependencies.patch new file mode 100644 index 0000000..185d1a4 --- /dev/null +++ b/vagrant-2.2.9-do-not-load-dependencies.patch @@ -0,0 +1,35 @@ +From 068df794f81fb7ec410595d85ca9b4841a6034ec Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Thu, 7 May 2020 22:40:54 +0200 +Subject: [PATCH] Do not activate gems if gemspec is not found + +--- + lib/vagrant/bundler.rb | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb +index 92ee53a..cf92ff7 100644 +--- a/lib/vagrant/bundler.rb ++++ b/lib/vagrant/bundler.rb +@@ -622,14 +622,14 @@ module Vagrant + if !self_spec + @logger.warn("Failed to locate activated vagrant specification. Activating...") + self_spec = Gem::Specification.find { |s| s.name == "vagrant" } +- if !self_spec +- @logger.error("Failed to locate Vagrant RubyGem specification") +- raise Vagrant::Errors::SourceSpecNotFound +- end ++ if self_spec + self_spec.activate + @logger.info("Activated vagrant specification version - #{self_spec.version}") ++ end + end ++ if self_spec + self_spec.runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list } ++ end + # discover all the gems we have available + list = {} + directories = [Gem::Specification.default_specifications_dir] +-- +2.25.0 + diff --git a/vagrant.spec b/vagrant.spec index 1ef35c2..bca13c1 100644 --- a/vagrant.spec +++ b/vagrant.spec @@ -5,7 +5,7 @@ %bcond_without help2man Name: vagrant -Version: 2.2.6 +Version: 2.2.9 Release: 1%{?dist} Summary: Build and distribute virtualized development environments License: MIT @@ -24,9 +24,9 @@ Source4: macros.vagrant # Fix fake_ftp 0.3.x compatibility. # https://github.com/hashicorp/vagrant/issues/10646 Patch0: vagrant-2.2.3-Fix-fake_ftp-0.3.x-compatibility.patch -# Do not load runtime dependencies if vagrant is not loaded +# Do not load runtime dependencies in %%check if vagrant is not loaded # https://github.com/hashicorp/vagrant/pull/10945 -Patch1: vagrant-2.2.5-do-not-load-dependencies.patch +Patch1: vagrant-2.2.9-do-not-load-dependencies.patch # The load directive is supported since RPM 4.12, i.e. F21+. The build process # fails on older Fedoras. @@ -39,11 +39,11 @@ Requires: ruby Requires: rubygem(hashicorp-checkpoint) >= 0.1.5 Requires: rubygem(childprocess) >= 0.5.0 Requires: rubygem(erubis) >= 2.7.0 -Requires: (rubygem(i18n) >= 1.1.1 with rubygem(i18n) < 2.0) +Requires: (rubygem(i18n) >= 1.8 with rubygem(i18n) < 2.0) Requires: rubygem(json) Requires: rubygem(listen) >= 3.1.5 Requires: rubygem(log4r) >= 1.1.9 -Requires: rubygem(net-ssh) >= 5.1.0 +Requires: rubygem(net-ssh) >= 5.2.0 Requires: rubygem(net-scp) >= 1.2.0 Requires: rubygem(net-sftp) >= 2.1 Requires: rubygem(rest-client) >= 1.6.0 @@ -54,6 +54,7 @@ Requires: curl Recommends: vagrant(vagrant-libvirt) Recommends: rubygem(bcrypt_pbkdf) Recommends: rubygem(ed25519) +Recommends: (podman-docker if podman) BuildRequires: bsdtar BuildRequires: ruby @@ -108,7 +109,6 @@ Documentation for %{name}. %setup -q -b2 %patch0 -p1 -%patch1 -p1 %build # TODO: package vagrant_cloud, as it is not in Fedora yet @@ -121,8 +121,8 @@ sed -i '/^\s*I18n\..*$/ s/^/#/g' plugins/commands/login/plugin.rb sed -i '/^\s*command(:login) do$/,/\s*end$/ s/^/#/g' plugins/commands/login/plugin.rb # We have newer versions in Fedora -%gemspec_remove_dep -s %{name}.gemspec -g childprocess '~> 0.6.0' -%gemspec_add_dep -s %{name}.gemspec -g childprocess '>= 0.5.0' +%gemspec_remove_dep -s %{name}.gemspec -g net-scp '~> 1.2.0' +%gemspec_add_dep -s %{name}.gemspec -g net-scp '>= 1.2.0' # Remove Windows specific dependencies %gemspec_remove_dep -s %{name}.gemspec -g wdm @@ -139,18 +139,27 @@ sed -i '/^\s*command(:login) do$/,/\s*end$/ s/^/#/g' plugins/commands/login/plug # Allow older rubyzip version # TODO: remove # https://src.fedoraproject.org/rpms/rubygem-rubyzip/pull-request/1 -%gemspec_remove_dep -s %{name}.gemspec -g rubyzip '~> 1.2.2' +%gemspec_remove_dep -s %{name}.gemspec -g rubyzip '~> 2.0' %gemspec_add_dep -s %{name}.gemspec -g rubyzip -# Allow newer i18n version -# https://github.com/hashicorp/vagrant/pull/11146 -%gemspec_remove_dep -s %{name}.gemspec -g i18n '~> 1.1.1' -%gemspec_add_dep -s %{name}.gemspec -g i18n +# Allow newer listen version +# https://github.com/hashicorp/vagrant/pull/11208 +%gemspec_remove_dep -s %{name}.gemspec -g listen '~> 3.1.5' +%gemspec_add_dep -s %{name}.gemspec -g listen '>= 3.1.5' + +# Allow older childprocess version +%gemspec_remove_dep -s %{name}.gemspec -g childprocess +%gemspec_add_dep -s %{name}.gemspec -g childprocess '>= 1.0.1' # Remove optional dependencies %gemspec_remove_dep -s %{name}.gemspec -g ed25519 %gemspec_remove_dep -s %{name}.gemspec -g bcrypt_pbkdf +# Load missing dependency Vagrant::Util::MapCommandOptions +# https://github.com/hashicorp/vagrant/pull/11609 +sed -i '/^\s*require..vagrant.util.experimental.\s*$/ a\require "vagrant/util/map_command_options"' \ + plugins/kernel_v2/config/vm.rb + gem build %{name}.gemspec gem install -V --local \ @@ -209,6 +218,14 @@ help2man -N -s1 -o %{buildroot}%{_mandir}/man1/%{name}.1 \ %endif %check +# Do not load dependencies from gemspec +cat %{PATCH1} | patch -p1 + +sed -i '/^\s*context "when vagrant specification is not found" do$/,/^ end$/ s/^/#/' \ + test/unit/vagrant/bundler_test.rb +sed -i '/^\s*it "should init the bundler instance with plugins" do$/,/^ end$/ s/^/#/' \ + test/unit/vagrant/plugin/manager_test.rb + # Adjust the vagrant-spec directory name. rm -rf ../vagrant-spec mv ../vagrant-spec{-%{vagrant_spec_commit},} @@ -249,9 +266,45 @@ sed -i '/^\s*it "adds from FTP URL" do$/ a skip' test/unit/vagrant/action/builti sed -i '/^ it "generates a network name and configuration" do$/,/^ end/ s/^/#/' \ test/unit/plugins/providers/docker/action/prepare_networks_test.rb +# There are some Ruby 2.7 incompatibilities which might be fixed by: +# https://github.com/hashicorp/vagrant/pull/11459 +# but workarond the offending test case for now. +sed -i "/describe '#create' do/,/^ end$/ s/^/#/" \ + test/unit/plugins/providers/docker/driver_compose_test.rb +sed -i "/it 'removes the container' do/a\ skip 'Ruby 2.7 incompatibility'" \ + test/unit/plugins/providers/docker/driver_compose_test.rb + # Remove failing BSD-host tests, as we don't care about those. rm -rf test/unit/plugins/hosts/bsd +# Disable broken test for installing docker on host +# https://github.com/hashicorp/vagrant/issues/11606 +sed -i '/^\s*it "installs docker if not present" do$/ a\ skip "GH#11606"' \ + test/unit/plugins/provisioners/docker/installer_test.rb + +# Export the OS as an environment variable that Vagrant can access, so the +# test suite is executed with same host it will be run (also avoids docker +# installer_test issue). +export VAGRANT_DETECTED_OS="$(uname -s 2>/dev/null)" + +# Put gem load path on top of the load path, so they are loaded earlier then +# their StdLib symlinks. +%{!?buildtime_libdir:%global buildtime_libdir $(ruby -rrbconfig -e 'puts RbConfig::CONFIG["libdir"]')} + +RUBYOPT="-I" +for module in \ + openssl \ + psych +do + for dir in \ + %{gem_dir}/gems/$module-*/lib \ + %{buildtime_libdir}/gems/ruby/$module-* + do + RUBYOPT="$RUBYOPT:$dir" + done +done +export RUBYOPT + # Rake solves the requires issues for tests rake -f tasks/test.rake test:unit @@ -373,6 +426,12 @@ end %{vagrant_plugin_instdir}/vagrant-spec.config.example.rb %changelog +* Wed May 20 2020 Pavel Valena - 2.2.9-1 +- Update to Vagrant 2.2.9. + Resolves: rhbz#1795460 +- Added support for podman via docker podman-docker wrapper + (https://github.com/hashicorp/vagrant/pull/11356). + * Tue Oct 15 2019 Pavel Valena - 2.2.6-1 - Upgrade to Vagrant 2.2.6. - Move man pages to main package