Bug 278431 - sysutils/vagrant: rubygem dependency version issue
Summary: sysutils/vagrant: rubygem dependency version issue
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: joe
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-18 13:02 UTC by Deividas Gedgaudas
Modified: 2024-04-24 10:24 UTC (History)
3 users (show)

See Also:
joe: maintainer-feedback+


Attachments
Bump dependencies so vagrant starts again (2.90 KB, patch)
2024-04-18 15:03 UTC, Michael Gmelin
joe: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deividas Gedgaudas 2024-04-18 13:02:17 UTC
Vagrant reports dependency issue on fresh install:
```
/usr/local/lib/ruby/site_ruby/3.2/rubygems/dependency.rb:315:in `to_specs': Could not find 'childprocess' (~> 4.1.0) - did find: [childprocess-5.0.0] (Gem::MissingSpecVersionError)
```

---

When installing `vagrant` package rubygem dependencies are installed with their latest versions, but [vagrant.gemspec](https://raw.githubusercontent.com/hashicorp/vagrant/main/vagrant.gemspec) expects `rubygem-childprocess` package to be version `4.1.0` (installed: `5.0.0`) and `rubygem-vagrant_cloud` to be version `3.0.5` (installed: `3.1.1`)

```
# vagrant.gemspec:
s.add_dependency "vagrant_cloud", "~> 3.1.1"
s.add_dependency "childprocess", "~> 4.1.0"
```

"Dirty" fix is to modify `/usr/local/lib/ruby/gems/3.2/specifications/vagrant-2.3.7.gemspec` and set the version of actually installed packages.
```
s.add_runtime_dependency(%q<childprocess>.freeze, ["~> 5.0.0".freeze])
s.add_runtime_dependency(%q<vagrant_cloud>.freeze, ["~> 3.1.1".freeze])
```

Not sure at the moment if it is a port dependency issue or if this should be directed to `hashicorp/vagrant`
Comment 1 Michael Gmelin freebsd_committer freebsd_triage 2024-04-18 15:03:27 UTC
Created attachment 250052 [details]
Bump dependencies so vagrant starts again

Deividas: Could you please try this patch (assuming you're on the latest branch)?

    pkg delete vagrant
    pkg install git
    cd /usr/ports
    git clone --depth 1 https://git.freebsd.org/ports.git .
    patch </path/to/0001-sysutils-vagrant-Bump-dependencies.patch
    cd sysutils/vagrant
    BATCH=1 make install clean
    vagrant --version
Comment 2 Deividas Gedgaudas 2024-04-18 15:32:47 UTC
(In reply to Michael Gmelin from comment #1)

Can confirm works. Thank you
Comment 3 Jens Grassel 2024-04-23 13:36:51 UTC
Hi,

thanks for your work.

I tried the patch but vagrant still errors out:

```
/usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1480:in `rescue in block in activate_dependencies': Could not find 'childprocess' (~> 4.1.0) among 84 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=$HOME/.gem/ruby/3.2:/usr/local/lib/ruby/gems/3.2' at: /usr/local/lib/ruby/gems/3.2/specifications/vagrant-2.3.7.gemspec, execute `gem env` for more information
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1477:in `block in activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1466:in `each'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1466:in `activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1448:in `activate'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:280:in `block in activate_bin_path'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:279:in `synchronize'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:279:in `activate_bin_path'
	from /usr/local/bin/vagrant:25:in `<main>'
/usr/local/lib/ruby/site_ruby/3.2/rubygems/dependency.rb:315:in `to_specs': Could not find 'childprocess' (~> 4.1.0) - did find: [childprocess-5.0.0] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=$HOME/.gem/ruby/3.2:/usr/local/lib/ruby/gems/3.2' , execute `gem env` for more information
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1478:in `block in activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1466:in `each'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1466:in `activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems/specification.rb:1448:in `activate'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:280:in `block in activate_bin_path'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:279:in `synchronize'
	from /usr/local/lib/ruby/site_ruby/3.2/rubygems.rb:279:in `activate_bin_path'
	from /usr/local/bin/vagrant:25:in `<main>'
```

Kind regards,

Jens
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2024-04-23 15:40:23 UTC
(In reply to Jens Grassel from comment #3)

I assume something went wrong with patching or you didn't reinstall it or you didn't clean before reinstalling it (all these things keep the old binary around). `pkg info vagrant` should show 2.3.7_1.

I recorded the whole procedure in a clean jail for you: https://blog.grem.de/tWZhVuxSxIB5xCe.html
Comment 5 Jens Grassel 2024-04-24 08:45:40 UTC
(In reply to Michael Gmelin from comment #4)

The mistake from my side was that I applied the patch from the sysutils/vagrant subdirectory which resulted in the gemspec patch file not being placed under the files subdirectory. After applying it from the ports root everything works fine!

Thanks!
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-04-24 10:14:55 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=19e2f7229d19912f9d7045cc660fc87e0149664b

commit 19e2f7229d19912f9d7045cc660fc87e0149664b
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-04-18 14:52:05 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-04-24 10:13:28 +0000

    sysutils/vagrant: Bump dependencies

    This unbreaks `vagrant --version' and (hopefully)
    all major subcommands.

    PR:             278431
    Approved by:    joe@thrallingpenguin.com (maintainer)
    MFH:            2024Q2

 sysutils/vagrant/Makefile                          |  5 +++--
 sysutils/vagrant/files/patch-vagrant.gemspec (new) | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2024-04-24 10:24:01 UTC
A commit in branch 2024Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=79a5e1a43fe2e16f3e4e0f95562a6b8a74822e58

commit 79a5e1a43fe2e16f3e4e0f95562a6b8a74822e58
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-04-18 14:52:05 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-04-24 10:17:26 +0000

    sysutils/vagrant: Bump dependencies

    This unbreaks `vagrant --version' and (hopefully)
    all major subcommands.

    PR:             278431
    Approved by:    joe@thrallingpenguin.com (maintainer)
    MFH:            2024Q2

    (cherry picked from commit 19e2f7229d19912f9d7045cc660fc87e0149664b)

 sysutils/vagrant/Makefile                          |  5 +++--
 sysutils/vagrant/files/patch-vagrant.gemspec (new) | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)