2024-02-11 01:00:05 -06:00
|
|
|
// make debian packages for go applications
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-02-11 06:32:48 -06:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
2024-02-11 01:00:05 -06:00
|
|
|
"go.wit.com/gui"
|
|
|
|
"go.wit.com/lib/debugger"
|
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
// This is the beginning of the binary tree of GUI widgets
|
|
|
|
var myGui *gui.Node
|
|
|
|
|
2024-02-11 06:32:48 -06:00
|
|
|
var cBox *controlBox
|
2024-02-11 01:00:05 -06:00
|
|
|
|
|
|
|
// this is a basic window. the user can open and close it
|
|
|
|
var basicWindow *gadgets.BasicWindow
|
|
|
|
|
|
|
|
func main() {
|
2024-02-11 13:56:59 -06:00
|
|
|
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)
|
|
|
|
}
|
2024-02-11 01:00:05 -06:00
|
|
|
if debugger.ArgDebug() {
|
|
|
|
log.SetAll(true)
|
|
|
|
log.ShowFlags()
|
|
|
|
}
|
|
|
|
if args.TmpLog {
|
|
|
|
// send all log() output to a file in /tmp
|
|
|
|
log.SetTmp()
|
|
|
|
}
|
|
|
|
myGui = gui.New()
|
|
|
|
myGui.Default()
|
|
|
|
|
|
|
|
basicWindow = makebasicWindow()
|
|
|
|
|
2024-02-11 13:56:59 -06:00
|
|
|
filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
|
|
|
|
os.Chdir(filepath)
|
2024-02-11 06:32:48 -06:00
|
|
|
|
2024-02-11 13:56:59 -06:00
|
|
|
cBox.addRepo(args.Repo)
|
|
|
|
cBox.readControlFile()
|
|
|
|
if args.NoGui {
|
|
|
|
if cBox.buildPackage() {
|
|
|
|
log.Info("build worked")
|
|
|
|
} else {
|
|
|
|
log.Warn("build failed")
|
|
|
|
}
|
|
|
|
os.Exit(0)
|
2024-02-11 01:00:05 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// run the debugger if triggered from the commandline
|
|
|
|
if debugger.ArgDebug() {
|
|
|
|
go func() {
|
|
|
|
log.Sleep(2)
|
|
|
|
debugger.DebugWindow()
|
|
|
|
}()
|
|
|
|
}
|
2024-02-11 13:56:59 -06:00
|
|
|
|
|
|
|
basicWindow.Show()
|
|
|
|
// go will sit here until the window exits
|
|
|
|
gui.Watchdog()
|
|
|
|
os.Exit(0)
|
2024-02-11 01:00:05 -06:00
|
|
|
}
|