remove gui
This commit is contained in:
parent
2f33fc8648
commit
87f53b432f
|
@ -2,11 +2,12 @@ VERSION = $(shell git describe --tags)
|
|||
GUIVERSION = $(shell git describe --tags)
|
||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||
|
||||
all: build
|
||||
all: goimports build
|
||||
|
||||
build:
|
||||
GO111MODULE=off go build \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
./testGui
|
||||
|
||||
vet:
|
||||
GO111MODULE=off go vet
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func listInstalledPackages() ([]string, error) {
|
||||
// Execute dpkg -l command
|
||||
cmd := exec.Command("dpkg", "-l")
|
||||
var out bytes.Buffer
|
||||
cmd.Stdout = &out
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Initialize slice to hold package names
|
||||
var packages []string
|
||||
scanner := bufio.NewScanner(&out)
|
||||
|
||||
// Skip the first five lines as they are headers in dpkg -l output
|
||||
for i := 0; i < 5 && scanner.Scan(); i++ {
|
||||
// Ignore header lines
|
||||
}
|
||||
|
||||
// Process each remaining line
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
fields := strings.Fields(line)
|
||||
|
||||
// Ensure the line has enough fields for parsing
|
||||
if len(fields) >= 2 {
|
||||
status := fields[0]
|
||||
packageName := fields[1]
|
||||
|
||||
// Only add packages with "ii" status (installed)
|
||||
if status == "ii" {
|
||||
packages = append(packages, packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return packages, nil
|
||||
}
|
103
testGui/main.go
103
testGui/main.go
|
@ -1,14 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.wit.com/log"
|
||||
"time"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// sent via -ldflags
|
||||
|
@ -17,87 +14,23 @@ var BUILDTIME string
|
|||
|
||||
func main() {
|
||||
me = new(autoType)
|
||||
|
||||
// load the ~/.config/forge/ config
|
||||
me.forge = forgepb.Init()
|
||||
me.forge.ConfigPrintTable()
|
||||
|
||||
// setup the GUI
|
||||
me.myGui = gui.New()
|
||||
me.myGui.Default()
|
||||
|
||||
me.repoList = repolist.Init(me.forge, me.myGui)
|
||||
me.repoList.Enable()
|
||||
|
||||
failed := make(map[*repolist.RepoRow]string)
|
||||
versions := make(map[*repolist.RepoRow]string)
|
||||
|
||||
rloop := me.repoList.ReposSortByName()
|
||||
for rloop.Scan() {
|
||||
repo := rloop.Repo()
|
||||
|
||||
repotype := repo.RepoType()
|
||||
if repotype != "binary" {
|
||||
// we only want to process golang binaries where package == 'main'
|
||||
// log.Info("skipping repo", repo.GoPath(), repotype)
|
||||
continue
|
||||
}
|
||||
// var cmd []string
|
||||
var start string
|
||||
var end string
|
||||
var alreadyBuilt bool
|
||||
ver := repo.Status.DebianReleaseVersion()
|
||||
name := me.forge.DebName(repo.GoPath())
|
||||
if me.forge.Machine.IsInstalled(name) {
|
||||
end += "(installed) "
|
||||
}
|
||||
if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
|
||||
end += " (version match) " + actualp.Version + " " + ver + " "
|
||||
alreadyBuilt = true
|
||||
} else {
|
||||
end += " (need to build) " + ver + " "
|
||||
}
|
||||
|
||||
if alreadyBuilt {
|
||||
start = fmt.Sprintf("already built %-30s %-8s %-50s", name, ver, repo.GoPath())
|
||||
} else {
|
||||
start = fmt.Sprintf("need to build %-30s %-8s %-50s", name, ver, repo.GoPath())
|
||||
}
|
||||
log.Info(start, "("+versions[repo]+")", end)
|
||||
if name == "" {
|
||||
// err := fmt.Sprintf("name is blank error %+v", repo)
|
||||
log.Warn("name is blank error", repo.GoPath())
|
||||
}
|
||||
|
||||
if argv.DryRun {
|
||||
continue
|
||||
}
|
||||
|
||||
// skip if already built. (unless --force)
|
||||
if alreadyBuilt {
|
||||
// don't rebuild things
|
||||
if argv.Force {
|
||||
// well, okay, force me to rebuild them then
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if repo.Status.IsPrivate() {
|
||||
// cmd = []string{"go-deb", "--auto", "--repo", repo.GoPath()}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
log.Info("")
|
||||
log.Info("something failed on:")
|
||||
var fail bool = true
|
||||
for repo, cmd := range failed {
|
||||
log.Info("failed cmd :", cmd, repo.Status.Path())
|
||||
fail = false
|
||||
}
|
||||
if fail {
|
||||
os.Exit(0)
|
||||
}
|
||||
os.Exit(-1)
|
||||
testLoad("nocui")
|
||||
testLoad("pixelgl")
|
||||
testLoad("gocui")
|
||||
testLoad("andlabs")
|
||||
testLoad("fyne")
|
||||
//testLoad("fail")
|
||||
}
|
||||
|
||||
func testLoad(name string) {
|
||||
if _, err := me.myGui.LoadToolkit(name); err == nil {
|
||||
} else {
|
||||
log.Warn("LoadToolkit() failed to load", name, "error:", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
time.Sleep(3 * time.Second)
|
||||
me.myGui.CloseToolkit(name)
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
)
|
||||
|
||||
var me *autoType
|
||||
|
@ -13,75 +10,4 @@ var me *autoType
|
|||
type autoType struct {
|
||||
// allrepos map[string]*repo
|
||||
myGui *gui.Node
|
||||
|
||||
mainWindow *gui.Node
|
||||
|
||||
// the main box. enable/disable this
|
||||
mainbox *gui.Node
|
||||
|
||||
// the window from the /lib/gui/gowit package
|
||||
lw *gadgets.BasicWindow
|
||||
|
||||
// our view of the repositories
|
||||
// repos *repoWindow
|
||||
repoList *repolist.RepoList
|
||||
|
||||
// your customized repo preferences and settings
|
||||
forge *forgepb.Forge
|
||||
|
||||
// where your ~/go/src is
|
||||
goSrcPath string
|
||||
|
||||
// use zookeeper to get the list of installed packages
|
||||
// machine zoopb.Machine
|
||||
|
||||
// #### autotypist Global Display Options
|
||||
autoHidePerfect *gui.Node
|
||||
autoHideReadOnly *gui.Node
|
||||
|
||||
// #### autotypist Global Build Options
|
||||
// what to change all the branches to
|
||||
// so, as a developer, you can move all the repos
|
||||
// to the 'devel' branch and then test a devel branch build
|
||||
// then switch back to your 'username' branch and do a build there
|
||||
toMoveToBranch string
|
||||
|
||||
// this button will regenerate everyones go.mod & go.sum
|
||||
rerunGoMod *gui.Node
|
||||
|
||||
// if checked, will stop trying to os.Exec() things after failure
|
||||
stopOnErrors *gui.Node
|
||||
|
||||
// button to attempt to autorebuild
|
||||
autoRebuildButton *gui.Node
|
||||
|
||||
// checkbox for --dry-run
|
||||
autoDryRun *gui.Node
|
||||
|
||||
// checkbox to enable intermittent scanning
|
||||
// if checked, it will check all your repos for changes
|
||||
autoScanReposCB *gui.Node
|
||||
|
||||
// what is being used as your home dir
|
||||
userHomePwd *gadgets.OneLiner
|
||||
|
||||
// what is being used as ~/go/src
|
||||
goSrcPwd *gadgets.OneLiner
|
||||
|
||||
downloadEverythingButton *gui.Node
|
||||
|
||||
// delete ~/go/src & ~/go/pkg buttons
|
||||
deleteGoSrcPkgB *gui.Node
|
||||
|
||||
// displays a summary of all the repos
|
||||
// has total dirty, total read-only
|
||||
// total patches, etc
|
||||
// summary *patchSummary
|
||||
|
||||
// when switch to user or devel branches, autocreate them
|
||||
autoCreateBranches *gui.Node
|
||||
|
||||
// make a concept called a 'mode' that means which branches
|
||||
// are you working from: "master"? "devel"? <username>?
|
||||
newMode *gui.Node
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue