Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Install.sh script for dep #1533

Merged
merged 3 commits into from
Feb 21, 2018
Merged

Conversation

astromechza
Copy link
Contributor

What does this do / why do we need it?

Provides a portable sh script for installing an appropriate dep binary into your environment.

Some regular build environments need dep installed but don't want to pull all the dependencies and build it every time. (Especially in docker-based build environments).

This script provides an easy way to install dep into the GOPATH/bin or specified location via:

$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

What should your reviewer look out for in this PR?

It should be compatible with basic sh syntax without needing any bash magic. I'd appreciate it if others could test it in their environments.

It supports both curl and wget as download mechanisms and bails out if neither are available.

It supports the current binaries available under releases.

Do you need help or clarification on anything?

  • Is this something dep actually needs?
  • Should this script attempt to do an integrity check against the *.sha256 files? I feel it may add some unexpected complexity having to deal with different platforms provided shasum binary.
  • Should more binaries be built during the CI build and uploaded to the releases so that this script can support more than just the basics?

Which issue(s) does this PR fix?

No issue was cut for this, it is just a suggestion. Can retroactively cut an issue for it if necessary.


Example:

$ docker run --rm -ti oraclelinux:6
[root@97422287de6f /]# curl https://raw.githubusercontent.com/AstromechZA/golang-dep/aza_dep_install_script/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
101  3742  101  3742    0     0   5780      0 --:--:-- --:--:-- --:--:-- 13706
ARCH = amd64
OS = linux
Will install into /usr/local/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.3.2
Fetching https://github.com/golang/dep/releases/tag/v0.3.2..
Fetching https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64..
Setting executable permissions.
Moving to /usr/local/bin/dep
[root@97422287de6f /]# dep
dep is a tool for managing dependencies for Go projects

Usage: dep <command>

Commands:

  init     Initialize a new project with manifest and lock files
  status   Report the status of the project's dependencies
  ensure   Ensure a dependency is safely vendored in the project
  prune    Prune the vendor tree of unused packages
  version  Show the dep version information

Examples:
  dep init                               set up a new project
  dep ensure                             install the project's dependencies
  dep ensure -update                     update the locked versions of all dependencies
  dep ensure -add github.com/pkg/errors  add a dependency to the project

Use "dep help [command]" for more information about a command.
[root@97422287de6f /]#

@sdboyer
Copy link
Member

sdboyer commented Jan 16, 2018

i'd actually love to have this, like, really soon. i might not block on it for the immediately-upcoming release (because it's just not necessary, we get the same benefit after the fact), but the big thing here is being able to provide people a one-liner that will get them a version of dep that includes version info.

@astromechza
Copy link
Contributor Author

@sdboyer cool, I'll clean up a bit of it tonight (fix the changelog conflict, add a bit to the README.md)

@astromechza
Copy link
Contributor Author

Ok I've updated the README.md to include info about the script. and fixed other issues.

@astromechza astromechza changed the title [WIP] install script for dep Install.sh script for dep Jan 16, 2018
CHANGELOG.md Outdated
* Add support for importing from [glock](https://github.com/robfig/glock) based projects. ([#1422](https://github.com/golang/dep/pull/1422)
* Add support for importing from [govendor](https://github.com/kardianos/govendor) based projects. ([#815](https://github.com/golang/dep/pull/815)
* Allow override of cache directory location using environment variable `DEPCACHEDIR`. ([#1234](https://github.com/golang/dep/pull/1234))
* Add support for template output in `dep status`. ([#1389](https://github.com/golang/dep/pull/1389)
* Each element in a multi-item TOML array is output on its own line. ([#1461](https://github.com/golang/dep/pull/1461)
* Added `install.sh` script.
Copy link
Member

Choose a reason for hiding this comment

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

Please follow the pattern of the other CHANGELOG entries - include a link to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad! done 👍

@astromechza
Copy link
Contributor Author

Travis build seems to be hanging on the osx build.. queued for hours.

@jmank88
Copy link
Collaborator

jmank88 commented Jan 17, 2018

Restarted hung Travis.

CHANGELOG.md Outdated
* Add support for importing from [glock](https://github.com/robfig/glock) based projects. ([#1422](https://github.com/golang/dep/pull/1422)
* Add support for importing from [govendor](https://github.com/kardianos/govendor) based projects. ([#815](https://github.com/golang/dep/pull/815)
* Allow override of cache directory location using environment variable `DEPCACHEDIR`. ([#1234](https://github.com/golang/dep/pull/1234))
* Add support for template output in `dep status`. ([#1389](https://github.com/golang/dep/pull/1389)
* Each element in a multi-item TOML array is output on its own line. ([#1461](https://github.com/golang/dep/pull/1461)
* Added `install.sh` script. ([#1533](https://github.com/golang/dep/pull/1533)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like we started copying unbalanced parens at some point:
([#1533](https://github.com/golang/dep/pull/1533) -> (#1533

Would you mind fixing this line and any nearby?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or we could come back with another PR and fix these (and add links) since there are so many.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @jmank88 I should have noticed those in the MD preview. Fixed it throughout the section.

@astromechza
Copy link
Contributor Author

@sdboyer I've fixed the issue you pointed out. can you have another look?

Also the travis builds look very stuck again.

@astromechza
Copy link
Contributor Author

@sdboyer anything else to change here?

@astromechza
Copy link
Contributor Author

Had to do some surgery to rebase the branch on latest master. Including support for i386 and freebsd.

@astromechza astromechza force-pushed the aza_dep_install_script branch from c59be21 to 4f2a7ab Compare January 28, 2018 05:45
install.sh Outdated
# Environment variables:
# - INSTALL_DIRECTORY (optional): defaults to $GOPATH/bin
# - DEP_RELEASE_TAG (optional): defaults to fetching the latest release
# - DEP_FAKE_OS (optional): use a fake value for OS (mostly for testing)
Copy link
Collaborator

@ibrasho ibrasho Feb 2, 2018

Choose a reason for hiding this comment

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

minor nit: can we use DEP_OSand DEP_ARCH instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will push an update just now.

@sdboyer
Copy link
Member

sdboyer commented Feb 21, 2018

woo! there are some fixups to be made but i'll do them directly

@sdboyer sdboyer merged commit bd62fd1 into golang:master Feb 21, 2018
@astromechza
Copy link
Contributor Author

Thanks @sdboyer !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants