From 4c9be65abab732007da25859691a2467adc441a2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Jun 2019 10:56:04 -0700 Subject: [PATCH] stupid. really stupid. of course that code doesn't run in main() Signed-off-by: Jeff Carr --- Makefile | 7 ------- autobuild/autobuild.go | 13 ++++++++++--- main.go | 10 ++++++---- resources/tags/v0.6.25 | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 resources/tags/v0.6.25 diff --git a/Makefile b/Makefile index d3e96b4..63199ee 100644 --- a/Makefile +++ b/Makefile @@ -49,16 +49,9 @@ push: tag-version: # git push --delete origin v0.6.15 # to delete a tag upstream - -rm cloud-control-panel - go build git tag v${VERSION} git push --tags cp .git/refs/tags/v${VERSION} resources/tags/ -// scp resources/VERSION root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/ -// scp resources/BUILDDATE root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/ -// scp cloud-control-panel root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/ -// scp cloud-control-panel root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/cloud-control-panel-v${VERSION} -// scp README root@mirrors.wit.com:/data/mirrors/cloud/control-panel/ # should update every go dependancy (?) update: diff --git a/autobuild/autobuild.go b/autobuild/autobuild.go index 2cfb9d6..0370de8 100644 --- a/autobuild/autobuild.go +++ b/autobuild/autobuild.go @@ -5,6 +5,7 @@ package main // upload binary to mirrors.wit.com/cloud/control-panel import "log" +import "fmt" import "time" import "strings" import "os/user" @@ -15,7 +16,6 @@ import "github.com/davecgh/go-spew/spew" import "git.wit.com/wit/shell" -// import "fmt" // import "os/user" // import "io/ioutil" // github.com/bramvdbogaerde/go-scp @@ -91,9 +91,16 @@ func build(tag string) *bool { // os.Exit(-1) // return nil } - shell.Run("rm cloud-control-panel") + + // setup the files that will end up in the binary + epoch := fmt.Sprintf("%d", time.Now().Unix()) + shell.Write("./resources/BUILDDATE", epoch) + shell.Write("./resources/BUILDREF", gitref) + + // rebuild the binary (always remove the old one + shell.Run("rm " + filename) shell.Run("go build") - md5sum = shell.Run("md5sum cloud-control-panel") + md5sum = shell.Run("md5sum " + filename) log.Println("\tmd5sum =", md5sum) if (md5sum == "") { diff --git a/main.go b/main.go index b6042a3..be30da1 100644 --- a/main.go +++ b/main.go @@ -95,11 +95,13 @@ func lookupAAAA(hostname string) string { func main() { go handleErrors() - epoch := fmt.Sprintf("%d", time.Now().Unix()) - shell.Write("./resources/BUILDDATE", epoch) + // OMG I'm an idiot. of course this does't work + // it's easy to loose your mind trying to make this part of the code work +// epoch := fmt.Sprintf("%d", time.Now().Unix()) +// shell.Write("./resources/BUILDDATE", epoch) - ref := shell.Run("git rev-list -1 HEAD") - shell.Write("./resources/BUILDREF", ref) +// ref := shell.Run("git rev-list -1 HEAD") +// shell.Write("./resources/BUILDREF", ref) // for {} // This puts all the files in that directory in the binary diff --git a/resources/tags/v0.6.25 b/resources/tags/v0.6.25 new file mode 100644 index 0000000..4289e9a --- /dev/null +++ b/resources/tags/v0.6.25 @@ -0,0 +1 @@ +2ba4c6e6ee8042e87d97d724caea8df1ac69d26b