preliminary build

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-11 03:11:41 -06:00
parent ffaec2b5dd
commit 3740ef9834
2 changed files with 48 additions and 2 deletions

View File

@ -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":

View File

@ -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
}