brew: formulae audits clean, restored (it required only refactors)
WIP Signed-off-by: Mike Kramlich <groglogic@gmail.com>
This commit is contained in:
parent
63e4034211
commit
ed0080eac5
|
@ -41,26 +41,7 @@ cat <<TEMPLATE4
|
|||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# 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 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
|
||||
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}"
|
||||
ldflags = prepare_ldflags
|
||||
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"
|
||||
|
@ -68,6 +49,31 @@ cat <<TEMPLATE4
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_ldflags
|
||||
ver_props = prepare_ver_props
|
||||
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}"
|
||||
"-X #{vl} -X #{vs} -X #{vgh}"
|
||||
end
|
||||
|
||||
def prepare_ver_props
|
||||
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).delete('"') # cuz version.sh emits each prop with double-quotes enclosing each val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
ver_props[key] = val
|
||||
end
|
||||
ver_props
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"run/tailscale").mkpath
|
||||
(var/"lib/tailscale").mkpath
|
||||
|
|
|
@ -25,9 +25,7 @@ set -e # to turn back on
|
|||
echo
|
||||
echo audit formula...
|
||||
# requires Internet access for some audit checks:
|
||||
set +e # TODO(mkramlich): tmp allow a nonclean formula audit until build_dist fixes/refactor done
|
||||
brew audit --strict --online --formula $TS_FORMULA # keep this run output blank and exit 0
|
||||
set -e
|
||||
brew audit --strict --online --formula $TS_FORMULA # keep this run exit 0 (NOTE: Homebrew can be noisy if updates)
|
||||
|
||||
echo
|
||||
echo installing...
|
||||
|
|
|
@ -20,26 +20,7 @@ class Tailscale < Formula
|
|||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# 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 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
|
||||
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}"
|
||||
ldflags = prepare_ldflags
|
||||
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"
|
||||
|
@ -47,6 +28,31 @@ class Tailscale < Formula
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_ldflags
|
||||
ver_props = prepare_ver_props
|
||||
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}"
|
||||
"-X #{vl} -X #{vs} -X #{vgh}"
|
||||
end
|
||||
|
||||
def prepare_ver_props
|
||||
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).delete('"') # cuz version.sh emits each prop with double-quotes enclosing each val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
ver_props[key] = val
|
||||
end
|
||||
ver_props
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"run/tailscale").mkpath
|
||||
(var/"lib/tailscale").mkpath
|
||||
|
|
|
@ -20,26 +20,7 @@ class Tailscale < Formula
|
|||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# 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 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
|
||||
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}"
|
||||
ldflags = prepare_ldflags
|
||||
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"
|
||||
|
@ -47,6 +28,31 @@ class Tailscale < Formula
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_ldflags
|
||||
ver_props = prepare_ver_props
|
||||
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}"
|
||||
"-X #{vl} -X #{vs} -X #{vgh}"
|
||||
end
|
||||
|
||||
def prepare_ver_props
|
||||
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).delete('"') # cuz version.sh emits each prop with double-quotes enclosing each val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
ver_props[key] = val
|
||||
end
|
||||
ver_props
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"run/tailscale").mkpath
|
||||
(var/"lib/tailscale").mkpath
|
||||
|
|
|
@ -19,26 +19,7 @@ class Tailscale < Formula
|
|||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# 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 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
|
||||
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}"
|
||||
ldflags = prepare_ldflags
|
||||
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"
|
||||
|
@ -46,6 +27,31 @@ class Tailscale < Formula
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_ldflags
|
||||
ver_props = prepare_ver_props
|
||||
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}"
|
||||
"-X #{vl} -X #{vs} -X #{vgh}"
|
||||
end
|
||||
|
||||
def prepare_ver_props
|
||||
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).delete('"') # cuz version.sh emits each prop with double-quotes enclosing each val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
ver_props[key] = val
|
||||
end
|
||||
ver_props
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"run/tailscale").mkpath
|
||||
(var/"lib/tailscale").mkpath
|
||||
|
|
|
@ -19,26 +19,7 @@ class Tailscale < Formula
|
|||
tailscale_path.install buildpath.children
|
||||
cd tailscale_path do
|
||||
# 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 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
|
||||
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}"
|
||||
ldflags = prepare_ldflags
|
||||
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"
|
||||
|
@ -46,6 +27,31 @@ class Tailscale < Formula
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_ldflags
|
||||
ver_props = prepare_ver_props
|
||||
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}"
|
||||
"-X #{vl} -X #{vs} -X #{vgh}"
|
||||
end
|
||||
|
||||
def prepare_ver_props
|
||||
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).delete('"') # cuz version.sh emits each prop with double-quotes enclosing each val
|
||||
# system "echo adding to ver_props for go builds: key #{key}, val #{val}"
|
||||
ver_props[key] = val
|
||||
end
|
||||
ver_props
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"run/tailscale").mkpath
|
||||
(var/"lib/tailscale").mkpath
|
||||
|
|
Loading…
Reference in New Issue