74 lines
1.4 KiB
Go
74 lines
1.4 KiB
Go
// make debian packages for go applications
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"go.wit.com/gui"
|
|
"go.wit.com/lib/debugger"
|
|
"go.wit.com/lib/gadgets"
|
|
"go.wit.com/lib/gui/shell"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
// This is the beginning of the binary tree of GUI widgets
|
|
var myGui *gui.Node
|
|
|
|
var cBox *controlBox
|
|
|
|
// this is a basic window. the user can open and close it
|
|
var basicWindow *gadgets.BasicWindow
|
|
|
|
func main() {
|
|
if args.Repo == "" {
|
|
log.Info("You need to tell me what repo you want to work on")
|
|
println("")
|
|
println("go-deb --repo go.wit.com/apps/helloworld")
|
|
os.Exit(0)
|
|
}
|
|
myGui = gui.New()
|
|
myGui.Default()
|
|
|
|
basicWindow = makebasicWindow()
|
|
|
|
filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
|
|
os.Chdir(filepath)
|
|
|
|
// scan the repo
|
|
cBox.addRepo(args.Repo)
|
|
|
|
// look for a 'config' file in the repo
|
|
if cBox.readControlFile() == nil {
|
|
log.Warn("scan worked")
|
|
} else {
|
|
log.Warn("scan failed")
|
|
}
|
|
cBox.computeControlValues()
|
|
// verify the values for the package
|
|
|
|
if args.NoGui {
|
|
shell.TestTerminalColor()
|
|
if ok, err := cBox.buildPackage(); ok {
|
|
log.Info("build worked")
|
|
} else {
|
|
log.Warn("build failed:", err)
|
|
os.Exit(-1)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
// run the debugger if triggered from the commandline
|
|
if debugger.ArgDebug() {
|
|
go func() {
|
|
log.Sleep(2)
|
|
debugger.DebugWindow()
|
|
}()
|
|
}
|
|
|
|
basicWindow.Show()
|
|
// go will sit here until the window exits
|
|
gui.Watchdog()
|
|
os.Exit(0)
|
|
}
|