Skip to content
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

Use dvm tmp for docker downloads #189

Merged
merged 3 commits into from
Jan 2, 2019
Merged

Conversation

carolynvs
Copy link
Collaborator

Download docker binary to ~/.dvm/.tmp instead of /tmp/dvm-* so that when we copy it into the dvm home directory afterwards we can always use a rename safely. This avoids this dreaded cross partition move error invalid cross-device link.

Fixes #188

@rgbkrk
Copy link
Member

rgbkrk commented Dec 30, 2018

Since more options are coming in here, perhaps there should be a front facing DvmOptions struct that both dvmDir and mirror can be part of, which gets passed around.

@carolynvs carolynvs changed the title Use dvm tmp WIP: Use dvm tmp Dec 30, 2018
@carolynvs carolynvs changed the title WIP: Use dvm tmp WIP: Use dvm tmp for docker downloads Dec 30, 2018
@carolynvs
Copy link
Collaborator Author

carolynvs commented Dec 30, 2018

Yeah good call. The args list is getting unweildly.

Also Docker broke how binaries are staged ... again... Just found that out when I reran the regression tests. They removed the files from test.docker.com and put up a download script there instead.

Gonna see how small of a fix that I can do to keep things working for most people without doing massive surgery. So just the struct and a bit of cleanup, since we don't need to be running builds on go 1.7 anymore. 😀 (In separate PRs)

@rgbkrk
Copy link
Member

rgbkrk commented Dec 30, 2018

Also Docker broke how binaries are staged ... again...

Oh joy.

(In separate PRs)

Ping me if you want me to review anything else!

@carolynvs carolynvs changed the title WIP: Use dvm tmp for docker downloads Use dvm tmp for docker downloads Dec 30, 2018
@carolynvs
Copy link
Collaborator Author

@rgbkrk Ok, once you've reviewed and merged #191, this is the next one to look at.

I've redone it so that instead of having a half dozen global vars, we pass around a DvmOptions struct.


func NewDvmOptions() DvmOptions {
return DvmOptions{
Logger: log.New(ioutil.Discard, "", log.LstdFlags),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set other defaults for the MirrorURL and others here too? Or just rely on "" being the default string and false being the default for bool?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to go changing too much at once, especially stuff that is unrelated to the original bug (doing a file move across disk partitions).

I'm not terribly confident that I wouldn't cause regressions... 😊

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

This avoids cross partition move problems
Moved logger into DvmOptions as well since it's so ubiquitous
@carolynvs
Copy link
Collaborator Author

@rgbkrk I've rebased to get it passing. Let me know if this is okay as is or if it needs another pass. 😀

func (version Version) Download(mirrorURL string, binaryPath string, l *log.Logger) error {
err := version.download(false, mirrorURL, binaryPath, l)
func (version Version) Download(opts config.DvmOptions, binaryPath string) error {
err := version.download(false, opts, binaryPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something @captainsafia pointed out to me is that we should avoid the boolean trap. Since this was there before, I wouldn't bother changing it now. Might be good though, as I don't know if this means it's downloading or not.

@rgbkrk rgbkrk merged commit d137c0c into howtowhale:master Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants