mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 04:06:35 +02:00
brew: formula go builds embed version props into the tailscale{d} exes
it is now done correctly, and is exactly compatible to build_dist.sh (WIP) Signed-off-by: Mike Kramlich <groglogic@gmail.com>
This commit is contained in:
parent
d2eeba5adb
commit
7c16062a53
@ -18,11 +18,11 @@ These platform versions and permutations have been tested and are known to work
|
||||
| role | brew | golang | os | arch | repo |
|
||||
| ----------- | --------------------------- | --------------------- | ---------------------- | ------------------ | ---------- |
|
||||
| maintainer: | Homebrew 3.0.1-120-g5ca03ab | go1.15.8 darwin/amd64 | macOS Catalina 10.15.3 | Intel 64-bit | |
|
||||
| | | | macOS Big Sur 11.x (?) | Apple M1 ARM64 (?) | |
|
||||
| | w/ ruby 2.6.3p62 | | macOS Big Sur 11.x (?) | Apple M1 ARM64 (?) | |
|
||||
| | | | | | |
|
||||
| | | | | | |
|
||||
| pkg target: | Homebrew 3.0.1-120-g5ca03ab | go1.15.8 darwin/amd64 | macOS Catalina 10.15.3 | Intel 64-bit | tailscale: |
|
||||
| | | | macOS Big Sur 11.x (?) | Apple M1 ARM64 (?) | 188bb14269 |
|
||||
| | w/ ruby 2.6.3p62 | | macOS Big Sur 11.x (?) | Apple M1 ARM64 (?) | 188bb14269 |
|
||||
| | | | | | HEAD |
|
||||
| | | | | | likely 1.5 |
|
||||
|
||||
@ -44,12 +44,12 @@ These platform versions and permutations have been tested and are known to work
|
||||
| | make-test-source-tarball.sh | |
|
||||
| | serve-tarball.sh | |
|
||||
| | dl-tarball-sha.sh | |
|
||||
| | search-interesting.sh | nice to keep these on maintainer's radar |
|
||||
| | test.sh | tests all supported permutations |
|
||||
| | install-start-with-checks.sh | install test run for maintainer |
|
||||
| | up.sh | |
|
||||
| | status.sh | |
|
||||
| | stop-uninstall-wipe.sh | closing counterpart to the install*.sh script |
|
||||
| | search-interesting.sh | nice to keep these on maintainer's radar |
|
||||
| | | |
|
||||
| subdirs | brew/local/ | .gitignored tree created and used during brew maintenance work |
|
||||
|
||||
|
||||
@ -40,21 +40,29 @@ cat <<TEMPLATE4
|
||||
tailscale_path = buildpath/"src/github.com/tailscale/tailscale"
|
||||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# TODO(mkramlich): refactor down the 'version.sh to ENV sets':
|
||||
output = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = output.split("\n")
|
||||
# build the exes with version strings equiv to the tailscale repo's build_dist.sh:
|
||||
# TODO(mkramlich): refactor down the steps from version.sh to ldflags
|
||||
# TODO(mkramlich): make brew audit of all formulae silent and 0 again
|
||||
distvers = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = distvers.split("\n")
|
||||
ver_props = {}
|
||||
lines.each do |line|
|
||||
parts = line.split("=")
|
||||
key = parts.at(0)
|
||||
val = parts.at(1)
|
||||
system "echo adding to ENV for go builds: key #{key}, val #{val}"
|
||||
ENV[key] = val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
val = val.gsub('"', '') # because version.sh emits each prop with double-quotes enclosing each val
|
||||
ver_props[key] = val
|
||||
end
|
||||
# TODO(mkramlich): make brew audit happy again
|
||||
# TODO(mkramlich): lose the breaking quotes around the vals in the #{ENV["FOO"]} renders in the go builds
|
||||
# go builds equiv to how done by tailscale repo's build_dist.sh:
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscaled"
|
||||
vl = ver_props["VERSION_LONG"]
|
||||
vs = ver_props["VERSION_SHORT"]
|
||||
vgh = ver_props["VERSION_GIT_HASH"]
|
||||
vl = "tailscale.com/version.Long=" + vl
|
||||
vs = "tailscale.com/version.Short=" + vs
|
||||
vgh = "tailscale.com/version.GitCommit=" + vgh
|
||||
ldflags = "-X #{vl} -X #{vs} -X #{vgh}"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscaled"
|
||||
bin.install "tailscale"
|
||||
bin.install "tailscaled"
|
||||
end
|
||||
|
||||
@ -19,21 +19,29 @@ class Tailscale < Formula
|
||||
tailscale_path = buildpath/"src/github.com/tailscale/tailscale"
|
||||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# TODO(mkramlich): refactor down the 'version.sh to ENV sets':
|
||||
output = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = output.split("\n")
|
||||
# build the exes with version strings equiv to the tailscale repo's build_dist.sh:
|
||||
# TODO(mkramlich): refactor down the steps from version.sh to ldflags
|
||||
# TODO(mkramlich): make brew audit of all formulae silent and 0 again
|
||||
distvers = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = distvers.split("\n")
|
||||
ver_props = {}
|
||||
lines.each do |line|
|
||||
parts = line.split("=")
|
||||
key = parts.at(0)
|
||||
val = parts.at(1)
|
||||
system "echo adding to ENV for go builds: key #{key}, val #{val}"
|
||||
ENV[key] = val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
val = val.gsub('"', '') # because version.sh emits each prop with double-quotes enclosing each val
|
||||
ver_props[key] = val
|
||||
end
|
||||
# TODO(mkramlich): make brew audit happy again
|
||||
# TODO(mkramlich): lose the breaking quotes around the vals in the #{ENV["FOO"]} renders in the go builds
|
||||
# go builds equiv to how done by tailscale repo's build_dist.sh:
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscaled"
|
||||
vl = ver_props["VERSION_LONG"]
|
||||
vs = ver_props["VERSION_SHORT"]
|
||||
vgh = ver_props["VERSION_GIT_HASH"]
|
||||
vl = "tailscale.com/version.Long=" + vl
|
||||
vs = "tailscale.com/version.Short=" + vs
|
||||
vgh = "tailscale.com/version.GitCommit=" + vgh
|
||||
ldflags = "-X #{vl} -X #{vs} -X #{vgh}"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscaled"
|
||||
bin.install "tailscale"
|
||||
bin.install "tailscaled"
|
||||
end
|
||||
|
||||
@ -19,21 +19,29 @@ class Tailscale < Formula
|
||||
tailscale_path = buildpath/"src/github.com/tailscale/tailscale"
|
||||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# TODO(mkramlich): refactor down the 'version.sh to ENV sets':
|
||||
output = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = output.split("\n")
|
||||
# build the exes with version strings equiv to the tailscale repo's build_dist.sh:
|
||||
# TODO(mkramlich): refactor down the steps from version.sh to ldflags
|
||||
# TODO(mkramlich): make brew audit of all formulae silent and 0 again
|
||||
distvers = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = distvers.split("\n")
|
||||
ver_props = {}
|
||||
lines.each do |line|
|
||||
parts = line.split("=")
|
||||
key = parts.at(0)
|
||||
val = parts.at(1)
|
||||
system "echo adding to ENV for go builds: key #{key}, val #{val}"
|
||||
ENV[key] = val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
val = val.gsub('"', '') # because version.sh emits each prop with double-quotes enclosing each val
|
||||
ver_props[key] = val
|
||||
end
|
||||
# TODO(mkramlich): make brew audit happy again
|
||||
# TODO(mkramlich): lose the breaking quotes around the vals in the #{ENV["FOO"]} renders in the go builds
|
||||
# go builds equiv to how done by tailscale repo's build_dist.sh:
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscaled"
|
||||
vl = ver_props["VERSION_LONG"]
|
||||
vs = ver_props["VERSION_SHORT"]
|
||||
vgh = ver_props["VERSION_GIT_HASH"]
|
||||
vl = "tailscale.com/version.Long=" + vl
|
||||
vs = "tailscale.com/version.Short=" + vs
|
||||
vgh = "tailscale.com/version.GitCommit=" + vgh
|
||||
ldflags = "-X #{vl} -X #{vs} -X #{vgh}"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscaled"
|
||||
bin.install "tailscale"
|
||||
bin.install "tailscaled"
|
||||
end
|
||||
|
||||
@ -18,21 +18,29 @@ class Tailscale < Formula
|
||||
tailscale_path = buildpath/"src/github.com/tailscale/tailscale"
|
||||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# TODO(mkramlich): refactor down the 'version.sh to ENV sets':
|
||||
output = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = output.split("\n")
|
||||
# build the exes with version strings equiv to the tailscale repo's build_dist.sh:
|
||||
# TODO(mkramlich): refactor down the steps from version.sh to ldflags
|
||||
# TODO(mkramlich): make brew audit of all formulae silent and 0 again
|
||||
distvers = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = distvers.split("\n")
|
||||
ver_props = {}
|
||||
lines.each do |line|
|
||||
parts = line.split("=")
|
||||
key = parts.at(0)
|
||||
val = parts.at(1)
|
||||
system "echo adding to ENV for go builds: key #{key}, val #{val}"
|
||||
ENV[key] = val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
val = val.gsub('"', '') # because version.sh emits each prop with double-quotes enclosing each val
|
||||
ver_props[key] = val
|
||||
end
|
||||
# TODO(mkramlich): make brew audit happy again
|
||||
# TODO(mkramlich): lose the breaking quotes around the vals in the #{ENV["FOO"]} renders in the go builds
|
||||
# go builds equiv to how done by tailscale repo's build_dist.sh:
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscaled"
|
||||
vl = ver_props["VERSION_LONG"]
|
||||
vs = ver_props["VERSION_SHORT"]
|
||||
vgh = ver_props["VERSION_GIT_HASH"]
|
||||
vl = "tailscale.com/version.Long=" + vl
|
||||
vs = "tailscale.com/version.Short=" + vs
|
||||
vgh = "tailscale.com/version.GitCommit=" + vgh
|
||||
ldflags = "-X #{vl} -X #{vs} -X #{vgh}"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscaled"
|
||||
bin.install "tailscale"
|
||||
bin.install "tailscaled"
|
||||
end
|
||||
|
||||
@ -18,21 +18,29 @@ class Tailscale < Formula
|
||||
tailscale_path = buildpath/"src/github.com/tailscale/tailscale"
|
||||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# TODO(mkramlich): refactor down the 'version.sh to ENV sets':
|
||||
output = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = output.split("\n")
|
||||
# build the exes with version strings equiv to the tailscale repo's build_dist.sh:
|
||||
# TODO(mkramlich): refactor down the steps from version.sh to ldflags
|
||||
# TODO(mkramlich): make brew audit of all formulae silent and 0 again
|
||||
distvers = Utils.safe_popen_read("./version/version.sh")
|
||||
lines = distvers.split("\n")
|
||||
ver_props = {}
|
||||
lines.each do |line|
|
||||
parts = line.split("=")
|
||||
key = parts.at(0)
|
||||
val = parts.at(1)
|
||||
system "echo adding to ENV for go builds: key #{key}, val #{val}"
|
||||
ENV[key] = val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
val = val.gsub('"', '') # because version.sh emits each prop with double-quotes enclosing each val
|
||||
ver_props[key] = val
|
||||
end
|
||||
# TODO(mkramlich): make brew audit happy again
|
||||
# TODO(mkramlich): lose the breaking quotes around the vals in the #{ENV["FOO"]} renders in the go builds
|
||||
# go builds equiv to how done by tailscale repo's build_dist.sh:
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", "\"-X tailscale.com/version.Long=#{ENV["VERSION_LONG"]} -X tailscale.com/version.Short=#{ENV["VERSION_SHORT"]} -X tailscale.com/version.GitCommit=#{ENV["VERSION_GIT_HASH"]}\"", "tailscale.com/cmd/tailscaled"
|
||||
vl = ver_props["VERSION_LONG"]
|
||||
vs = ver_props["VERSION_SHORT"]
|
||||
vgh = ver_props["VERSION_GIT_HASH"]
|
||||
vl = "tailscale.com/version.Long=" + vl
|
||||
vs = "tailscale.com/version.Short=" + vs
|
||||
vgh = "tailscale.com/version.GitCommit=" + vgh
|
||||
ldflags = "-X #{vl} -X #{vs} -X #{vgh}"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscale"
|
||||
system "go", "build", "-o", ".", "-tags", "xversion", "-ldflags", ldflags, "tailscale.com/cmd/tailscaled"
|
||||
bin.install "tailscale"
|
||||
bin.install "tailscaled"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user