try to fix 'release' builds

This commit is contained in:
Jeff Carr 2025-02-14 17:11:48 -06:00
parent da425cfb0f
commit 31eac3d915
2 changed files with 23 additions and 19 deletions

View File

@ -3,8 +3,11 @@
VERSION = $(shell git describe --tags)
DATE = $(shell date +%Y.%m.%d)
run: build
./go-deb --forge go.wit.com/apps/autotypist
run: install
go-deb --release --no-gui --auto --forge go.wit.com/apps/autogenpb --dir ${HOME}/incoming
go-deb --release --no-gui --auto --forge go.wit.com/apps/go-mod-clean --dir ${HOME}/incoming
@#go-deb --forge go.wit.com/apps/autotypist --no-gui --auto
ls -lth ${HOME}/incoming
vet:
@GO111MODULE=off go vet
@ -13,7 +16,7 @@ vet:
auto-build: build
./go-deb --auto --repo go.wit.com/apps/autotypist
build: goimports
build: goimports vet
-rm resources/*.so
touch resources/blank.so
GO111MODULE="off" go build -v \

View File

@ -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")