From 3740ef98340655a2ec950eb4396095a423045d93 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 11 Feb 2024 03:11:41 -0600 Subject: preliminary build Signed-off-by: Jeff Carr --- readControlFile.go | 3 +-- stateWindow.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/readControlFile.go b/readControlFile.go index 7431f2a..14c336d 100644 --- a/readControlFile.go +++ b/readControlFile.go @@ -47,8 +47,7 @@ func (c *controlFile) readControlFile() error { for key, value := range pairs { switch key { case "Source": - // log.Info("FOUND Source!", value) - c.Source.SetText(value) + // log.Info("FOUND Source!", value) c.Source.SetText(value) case "Build-Depends": c.BuildDepends.SetText(value) case "Description": diff --git a/stateWindow.go b/stateWindow.go index afef4b2..5d88d8e 100644 --- a/stateWindow.go +++ b/stateWindow.go @@ -38,6 +38,13 @@ func makebasicWindow() *gadgets.BasicWindow { }) group1.NewButton("Make .deb", func() { + basicWindow.Disable() + if control.buildPackage() { + log.Info("build worked") + } else { + log.Warn("build failed") + } + basicWindow.Enable() }) group1.NewButton("open repo", func() { @@ -53,3 +60,43 @@ func makebasicWindow() *gadgets.BasicWindow { return basicWindow } + +func (c *controlFile) buildPackage() bool { + if c.readControlFile() == nil { + log.Warn("scan worked") + } else { + log.Warn("scan failed") + return false + } + if shell.Run([]string{"go", "build", "-v", "-x"}) { + log.Warn("build worked") + } else { + log.Warn("build failed") + return false + } + + filename := c.Package.String() + if filename == "" { + log.Warn("build failed") + return false + } + if !shell.Exists(filename) { + log.Warn("build failed") + return false + } + + arch := c.Architecture.String() + version := "v0.0.0" + + debname := filename + "_" + version + "_" + arch + ".deb" + + shell.Run([]string{"strip", filename}) + shell.Run([]string{"dpkg-deb", "--build", "files", debname}) + if shell.Exists(debname) { + log.Warn("build worked") + } else { + log.Warn("build failed") + return false + } + return true +} -- cgit v1.2.3