start developing this for real
This commit is contained in:
parent
8afc4c7135
commit
3895519f25
27
Makefile
27
Makefile
|
@ -1,8 +1,12 @@
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
all: build
|
all: vet build
|
||||||
./forge
|
./forge -h
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@GO111MODULE=off go vet
|
||||||
|
@echo this go binary package builds okay
|
||||||
|
|
||||||
build:
|
build:
|
||||||
GO111MODULE=off go build \
|
GO111MODULE=off go build \
|
||||||
|
@ -16,22 +20,13 @@ install:
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
only-me: build
|
|
||||||
reset
|
|
||||||
./forge --only-me
|
|
||||||
|
|
||||||
stderr: build
|
|
||||||
echo "writing to /tmp/forge.log"
|
|
||||||
./forge >/tmp/forge.log 2>&1
|
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
@# // to globally reset paths:
|
@# // to globally reset paths:
|
||||||
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
||||||
|
|
||||||
gocui: build
|
gocui: build
|
||||||
reset
|
./forge --gui gocui
|
||||||
./forge --gui gocui >/tmp/forge.log 2>&1
|
|
||||||
|
|
||||||
check-git-clean:
|
check-git-clean:
|
||||||
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
||||||
|
@ -41,3 +36,11 @@ redomod:
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
|
|
||||||
|
list: build
|
||||||
|
./forge --list
|
||||||
|
|
||||||
|
list-config: build
|
||||||
|
./forge --list-conf
|
||||||
|
|
||||||
|
mine: build
|
||||||
|
./forge --mine
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
this parses the command line arguements
|
||||||
|
*/
|
||||||
|
|
||||||
|
var argv args
|
||||||
|
|
||||||
|
type args struct {
|
||||||
|
List bool `arg:"--list" help:"list found repos"`
|
||||||
|
ListConf bool `arg:"--list-conf" help:"list your .config/forge/ configuration"`
|
||||||
|
GetMine bool `arg:"--mine" help:"download private and writeable repos"`
|
||||||
|
GetFav bool `arg:"--favorites" help:"download repos marked as favorites"`
|
||||||
|
Pull bool `arg:"--git-pull" help:"run 'git pull' on all your repos"`
|
||||||
|
Build bool `arg:"--build" default:"true" help:"also try to build it"`
|
||||||
|
Install bool `arg:"--install" help:"try to install every binary package"`
|
||||||
|
RedoGoMod bool `arg:"--go-reset" help:"remake all the go.sum and go.mod files"`
|
||||||
|
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (args) Version() string {
|
||||||
|
return "forge " + VERSION + " Built on " + BUILDTIME
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a args) Description() string {
|
||||||
|
return `
|
||||||
|
forge -- in the spirit of things like sourceforge
|
||||||
|
|
||||||
|
Repository configuration is stored in .config/forge/forge.text
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
forge --list # list found repos
|
||||||
|
forge --mine # download your private and writable repos
|
||||||
|
forge --favorites # clone repos you marked as favorites
|
||||||
|
forge --git-pull # run 'git pull' in every repo
|
||||||
|
forge --build # build every binary package
|
||||||
|
forge --install # install every binary package
|
||||||
|
`
|
||||||
|
}
|
|
@ -7,19 +7,12 @@ package main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
"go.wit.com/lib/debugger"
|
"go.wit.com/lib/debugger"
|
||||||
"go.wit.com/lib/gui/logsettings"
|
"go.wit.com/lib/gui/logsettings"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var args struct {
|
|
||||||
OnlyMe bool `arg:"--only-me" help:"only scan repos from ~/.config/submitpatchsets`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
arg.MustParse(&args)
|
|
||||||
|
|
||||||
if debugger.ArgDebug() {
|
if debugger.ArgDebug() {
|
||||||
log.Info("cmd line --debugger == true")
|
log.Info("cmd line --debugger == true")
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
// this initializes the repos
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gui/repostatus"
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *repoWindow) initRepoList() {
|
|
||||||
r.View.InitRepoList(".config/autotypist")
|
|
||||||
|
|
||||||
if args.OnlyMe {
|
|
||||||
log.Info("not scanning everything")
|
|
||||||
} else {
|
|
||||||
log.Info("scanning everything in ~/go/src")
|
|
||||||
for i, path := range repostatus.ListGitDirectories() {
|
|
||||||
// log.Info("addRepo()", i, path)
|
|
||||||
path = strings.TrimPrefix(path, me.goSrcPwd.String())
|
|
||||||
path = strings.Trim(path, "/")
|
|
||||||
log.Info("addRepo()", i, path)
|
|
||||||
r.View.NewRepo(path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func list() {
|
||||||
|
if argv.ListConf {
|
||||||
|
me.forge.ConfigPrintTable()
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.List {
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if !repo.IsValid() {
|
||||||
|
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Printf("%10s %-50s", repo.RepoType(), repo.GetGoPath())
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.GetMine {
|
||||||
|
log.Printf("get mine %s", me.forge.GetGoSrc())
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.GetFav {
|
||||||
|
log.Printf("get favorites")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
}
|
30
main.go
30
main.go
|
@ -3,25 +3,40 @@ package main
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// sent via -ldflags
|
||||||
|
var VERSION string
|
||||||
|
var BUILDTIME string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(mainType)
|
me = new(mainType)
|
||||||
|
me.pp = arg.MustParse(&argv)
|
||||||
|
|
||||||
me.myGui = gui.New().Default()
|
// load the ~/.config/forge/ config
|
||||||
|
me.forge = forgepb.Init()
|
||||||
|
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
|
||||||
|
|
||||||
|
// processes any --list like options
|
||||||
|
// may exit
|
||||||
|
list()
|
||||||
|
|
||||||
|
me.myGui = gui.New()
|
||||||
|
me.myGui.Default()
|
||||||
|
|
||||||
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
|
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
|
||||||
me.mainWindow.Make()
|
me.mainWindow.Make()
|
||||||
me.mainWindow.Show()
|
me.mainWindow.Show()
|
||||||
me.mainbox = me.mainWindow.Box()
|
me.mainbox = me.mainWindow.Box()
|
||||||
|
|
||||||
vbox1 := me.mainbox.NewVerticalBox("BOX1")
|
|
||||||
globalDisplayOptions(vbox1)
|
|
||||||
|
|
||||||
// disable the interface while everything is scanned
|
// disable the interface while everything is scanned
|
||||||
me.Disable()
|
me.Disable()
|
||||||
|
|
||||||
|
@ -31,13 +46,6 @@ func main() {
|
||||||
|
|
||||||
me.repos = makeRepoView()
|
me.repos = makeRepoView()
|
||||||
|
|
||||||
// parse config file and scan for .git repos
|
|
||||||
me.repos.initRepoList()
|
|
||||||
|
|
||||||
// reads in the State of all the repos
|
|
||||||
// TODO: should not really be necessary directly after init()
|
|
||||||
me.repos.View.ScanRepositories()
|
|
||||||
|
|
||||||
// processing is done. update the repo summary box
|
// processing is done. update the repo summary box
|
||||||
me.summary.Update()
|
me.summary.Update()
|
||||||
|
|
||||||
|
|
70
repoview.go
70
repoview.go
|
@ -54,39 +54,25 @@ func makeRepoView() *repoWindow {
|
||||||
log.Warn("Should I do something special here?")
|
log.Warn("Should I do something special here?")
|
||||||
}
|
}
|
||||||
|
|
||||||
r.topbox = r.repoAllButtons()
|
r.topbox = r.repoMenu()
|
||||||
|
|
||||||
|
r.View = repolist.InitBox(me.forge, r.box)
|
||||||
|
r.View.Enable()
|
||||||
|
|
||||||
|
r.View.ScanRepositories()
|
||||||
|
|
||||||
|
/*
|
||||||
r.View = repolist.AutotypistView(r.box)
|
r.View = repolist.AutotypistView(r.box)
|
||||||
|
|
||||||
showncount := r.View.MirrorShownCount()
|
showncount := r.View.MirrorShownCount()
|
||||||
r.topbox.Append(showncount)
|
r.topbox.Append(showncount)
|
||||||
duration := r.View.MirrorScanDuration()
|
duration := r.View.MirrorScanDuration()
|
||||||
r.topbox.Append(duration)
|
r.topbox.Append(duration)
|
||||||
|
*/
|
||||||
r.View.RegisterHideFunction(hideFunction)
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repoWindow) showApps() {
|
func (r *repoWindow) repoMenu() *gui.Node {
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
switch repo.Status.RepoType() {
|
|
||||||
case "binary":
|
|
||||||
//log.Info("compile here. Show()")
|
|
||||||
repo.Show()
|
|
||||||
case "library":
|
|
||||||
//log.Info("library here. Hide()")
|
|
||||||
repo.Hide()
|
|
||||||
default:
|
|
||||||
log.Info("showApps() unknown. Show()")
|
|
||||||
repo.Hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *repoWindow) repoAllButtons() *gui.Node {
|
|
||||||
// reposbox.SetExpand(false)
|
// reposbox.SetExpand(false)
|
||||||
group1 := r.box.NewGroup("Run on all repos:")
|
group1 := r.box.NewGroup("Run on all repos:")
|
||||||
|
|
||||||
|
@ -95,6 +81,7 @@ func (r *repoWindow) repoAllButtons() *gui.Node {
|
||||||
hbox.Vertical()
|
hbox.Vertical()
|
||||||
|
|
||||||
box2 := hbox.Box().Vertical()
|
box2 := hbox.Box().Vertical()
|
||||||
|
/*
|
||||||
box2.NewButton("merge all user to devel", func() {
|
box2.NewButton("merge all user to devel", func() {
|
||||||
r.Disable()
|
r.Disable()
|
||||||
if !r.mergeAllUserToDevel() {
|
if !r.mergeAllUserToDevel() {
|
||||||
|
@ -110,6 +97,7 @@ func (r *repoWindow) repoAllButtons() *gui.Node {
|
||||||
}
|
}
|
||||||
r.Enable()
|
r.Enable()
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
box2.NewButton("merge it all", func() {
|
box2.NewButton("merge it all", func() {
|
||||||
r.Disable()
|
r.Disable()
|
||||||
|
@ -122,30 +110,30 @@ func (r *repoWindow) repoAllButtons() *gui.Node {
|
||||||
r.Enable()
|
r.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
box2.NewButton("test all builds", func() {
|
box2.NewButton("show apps", func() {
|
||||||
r.Disable()
|
|
||||||
defer r.Enable()
|
|
||||||
r.showApps()
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
loop := me.repos.View.ReposSortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
repo := loop.Repo()
|
repo := loop.Repo()
|
||||||
if repo.Hidden() {
|
rtype := repo.Status.RepoType()
|
||||||
// log.Info("skip hidden", repo.String())
|
switch rtype {
|
||||||
} else {
|
case "'binary'":
|
||||||
log.Info("try to build", repo.Name())
|
// log.Info(repo.Status.Path(), "compile here. Show()")
|
||||||
if repo.Status.Build() {
|
repo.Show()
|
||||||
log.Info("build worked", repo.Name())
|
case "'library'":
|
||||||
} else {
|
// log.Info(repo.Status.Path(), "library here. Hide()")
|
||||||
log.Info("build failed", repo.Name())
|
repo.Hide()
|
||||||
go repo.Status.Xterm("bash")
|
default:
|
||||||
return
|
log.Info(repo.Status.Path(), "unknown type", rtype)
|
||||||
|
// repo.Hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.Info("")
|
|
||||||
log.Info("every build worked !!!")
|
|
||||||
log.Info("")
|
|
||||||
})
|
})
|
||||||
|
box2.NewButton("scan now", func() {
|
||||||
|
log.Info("re-scanning now")
|
||||||
|
i, s := me.repos.View.ScanRepositories()
|
||||||
|
log.Info("re-scanning done", i, "repos in", s)
|
||||||
|
})
|
||||||
|
|
||||||
return box2
|
return box2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
structs.go
10
structs.go
|
@ -1,8 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var me *mainType
|
var me *mainType
|
||||||
|
@ -17,8 +19,13 @@ func (b *mainType) Enable() {
|
||||||
|
|
||||||
// this app's variables
|
// this app's variables
|
||||||
type mainType struct {
|
type mainType struct {
|
||||||
|
pp *arg.Parser
|
||||||
|
forge *forgepb.Forge
|
||||||
myGui *gui.Node
|
myGui *gui.Node
|
||||||
|
|
||||||
|
// our view of the repositories
|
||||||
|
repos *repoWindow
|
||||||
|
|
||||||
mainWindow *gadgets.BasicWindow
|
mainWindow *gadgets.BasicWindow
|
||||||
|
|
||||||
// the main box. enable/disable this
|
// the main box. enable/disable this
|
||||||
|
@ -27,9 +34,6 @@ type mainType struct {
|
||||||
// the window from the /lib/gui/gowit package
|
// the window from the /lib/gui/gowit package
|
||||||
lw *gadgets.BasicWindow
|
lw *gadgets.BasicWindow
|
||||||
|
|
||||||
// our view of the repositories
|
|
||||||
repos *repoWindow
|
|
||||||
|
|
||||||
// #### Sorting options for the repolist
|
// #### Sorting options for the repolist
|
||||||
autoHidePerfect *gui.Node
|
autoHidePerfect *gui.Node
|
||||||
autoHideReadOnly *gui.Node
|
autoHideReadOnly *gui.Node
|
||||||
|
|
Loading…
Reference in New Issue