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

Add go download script #61

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ binaries

A home for scripts that build pants static binaries.


Supported Platforms
===================

As of Spring 2018, binaries are no longer being published for i386 nor macOS versions prior to 10.8.
Binaries for Linux x86_64 and macOS 10.8+ are generally published.

workflow
========

Expand Down
3 changes: 3 additions & 0 deletions build-support/bin/go/linux/x86_64/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/linux/x86_64/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.linux-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.10/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.10/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.11/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.11/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

It looks like all of the OSX scripts can be symlinks to one copy, since golang doesn't have multiple builds?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

But... maybe we don't care. Still trying to work out a good convention here.

Copy link
Member Author

Choose a reason for hiding this comment

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

My thought process for separate files is it's more straightforward, since the place we link to changes over time, so you have to hunt around. Also this was easy to script, at least for Go, though I could see how more involved scripts would be a little different.

If you have a suggestion I'm happy to follow it.

Copy link
Sponsor Member

@stuhood stuhood Mar 29, 2018

Choose a reason for hiding this comment

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

I merged as is, but remembered afterward that one of the reasons for the symlinking is that it avoids actually having to run an identical script a dozen times. So I'm going to leave the recommendation as is, and we should try to use symlinks in the future.

set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.12/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.12/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.13/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.13/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.8/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.8/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.9/1.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.10.darwin-amd64.tar.gz -o go.tar.gz
3 changes: 3 additions & 0 deletions build-support/bin/go/mac/10.9/1.9.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go1.9.4.darwin-amd64.tar.gz -o go.tar.gz
50 changes: 50 additions & 0 deletions gen-go-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/python

# Helper for creating Go build.sh files. This script will create a default build.sh file
# for Go/macOS/Linux versions listed below, unless the directory already exists. If a custom
# build.sh script is needed, just create it and this helper will ignore it going forward.

import os
from textwrap import dedent

go_versions = [
'1.9.4',
'1.10',
]

mac_versions = [
'10.8',
'10.9',
'10.10',
'10.11',
'10.12',
'10.13',
]

tmpl = dedent("""\
#!/bin/bash
set -o xtrace
curl https://storage.googleapis.com/golang/go{go_version}.{arch}.tar.gz -o go.tar.gz
""")

def maybe_gen(dir, go_version, arch):
if not os.path.exists(dir):
os.makedirs(dir)
filename = os.path.join(dir, 'build.sh')
with open(filename, 'w') as fh:
fh.write(tmpl.format(go_version=go_version, arch=arch))
os.chmod(filename, 0755)

def mac():
for mac_version in mac_versions:
for go_version in go_versions:
dir = 'build-support/bin/go/mac/%s/%s' % (mac_version, go_version)
maybe_gen(dir, go_version, 'darwin-amd64')

def x86_64():
for go_version in go_versions:
dir = 'build-support/bin/go/linux/x86_64/%s' % go_version
maybe_gen(dir, go_version, 'linux-amd64')

mac()
x86_64()