New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vagrant: remove unused vendored Gemfile{,.lock} #47519
Conversation
Success on aarch64-linux (full log) Attempted: vagrant Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: vagrant Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: vagrant Partial log (click to expand)
|
inherit ruby; | ||
gemdir = ./.; | ||
gemfile = writeText "Gemfile" ""; | ||
lockfile = writeText "Gemfile.lock" ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this works because bundler isn’t actually used at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either that, or it does look at runtime but it accepts empty files 🤷♂️
@@ -0,0 +1,2 @@ | |||
/Gemfile | |||
/Gemfile.lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would these files end up here? (Just wondering why they need to be ignored)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the update script this would be become unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the bundix workflow involves copying the Gemfile and Gemfile.lock into nixpkgs, however vagrant is a bit special. Since we're using empty files for those two, copying them into nixpkgs does nothing, so this was meant to ease the workflow for someone who is used to the standard bundix workflow.
This isn't necessary, but I thought it would be nice to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the files showing up in the diff would be enough indication. Putting files somebody might accidentally copy into the repo in the gitignore seems like quite a can of worms to open :P
I wrote this update script (update-gemset.sh) to generate a new gemset: #!/usr/bin/env nix-shell
#!nix-shell -p ruby.devEnv bash -i bash
set -exu
temp=$(mktemp -d)
function finish {
rm -rf "$temp"
}
trap finish EXIT
NIXPKGS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"/../../../..
SRC=$(nix-build --no-out-link "$NIXPKGS" -A vagrant.src)
tar -xvf "$SRC" -C "$temp"
(cd "$temp"/vagrant-* && bundle && bundix .)
cp "$temp"/vagrant-*/gemset.nix . |
That script seems like it would work but I'd rather not vendor that in as it's essentially the standard bundix workflow minus the "copy over Gemfile and Gemfile.lock". |
@@ -404,7 +404,7 @@ | |||
source = { | |||
fetchSubmodules = false; | |||
rev = "9413ab298407114528766efefd1fb1ff24589636"; | |||
sha256 = "1z77m3p6x82hipa7y4i71zafy0rdfajw2vhqdxczjmrlwp0pvisl"; | |||
sha256 = "0mb0cxrbnvdwcppvvcjawcasndpkc0qc11n5x64fd1avzdi928ss"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this hash change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea, backed this out.
e90a276
to
16a8e49
Compare
Success on aarch64-linux (full log) Attempted: vagrant Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: vagrant Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: vagrant Partial log (click to expand)
|
Was is the process to update Vagrant? I'm a bit lost (#64302) |
Motivation for this change
Coming off of discussion on #47310.
I originally tried to use the
Gemfile
direct from the vagrant repo, but that usesgemspec
to include dependencies. Our ruby infrastructure doesn't support gemspec right now, and it would be painful to support, as thevagrant.spec
is dynamic and requires files from the Vagrant git repo to exist, all for metadata that we don't care about.I'm no Ruby expert and the current vagrant setup is definitely a hack (it should probably use
bundlerApp
for example), but it manages to avoid bundler blowing up at runtime when it tries to validate the Gemfile/Gemfile.lock and don't involve too much manual effort at version update time. Since the Gemfile/Gemfile.lock don't seem to matter, just set them to empty files, as vagrant should only be used as an executable and not a library anyways.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)cc @Mic92 @alyssais