From d876f6f01df1d60e8fbe45b45e3cd02e846d16b2cf1f0a948531aaef57dbee40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 14 Sep 2020 07:18:42 +0000 Subject: [PATCH] Accepting request 833750 from home:dancermak:branches:Virtualization:vagrant switch back to %transfiletrigger & fix addressable have choice & add fix for boxes without a /etc/fstab OBS-URL: https://build.opensuse.org/request/show/833750 OBS-URL: https://build.opensuse.org/package/show/Virtualization:vagrant/vagrant?expand=0&rev=47 --- ...rant-silence-warning-about-installer.patch | 2 +- 0002-Use-a-private-temporary-dir.patch | 2 +- ...s-don-t-abuse-require_relative.patch.patch | 2 +- ...-boo-1044087-added-by-robert.muntean.patch | 2 +- 0005-do-not-depend-on-wdm.patch | 2 +- ...ative-paths-in-docker-plugin-to-make.patch | 2 +- ...on-t-abuse-relative-paths-in-plugins.patch | 2 +- 0008-Skip-failing-tests.patch | 2 +- 0009-Disable-Subprocess-unit-test.patch | 2 +- 0010-Add-check-for-etc-fstab.patch | 82 +++++++++++++++++++ vagrant.changes | 35 ++++++++ vagrant.spec | 16 +++- 12 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 0010-Add-check-for-etc-fstab.patch diff --git a/0001-bin-vagrant-silence-warning-about-installer.patch b/0001-bin-vagrant-silence-warning-about-installer.patch index 7ca113d..558067a 100644 --- a/0001-bin-vagrant-silence-warning-about-installer.patch +++ b/0001-bin-vagrant-silence-warning-about-installer.patch @@ -1,7 +1,7 @@ From 0f5435df3ef882c3da9f098ec83cac1f394a7b4e Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Sat, 11 Oct 2014 16:54:58 -0300 -Subject: [PATCH 1/9] bin/vagrant: silence warning about installer +Subject: [PATCH 01/10] bin/vagrant: silence warning about installer Signed-off-by: Johannes Kastl --- diff --git a/0002-Use-a-private-temporary-dir.patch b/0002-Use-a-private-temporary-dir.patch index 664a9ad..a879eaf 100644 --- a/0002-Use-a-private-temporary-dir.patch +++ b/0002-Use-a-private-temporary-dir.patch @@ -1,7 +1,7 @@ From 103a3765b331a69b615e47d0e1647e4e42fe9a6a Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 22 Oct 2014 09:40:14 -0200 -Subject: [PATCH 2/9] Use a private temporary dir +Subject: [PATCH 02/10] Use a private temporary dir Without this vagrant will clutter $TMPDIR with dozens of even hundreds of temporary files (~4 per vagrant invocation). diff --git a/0003-plugins-don-t-abuse-require_relative.patch.patch b/0003-plugins-don-t-abuse-require_relative.patch.patch index 748f1f8..fecc09f 100644 --- a/0003-plugins-don-t-abuse-require_relative.patch.patch +++ b/0003-plugins-don-t-abuse-require_relative.patch.patch @@ -1,7 +1,7 @@ From 4b3743997f569f268047917a41562831eb09bd1e Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Wed, 17 May 2017 09:09:57 +0200 -Subject: [PATCH 3/9] plugins-don-t-abuse-require_relative.patch +Subject: [PATCH 03/10] plugins-don-t-abuse-require_relative.patch Signed-off-by: Johannes Kastl --- diff --git a/0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch b/0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch index 7e29674..b0b2580 100644 --- a/0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch +++ b/0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch @@ -1,7 +1,7 @@ From d08f0985884ab4ef45ce9f8f37de1c033283eb2f Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Fri, 16 Nov 2018 21:12:43 +0100 -Subject: [PATCH 4/9] fix vbox package boo#1044087, added by +Subject: [PATCH 04/10] fix vbox package boo#1044087, added by robert.munteanu@gmail.com on Sun Aug 13 19:07:06 UTC 2017 Signed-off-by: Johannes Kastl diff --git a/0005-do-not-depend-on-wdm.patch b/0005-do-not-depend-on-wdm.patch index e5fe560..12e4032 100644 --- a/0005-do-not-depend-on-wdm.patch +++ b/0005-do-not-depend-on-wdm.patch @@ -1,7 +1,7 @@ From 5dc228c3811d429e1d9640bbf4a7a21030b388de Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Mon, 4 Jun 2018 09:18:23 +0200 -Subject: [PATCH 5/9] do not depend on wdm +Subject: [PATCH 05/10] do not depend on wdm Signed-off-by: Johannes Kastl --- diff --git a/0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch b/0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch index dac58b2..d65854a 100644 --- a/0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch +++ b/0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch @@ -1,7 +1,7 @@ From ac94bb00341797429f61f6b63377523216217d7e Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Fri, 16 Nov 2018 21:14:46 +0100 -Subject: [PATCH 6/9] do not abuse relative paths in docker plugin to make +Subject: [PATCH 06/10] do not abuse relative paths in docker plugin to make docker work, added by tmkn@tmkn.uk on Thu Oct 26 19:42:46 UTC 2017 Signed-off-by: Johannes Kastl diff --git a/0007-Don-t-abuse-relative-paths-in-plugins.patch b/0007-Don-t-abuse-relative-paths-in-plugins.patch index 040c9f0..e52f672 100644 --- a/0007-Don-t-abuse-relative-paths-in-plugins.patch +++ b/0007-Don-t-abuse-relative-paths-in-plugins.patch @@ -1,7 +1,7 @@ From e5f0f5ee48d7975cf0073a3998a8a11d9e97d797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Fri, 11 Jan 2019 12:32:28 +0100 -Subject: [PATCH 7/9] Don't abuse relative paths in plugins +Subject: [PATCH 07/10] Don't abuse relative paths in plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0008-Skip-failing-tests.patch b/0008-Skip-failing-tests.patch index fb729ed..2827796 100644 --- a/0008-Skip-failing-tests.patch +++ b/0008-Skip-failing-tests.patch @@ -1,7 +1,7 @@ From 4ae304867d0e714254cd4130a9a56eb1560da354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 1 Apr 2019 17:28:31 +0200 -Subject: [PATCH 8/9] Skip failing tests +Subject: [PATCH 08/10] Skip failing tests --- test/unit/bin/vagrant_test.rb | 4 ++-- diff --git a/0009-Disable-Subprocess-unit-test.patch b/0009-Disable-Subprocess-unit-test.patch index bfe805d..ed870d3 100644 --- a/0009-Disable-Subprocess-unit-test.patch +++ b/0009-Disable-Subprocess-unit-test.patch @@ -1,7 +1,7 @@ From 5dc6903fbc40884c5811a71ad43700f7357f7836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Wed, 28 Aug 2019 13:39:58 +0200 -Subject: [PATCH 9/9] Disable Subprocess unit test +Subject: [PATCH 09/10] Disable Subprocess unit test This unit test is *very* flaky on OBS' workers and causes random build failures. These are probably caused by worker being under high load and then diff --git a/0010-Add-check-for-etc-fstab.patch b/0010-Add-check-for-etc-fstab.patch new file mode 100644 index 0000000..e475908 --- /dev/null +++ b/0010-Add-check-for-etc-fstab.patch @@ -0,0 +1,82 @@ +From 75d617e2fe8d626cf23ac77f1c47cf0be4a1938b Mon Sep 17 00:00:00 2001 +From: sophia +Date: Thu, 10 Sep 2020 09:50:13 -0500 +Subject: [PATCH 10/10] Add check for /etc/fstab + +(cherry picked from commit 2297b86790227b6b89a6de6a7a786a726cf56a62) +--- + .../guests/linux/cap/persist_mount_shared_folder.rb | 12 ++++++++++++ + .../linux/cap/persist_mount_shared_folder_test.rb | 13 +++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/plugins/guests/linux/cap/persist_mount_shared_folder.rb b/plugins/guests/linux/cap/persist_mount_shared_folder.rb +index 338d62e07..e0ad08d42 100644 +--- a/plugins/guests/linux/cap/persist_mount_shared_folder.rb ++++ b/plugins/guests/linux/cap/persist_mount_shared_folder.rb +@@ -8,6 +8,8 @@ module VagrantPlugins + class PersistMountSharedFolder + extend SyncedFolder::UnixMountHelpers + ++ @@logger = Log4r::Logger.new("vagrant::guest::linux::persist_mount_shared_folders") ++ + # Inserts fstab entry for a set of synced folders. Will fully replace + # the currently managed group of Vagrant managed entries. Note, passing + # empty list of folders will just remove entries +@@ -15,7 +17,13 @@ module VagrantPlugins + # @param [Machine] machine The machine to run the action on + # @param [Map] A map of folders to add to fstab + def self.persist_mount_shared_folder(machine, folders) ++ unless fstab_exists?(machine) ++ @@logger.info("no fstab file found, not modifying /etc/fstab") ++ return ++ end ++ + if folders.nil? ++ @@logger.info("clearing /etc/fstab") + self.remove_vagrant_managed_fstab(machine) + return + end +@@ -53,6 +61,10 @@ module VagrantPlugins + + private + ++ def self.fstab_exists?(machine) ++ machine.communicate.test("stat /etc/fstab") ++ end ++ + def self.remove_vagrant_managed_fstab(machine) + machine.communicate.sudo("sed -i '/\#VAGRANT-BEGIN/,/\#VAGRANT-END/d' /etc/fstab") + end +diff --git a/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb b/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb +index aa65b38b7..31f7ae764 100644 +--- a/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb ++++ b/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb +@@ -37,6 +37,7 @@ describe "VagrantPlugins::GuestLinux::Cap::PersistMountSharedFolder" do + allow(folder_plugin).to receive(:capability).with(:mount_options, any_args). + and_return(["uid=#{options_uid},gid=#{options_gid}", options_uid, options_gid]) + allow(folder_plugin).to receive(:capability).with(:mount_type).and_return("vboxsf") ++ allow(cap).to receive(:fstab_exists?).and_return(true) + end + + after do +@@ -78,5 +79,17 @@ describe "VagrantPlugins::GuestLinux::Cap::PersistMountSharedFolder" do + cap.persist_mount_shared_folder(machine, folders) + end + end ++ ++ context "fstab does not exist" do ++ before do ++ allow(cap).to receive(:fstab_exists?).and_return(false) ++ end ++ ++ it "does not modify /etc/fstab" do ++ expect(cap).not_to receive(:remove_vagrant_managed_fstab) ++ expect(comm).not_to receive(:sudo).with(/echo '' >> \/etc\/fstab/) ++ cap.persist_mount_shared_folder(machine, folders) ++ end ++ end + end + end +-- +2.28.0 + diff --git a/vagrant.changes b/vagrant.changes index 04b762e..1f174f1 100644 --- a/vagrant.changes +++ b/vagrant.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Wed Sep 9 12:47:45 UTC 2020 - Dan Čermák + +- Switch back to using transfiletriggerin/un +- Increase required version of the addressable gem +- Allow to skip tests during development via bcond_without +- Add fix for boxes that don't have a /etc/fstab + Added patch: + * 0010-Add-check-for-etc-fstab.patch + rebased patches: + * 0001-bin-vagrant-silence-warning-about-installer.patch + * 0002-Use-a-private-temporary-dir.patch + * 0003-plugins-don-t-abuse-require_relative.patch.patch + * 0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch + * 0005-do-not-depend-on-wdm.patch + * 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch + * 0007-Don-t-abuse-relative-paths-in-plugins.patch + * 0008-Skip-failing-tests.patch + * 0009-Disable-Subprocess-unit-test.patch + ------------------------------------------------------------------- Wed Aug 26 15:01:59 UTC 2020 - Dan Čermák @@ -6,6 +26,21 @@ Wed Aug 26 15:01:59 UTC 2020 - Dan Čermák * add rsync to BuildRequires * run fdupes after installation + Remove patches (merged upstream): + * 0010-Bump-version-of-net-ssh-to-6.0-and-net-sftp-to-3.0.patch + * 0011-Fixes-11606-Mock-out-guest-capabilities-instead-of-r.patch + + Rebased patches: + * 0001-bin-vagrant-silence-warning-about-installer.patch + * 0002-Use-a-private-temporary-dir.patch + * 0003-plugins-don-t-abuse-require_relative.patch.patch + * 0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch + * 0005-do-not-depend-on-wdm.patch + * 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch + * 0007-Don-t-abuse-relative-paths-in-plugins.patch + * 0008-Skip-failing-tests.patch + * 0009-Disable-Subprocess-unit-test.patch + FEATURES: - hyperv/disks: Add ability to manage virtual disks for guests [GH-11541] diff --git a/vagrant.spec b/vagrant.spec index 898805d..7c0f766 100644 --- a/vagrant.spec +++ b/vagrant.spec @@ -17,6 +17,8 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # +# disable tests if you want to just run a quick build +%{bcond_without tests} %global mod_name vagrant %global mod_full_name %{mod_name}-%{version} @@ -55,6 +57,7 @@ Patch6: 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch Patch7: 0007-Don-t-abuse-relative-paths-in-plugins.patch Patch8: 0008-Skip-failing-tests.patch Patch9: 0009-Disable-Subprocess-unit-test.patch +Patch10: 0010-Add-check-for-etc-fstab.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -151,7 +154,7 @@ BuildRequires: %{rubygem ffi >= 1.9 } # Prevent have choice for rubygem(ruby:2.5.0:thor:0) >= 0.18 BuildRequires: %{rubygem thor:0.19} # Prevent have choice for rubygem(ruby:2.5.0:addressable) >= 2.3.6 -BuildRequires: %{rubygem addressable >= 2.6} +BuildRequires: %{rubygem addressable >= 2.7} # Prevent have choice for rubygem(ruby:2.5.0:public_suffix) >= 2.0.2 BuildRequires: %{rubygem public_suffix:4} @@ -161,11 +164,13 @@ BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 # for the test +%if %{with tests} BuildRequires: openssh BuildRequires: curl BuildRequires: bsdtar BuildRequires: %{rubygem vagrant-spec} BuildRequires: rsync +%endif BuildRequires: fdupes @@ -378,12 +383,16 @@ rm -f %{buildroot}%{vagrant_dir}/.runner.sh %fdupes %{buildroot}%{dirname:%vagrant_plugin_dir} %check + +%if %{with tests} # remove the git reference to vagrant-spec # -> don't have to cleanup, the Gemfile is excluded anyway sed -i "s|gem 'vagrant-spec', git.*$|gem 'vagrant-spec'|" Gemfile export GEM_PATH=%{buildroot}%{vagrant_plugin_dir}:$(ruby.%{rb_ruby_suffix} -e "print Gem.path.reject{|path| path.include? 'home'}.join(':')") bundle exec rake test:unit +%endif +# with tests %pre getent group vagrant >/dev/null || groupadd -r vagrant @@ -391,11 +400,10 @@ getent group vagrant >/dev/null || groupadd -r vagrant %post %{post_rb} -#FIXME: use %%transfiletriggerin/-un once boo#1041742 gets resolved -%filetriggerin -- %{dirname:%{vagrant_plugin_spec}}/ +%transfiletriggerin -- %{dirname:%{vagrant_plugin_spec}}/ %{transfiletriggerin_rb} -%filetriggerun -- %{dirname:%{vagrant_plugin_spec}}/ +%transfiletriggerun -- %{dirname:%{vagrant_plugin_spec}}/ %{transfiletriggerun_rb} %files