diff options
Diffstat (limited to 'buildPackage.go')
| -rw-r--r-- | buildPackage.go | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/buildPackage.go b/buildPackage.go index 642dd29..29e98c4 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -71,18 +71,22 @@ func (c *controlBox) buildPackage() (bool, error) { if argv.Release { os.Unsetenv("GO111MODULE") - path := c.pathL.String() + "@latest" - cmd := []string{"go", "install", "-v", "-x", path} - if r := shell.Run(cmd); r.Error == nil { - log.Warn("go install worked") - } else { - return false, errors.New("go install") + cmd := []string{"forge", "--verbose", "--install", argv.Forge} + if err := shell.PathExecVerbose("", cmd); err != nil { + badExit(err) + return false, fmt.Errorf("go build err %v", err) + } + // must 'go install' then 'go build' so they are both in ~/go/src and in the repo dir + cmd = []string{"forge", "--verbose", "--build", argv.Forge} + if err := shell.PathExecVerbose("", cmd); err != nil { + badExit(err) + return false, fmt.Errorf("go build err %v", err) } + log.Warn("forge build worked") } else { // set the GO111 build var to true. pass the versions to the compiler manually os.Setenv("GO111MODULE", "off") cmd := []string{"go", "build"} - // set standard ldflag options now := time.Now() datestamp := now.UTC().Format("2006/01/02_1504_UTC") @@ -100,12 +104,9 @@ func (c *controlBox) buildPackage() (bool, error) { cmd = append(cmd, "-ldflags", "-X "+flag) } - r := shell.Run(cmd) - if r.Exit != 0 { - return false, errors.New("go build") - } - if r.Error != nil { - return false, errors.New("go build") + _, err := shell.RunVerbose(cmd) + if err != nil { + return false, fmt.Errorf("go build err %v", err) } log.Warn("go build worked") } @@ -126,7 +127,7 @@ func (c *controlBox) buildPackage() (bool, error) { if shell.Exists("files") { shell.Run([]string{"rm", "-rf", "files"}) - log.Info("running sync") + // log.Info("running sync") shell.Run([]string{"sync"}) if shell.Exists("files") { log.Warn("rm failed for some reason") @@ -196,7 +197,7 @@ func (c *controlBox) buildPackage() (bool, error) { shell.Run([]string{"dpkg-deb", "--build", "files", fulldebname}) if shell.Exists(fulldebname) { } else { - log.Warn("build failed") + log.Warn("build failed", fulldebname) return false, errors.New("dpkg-deb --build failed") } shell.Run([]string{"dpkg-deb", "-I", fulldebname}) @@ -208,7 +209,7 @@ func (c *controlBox) buildPackage() (bool, error) { log.Info("keeping the build files/") } else { shell.Run([]string{"rm", "-rf", "files"}) - log.Info("running sync") + // log.Info("running sync") shell.Run([]string{"sync"}) if shell.Exists("files") { log.Warn("rm -rf files/ failed. Run() returned false") |
