diff options
| author | Jeff Carr <[email protected]> | 2024-02-11 03:11:41 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-11 03:11:41 -0600 |
| commit | 3740ef98340655a2ec950eb4396095a423045d93 (patch) | |
| tree | d84e998234a2af62d4f4955f19c9e17578fe92f9 | |
| parent | ffaec2b5dd6b38d5b78b579998dedc91f016110e (diff) | |
preliminary build
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | readControlFile.go | 3 | ||||
| -rw-r--r-- | 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 +} |
