summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-14 10:46:26 -0500
committerJeff Carr <[email protected]>2025-10-14 10:46:26 -0500
commit87cb75966a79788f7c6192c0397b92c09114b104 (patch)
treea6888c955c107166ebfc90fc3f6ec60ac1b7b34f
parentbaebea24dd4c7bbbbef2b1aaa7c230e43cacf4e4 (diff)
riscv64 builds should workv0.22.164
-rw-r--r--Makefile35
-rw-r--r--argv.go1
-rw-r--r--build.go18
-rw-r--r--control12
-rw-r--r--control.read.go45
-rw-r--r--control.write.go13
-rw-r--r--main.go8
-rw-r--r--structs.go15
-rw-r--r--update.go2
9 files changed, 50 insertions, 99 deletions
diff --git a/Makefile b/Makefile
index 7711947..114658c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,25 @@
-.PHONY: debian go-deb
+.PHONY: build
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)
run: clean goimports vet install
- go-deb
+ go-deb --keep-files --arch riscv64
# builds a .deb of go-deb and writes the file here in this directory
-go-deb:
+deb.default:
go-deb
-go-deb-keep-files:
+deb.riscv64:
+ go-deb --keep-files --arch riscv64
+
+deb.keep-files:
go-deb --keep-files
vet:
@GO111MODULE=off go vet
@echo this go library package builds okay
-auto-build: build
- ./go-deb --repo go.wit.com/apps/autotypist
-
build: goimports vet
-rm resources/*.so
touch resources/blank.so
@@ -64,24 +64,7 @@ nocui: reset build
clean:
rm -f go.*
- rm -f go-deb
+ rm -f go-deb*
+ rm -rf files/
rm -f resources/*.so
touch resources/blank.so
-
-build-go-gui-toolkits: build
- ./go-deb --release
-
-build-test-failure: build
- ./go-deb --release
-
-build-test-keep-files: build
- ./go-deb --keep-files
-
-build-release:
- go-deb --release
-
-debian: build
- ./go-deb --keep-files
-
-test2:
- go-deb go.wit.com/apps/utils/go-gui-toolkits --dir /tmp
diff --git a/argv.go b/argv.go
index d658155..62017fd 100644
--- a/argv.go
+++ b/argv.go
@@ -19,6 +19,7 @@ type args struct {
Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
OutDir string `arg:"--dir" help:"write .deb file into this directory"`
Namespace string `arg:"--namespace" help:"the namespace of the repo"`
+ Arch string `arg:"--arch" help:"what arch"`
KeepFiles bool `arg:"--keep-files" help:"keep the build files/"`
Release bool `arg:"--release" help:"build version from the @latest git tag"`
Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"`
diff --git a/build.go b/build.go
index 72b1174..13bafde 100644
--- a/build.go
+++ b/build.go
@@ -29,10 +29,10 @@ func buildPackage(repo *gitpb.Repo) (bool, error) {
arch := repo.Control["Architecture"] // c.Architecture.String()
if arch == "" {
- arch = "amd64" // todo: detect what you are building on
+ arch = argv.Arch
}
const layout = "200601021504"
- now := time.Now()
+ now := time.Now().UTC()
version := repo.Control["Version"] + "-" + now.Format(layout)
repo.Control["Version"] = version
log.Info("version is:", version)
@@ -101,6 +101,10 @@ func buildPackage(repo *gitpb.Repo) (bool, error) {
} else {
// set the GO111 build var to true. pass the versions to the compiler manually
os.Setenv("GO111MODULE", "off")
+ if argv.Arch == "riscv64" {
+ os.Setenv("GOARCH", "riscv64")
+ // GOOS=windows GOARCH=amd64 GO111MODULE=off go build -v -o wit.exe \
+ }
cmd := []string{"go", "build"}
// set standard ldflag options
now := time.Now()
@@ -181,10 +185,12 @@ func buildPackage(repo *gitpb.Repo) (bool, error) {
log.Warn("cp failed")
return false, err
}
- cmd = []string{"strip", "files/usr/bin/" + fname}
- if err := repo.RunVerbose(cmd); err != nil {
- log.Warn("strip failed")
- return false, err
+ if argv.Arch == "amd64" {
+ cmd = []string{"strip", "files/usr/bin/" + fname}
+ if err := repo.RunVerbose(cmd); err != nil {
+ log.Warn("strip failed")
+ return false, err
+ }
}
}
diff --git a/control b/control
index 0ff619e..a232680 100644
--- a/control
+++ b/control
@@ -3,14 +3,8 @@ Build-Depends: golang
Package: go-deb
Maintainer: Jeff Carr <[email protected]>
Packager: Jeff Carr <[email protected]>
-Architecture: amd64
Depends: go-gui-toolkits
-URL: https://go.wit.com/
+Namespace: go.wit.com/apps/go-deb
Recommends:
-Conflicts: testingoldstuff
-Description: create distribution packages for golang repositories
- Hopefully, this can make compatible and correct source
- packages for things like debuild or the incoming queue since
- golang applications are more strict then the traditional C
- libraries and binaries that require lots of scripting.
- A person can dream anyway.
+Description: create .deb packages for anything
+ A person can dream anyway. Examples in the sources.
diff --git a/control.read.go b/control.read.go
index d6a4c0d..ee0673a 100644
--- a/control.read.go
+++ b/control.read.go
@@ -35,7 +35,7 @@ func readControlFile(repo *gitpb.Repo) error {
log.Warn("readControlFile() could not find the file")
// return errors.New("'control': file not found")
// if this happens, make up a fake control file
- pairs["Architecture"] = "amd64" // TODO: figure this out
+ pairs["Architecture"] = argv.Arch
pairs["Recommends"] = ""
pairs["Source"] = "notsure"
if me.repo == nil {
@@ -93,49 +93,8 @@ func readControlFile(repo *gitpb.Repo) error {
}
for key, value := range pairs {
repo.Control[key] = value
- /*
- switch key {
- case "Source":
- c.Source.SetText(value)
- case "Build-Depends":
- c.BuildDepends.SetText(value)
- case "Description":
- c.Description.SetText(value)
- case "Maintainer":
- c.Maintainer.SetText(value)
- case "Packager":
- c.Packager.SetText(value)
- case "GoPath":
- c.GoPath.SetText(value)
- case "URL":
- c.URL.SetText(value)
- case "Depends":
- c.Depends.SetText(value)
- case "Recommends":
- c.Recommends.SetText(value)
- case "Conflicts":
- c.Conflicts.SetText(value)
- case "Version":
- c.Version.SetText(value)
- case "Package":
- c.Package.SetText(value)
- // if c.Package.String() != value {
- // log.Warn("not sure what to do with Package", c.Package.String(), value)
- // }
- case "Architecture":
- // todo: add logic to find OS arch
- if c.Architecture.String() != value {
- log.Warn("attempting to set arch to", value)
- c.Architecture.SetText(value)
-
- }
- default:
- log.Warn("the 'control' file has a value I don't know about")
- log.Warn("error unknown key", key, "value:", value)
- }
- */
}
- pairs["Architecture"] = "amd64" // TODO: figure this out
+ pairs["Architecture"] = argv.Arch
if err := scanner.Err(); err != nil {
return err
diff --git a/control.write.go b/control.write.go
index 358774d..2ee4cad 100644
--- a/control.write.go
+++ b/control.write.go
@@ -3,11 +3,10 @@ package main
import (
"fmt"
"os"
- "strconv"
"strings"
"time"
- "github.com/go-cmd/cmd"
+ "go.wit.com/lib/cobol"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -52,7 +51,7 @@ func writeDebianControlFile(repo *gitpb.Repo) bool {
// fmt.Fprintln(cf, "Source:", repo.Control["Source"]) // c.Source.String())
fmt.Fprintln(cf, "Version:", repo.Control["Version"])
if repo.Control["Architecture"] == "" {
- repo.Control["Architecture"] = "amd64"
+ repo.Control["Architecture"] = argv.Arch
}
fmt.Fprintln(cf, "Architecture:", repo.Control["Architecture"]) // c.Architecture.String())
@@ -65,10 +64,10 @@ func writeDebianControlFile(repo *gitpb.Repo) bool {
writeControlVar(cf, repo, "GoPath")
writeControlVar(cf, repo, "URL")
- stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
+ t := time.Now()
// update to now now despite what the GUI is showing
- fmt.Fprintln(cf, "Package-Build-Date:", stamp)
- fmt.Fprintln(cf, "Git-Tag-Date:", "todo: get from repo")
+ fmt.Fprintln(cf, "Package-Build-Date:", cobol.Time(t))
+ fmt.Fprintln(cf, "Git-Tag-Date:", "go-deb todo: get this from git")
desc, _ := repo.Control["Description"] // c.Description.String()
parts := strings.Split(desc, "\n")
@@ -118,6 +117,7 @@ func computeControlValues(repo *gitpb.Repo) bool {
return true
}
+/*
// stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
func getDateStamp(tag string) string {
@@ -138,3 +138,4 @@ func getDateStamp(tag string) string {
gitTagDate := time.Unix(gitTagTimestampInt, 0)
return gitTagDate.UTC().Format("2006-01-02_15:04:05_UTC") // close to RFC3339
}
+*/
diff --git a/main.go b/main.go
index 7d86cc8..ce49aa6 100644
--- a/main.go
+++ b/main.go
@@ -23,14 +23,18 @@ var argv args
func main() {
me = new(mainType)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
+ me.sh = prep.Autocomplete(&argv) // adds shell auto complete to go-args
wd, err := os.Getwd()
if err != nil {
badExit(err)
}
+ if argv.Arch == "" {
+ // looking forward to the day when this default is "riscv64"
+ argv.Arch = "amd64"
+ }
+
me.repo, err = gitpb.NewRepo(wd)
if err != nil {
badExit(err)
diff --git a/structs.go b/structs.go
index 9f70897..f7926da 100644
--- a/structs.go
+++ b/structs.go
@@ -2,6 +2,7 @@ package main
import (
"go.wit.com/gui"
+ "go.wit.com/lib/fhelp"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/gitpb"
@@ -11,12 +12,14 @@ var me *mainType
// this app's variables
type mainType struct {
- auto *prep.Auto // more experiments for bash handling
- goSrc string // path to ~/go/src or go.work file
- goPath string // the goPath to use for the package
- hasWork bool // true if using go.work file
- repo *gitpb.Repo // this is the repo we are in
- myGui *prep.GuiPrep // the gui toolkit handle
+ sh *prep.Auto // more experiments for bash handling
+ myGui *fhelp.GuiPrep // the gui handle itself
+ origGui *gui.Node // the gui handle itself
+
+ goSrc string // path to ~/go/src or go.work file
+ goPath string // the goPath to use for the package
+ hasWork bool // true if using go.work file
+ repo *gitpb.Repo // this is the repo we are in
}
type controlBox struct {
diff --git a/update.go b/update.go
index b8b67b3..eadda10 100644
--- a/update.go
+++ b/update.go
@@ -12,5 +12,5 @@ func updateControl(c *controlBox) {
c.Depends.SetText(me.repo.Control["Depends"])
c.Recommends.SetText(me.repo.Control["Recommends"])
- c.Architecture.SetText("amd64")
+ c.Architecture.SetText(argv.Arch)
}