fix build with zoopb out of forge

This commit is contained in:
Jeff Carr 2025-02-22 07:17:13 -06:00
parent 84c772dc41
commit d687de6c04
7 changed files with 47 additions and 23 deletions

View File

@ -19,6 +19,7 @@ var argv args
type args struct {
TestBuild *EmptyCmd `arg:"subcommand:build" help:"try appropriate 'go build'"`
DebBuild *EmptyCmd `arg:"subcommand:debian" help:"build missing .deb packages"`
MacBuild *EmptyCmd `arg:"subcommand:macos" help:"build macos packages"`
MakeInstall *EmptyCmd `arg:"subcommand:install" help:"run make install in each repo"`
ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"`
Clone *EmptyCmd `arg:"subcommand:repomap-clone" help:"go-clone from a gowebd repomap"`

View File

@ -22,11 +22,11 @@ func doAptUpgrade() {
}
fmt.Println("Installed Packages:")
loop := me.forge.Machine.Wit.SortByName()
loop := me.machine.Wit.SortByName()
for loop.Scan() {
p := loop.Next()
// log.Info("apt install", name)
if me.forge.Machine.IsInstalled(p.Name) {
if me.machine.IsInstalled(p.Name) {
cmd := []string{"apt", "install", p.Name}
if argv.DryRun {
log.Info("--dry-run", cmd)
@ -43,7 +43,7 @@ func doAptList() {
log.DaemonMode(true)
defer log.DaemonMode(false)
fmt.Println("Installed Packages:")
loop := me.forge.Machine.Wit.SortByName()
loop := me.machine.Wit.SortByName()
for loop.Scan() {
p := loop.Next()
var end string
@ -51,12 +51,12 @@ func doAptList() {
if me.forge.Config.IsPrivate(p.Name) {
end += "(private) "
}
if actualp := me.forge.Machine.FindVersion(p.Name, p.Version); actualp != nil {
if actualp := me.machine.FindVersion(p.Name, p.Version); actualp != nil {
// end += "(version match) "
} else {
end += "(version mismatch) " + actualp.Version + " " + version + " "
}
if actualp := me.forge.Machine.FindInstalledByName(p.Name); actualp != nil {
if actualp := me.machine.FindInstalledByName(p.Name); actualp != nil {
if p.Version != actualp.Version {
end += "(installed " + actualp.Version + " vs " + p.Version + ") "
} else {

View File

@ -67,6 +67,20 @@ func buildDeb() {
}
}
/*
build-darwin:
GOOS=darwin GOARCH=amd64 GO111MODULE=off go build -v -o go-clone-darwin.x86 \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
build-darwin-arm64:
GOOS=darwin GOARCH=arm64 GO111MODULE=off go build -v -o go-clone-darwin.arm \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
*/
if argv.MacBuild != nil {
log.Info("todo: add mac builds")
continue
}
/*
_, err := os.Stat(filepath.Join(outdir, debnames[check]))
if err == nil {

View File

@ -41,10 +41,10 @@ func doInstall() error {
ver := trimNonNumericFromStart(manufactured)
name := me.forge.Config.DebName(check.GetGoPath())
var realver string
if installedPackage := me.forge.Machine.FindInstalledByName(name); installedPackage != nil {
if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil {
realver = installedPackage.Version
}
if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
if actualp := me.machine.FindVersion(name, ver); actualp != nil {
end += " (version match) " + actualp.Version + " " + ver + " "
state[check] = "on mirrors"
} else {
@ -53,8 +53,8 @@ func doInstall() error {
}
// end += "" + ver + " "
}
if me.forge.Machine.IsInstalled(name) {
if actualp := me.forge.Machine.FindInstalledByName(name); actualp != nil {
if me.machine.IsInstalled(name) {
if actualp := me.machine.FindInstalledByName(name); actualp != nil {
if ver != actualp.Version {
end += "(installed " + actualp.Version + ") "
} else {

View File

@ -40,10 +40,10 @@ func doListRepos() {
ver := trimNonNumericFromStart(manufactured)
name := me.forge.Config.DebName(check.GetGoPath())
var realver string
if installedPackage := me.forge.Machine.FindInstalledByName(name); installedPackage != nil {
if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil {
realver = installedPackage.Version
}
if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
if actualp := me.machine.FindVersion(name, ver); actualp != nil {
end += " (version match) " + actualp.Version + " " + ver + " "
state[check] = "on mirrors"
} else {
@ -52,8 +52,8 @@ func doListRepos() {
}
// end += "" + ver + " "
}
if me.forge.Machine.IsInstalled(name) {
if actualp := me.forge.Machine.FindInstalledByName(name); actualp != nil {
if me.machine.IsInstalled(name) {
if actualp := me.machine.FindInstalledByName(name); actualp != nil {
if ver != actualp.Version {
end += "(installed " + actualp.Version + ") "
} else {

21
main.go
View File

@ -15,6 +15,7 @@ import (
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
)
@ -47,6 +48,12 @@ func main() {
// load the ~/.config/forge/ config
me.forge = forgepb.Init()
me.machine = new(zoopb.Machine)
if err := me.machine.ConfigLoad(); err != nil {
log.Info("zoopb.ConfigLoad() failed", err)
}
me.machine.InitWit()
me.myGui = gui.New()
me.myGui.Default()
@ -71,7 +78,7 @@ func main() {
log.DaemonMode(true)
defer log.DaemonMode(false)
fmt.Println("Installed Packages:")
loop := me.forge.Machine.Wit.SortByName()
loop := me.machine.Wit.SortByName()
for loop.Scan() {
p := loop.Next()
var end string
@ -79,12 +86,12 @@ func main() {
if me.forge.Config.IsPrivate(p.Name) {
end += "(private) "
}
if actualp := me.forge.Machine.FindVersion(p.Name, p.Version); actualp != nil {
if actualp := me.machine.FindVersion(p.Name, p.Version); actualp != nil {
// end += "(version match) "
} else {
end += "(version mismatch) " + actualp.Version + " " + version + " "
}
if actualp := me.forge.Machine.FindInstalledByName(p.Name); actualp != nil {
if actualp := me.machine.FindInstalledByName(p.Name); actualp != nil {
if p.Version != actualp.Version {
end += "(installed " + actualp.Version + " vs " + p.Version + ") "
} else {
@ -163,10 +170,10 @@ func main() {
ver := trimNonNumericFromStart(manufactured)
name := me.forge.Config.DebName(check.GetGoPath())
var realver string
if installedPackage := me.forge.Machine.FindInstalledByName(name); installedPackage != nil {
if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil {
realver = installedPackage.Version
}
if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
if actualp := me.machine.FindVersion(name, ver); actualp != nil {
end += " (version match) " + actualp.Version + " " + ver + " "
state[check] = "on mirrors"
} else {
@ -175,8 +182,8 @@ func main() {
}
// end += "" + ver + " "
}
if me.forge.Machine.IsInstalled(name) {
if actualp := me.forge.Machine.FindInstalledByName(name); actualp != nil {
if me.machine.IsInstalled(name) {
if actualp := me.machine.FindInstalledByName(name); actualp != nil {
if ver != actualp.Version {
end += "(installed " + actualp.Version + ") "
} else {

View File

@ -7,13 +7,15 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/zoopb"
)
var me *autoType
// this app's variables
type autoType struct {
argpp *arg.Parser // go-arg preprocessor
myGui *gui.Node // the gui handle
forge *forgepb.Forge // your customized repo preferences and settings
argpp *arg.Parser // go-arg preprocessor
myGui *gui.Node // the gui handle
forge *forgepb.Forge // your customized repo preferences and settings
machine *zoopb.Machine // your customized repo preferences and settings
}