summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--buildPackage.go36
-rw-r--r--examples/protoc-gen-go/Makefile6
-rwxr-xr-xexamples/protoc-gen-go/build10
-rw-r--r--examples/protoc-gen-go/control12
-rw-r--r--main.go30
-rw-r--r--readControlFile.go2
-rw-r--r--stateWindow.go1
8 files changed, 72 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 73a473c..7633169 100644
--- a/Makefile
+++ b/Makefile
@@ -36,9 +36,10 @@ reset:
# clear your terminal
reset
-gocui: build
+# use the ncurses gui (only kinda works still)
+ncurses: build
reset
- ./go-deb --gui gocui >/tmp/witgui.log.stderr 2>&1
+ ./go-deb --gui gocui
nocui: reset build
./go-deb --gui nocui
diff --git a/buildPackage.go b/buildPackage.go
index 9c9692c..856e960 100644
--- a/buildPackage.go
+++ b/buildPackage.go
@@ -42,7 +42,12 @@ func (c *controlBox) buildPackage() (bool, error) {
fulldebname := filepath.Join(homeDir, "incoming", debname)
if shell.Exists(fulldebname) {
log.Info("debian package already built: " + fulldebname)
- return true, errors.New("debian package already built: " + fulldebname)
+ if argv.Auto {
+ return true, errors.New("debian package already built: " + fulldebname)
+ } else {
+ return false, errors.New("debian package already built: " + fulldebname)
+ }
+
}
var fullfilename string
@@ -132,13 +137,17 @@ func (c *controlBox) buildPackage() (bool, error) {
log.Warn("mkdir failed")
return false, errors.New("mkdir files/usr/bin")
}
- if r := shell.Run([]string{"cp", fullfilename, "files/usr/bin"}); r.Error != nil {
- log.Warn("cp failed")
- return false, r.Error
- }
- if r := shell.Run([]string{"strip", "files/usr/bin/" + filename}); r.Error != nil {
- log.Warn("strip failed")
- return false, r.Error
+ if os.Getenv("GO_DEB_CUSTOM") == "true" {
+ // skip cp & strip on custom 'control' files
+ } else {
+ if r := shell.Run([]string{"cp", fullfilename, "files/usr/bin"}); r.Error != nil {
+ log.Warn("cp failed")
+ return false, r.Error
+ }
+ if r := shell.Run([]string{"strip", "files/usr/bin/" + filename}); r.Error != nil {
+ log.Warn("strip failed")
+ return false, r.Error
+ }
}
// put the README in there (if missing, generate it?)
@@ -168,19 +177,10 @@ func (c *controlBox) buildPackage() (bool, error) {
shell.Run([]string{"cp", "postinst", "files/DEBIAN/"})
}
- if c.status == nil {
- log.Warn("c.status == nil")
- panic(-1)
- }
// experiment for the toolkit package
// if the git repo has a "./build" script run it before packaging
// this way the user can put custom files in the .deb package
- if c.status.Exists("build") {
- if argv.Release {
- os.Unsetenv("GO111MODULE")
- } else {
- os.Setenv("GO111MODULE", "off")
- }
+ if shell.Exists("build") {
shell.Run([]string{"./build"})
}
diff --git a/examples/protoc-gen-go/Makefile b/examples/protoc-gen-go/Makefile
new file mode 100644
index 0000000..92a3852
--- /dev/null
+++ b/examples/protoc-gen-go/Makefile
@@ -0,0 +1,6 @@
+.PHONY: build
+
+all: build
+
+build:
+ go-deb --repo .
diff --git a/examples/protoc-gen-go/build b/examples/protoc-gen-go/build
new file mode 100755
index 0000000..f8e2b06
--- /dev/null
+++ b/examples/protoc-gen-go/build
@@ -0,0 +1,10 @@
+#!/bin/bash -x
+
+# this is the new protobuf generator
+#
+# go-clone google.golang.org/protobuf
+# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
+# go install
+
+mkdir -p files/usr/bin
+cp ~/go/bin/protoc-gen-go files/usr/bin
diff --git a/examples/protoc-gen-go/control b/examples/protoc-gen-go/control
new file mode 100644
index 0000000..df51b5d
--- /dev/null
+++ b/examples/protoc-gen-go/control
@@ -0,0 +1,12 @@
+Source: google.golang.org.protobuf
+Build-Depends: golang
+Package: protoc-gen-go-new
+Maintainer: Jeff Carr <[email protected]>
+Packager: Jeff Carr <[email protected]>
+Architecture: amd64
+Depends:
+URL: https://go.wit.com/
+Recommends:
+Version: 0.1
+Description: protoc-gen-go from google.golang.org/protobuf
+ You need this one until the debian sid packages are updated
diff --git a/main.go b/main.go
index 06a96f7..c812420 100644
--- a/main.go
+++ b/main.go
@@ -35,7 +35,7 @@ func main() {
os.Exit(0)
}
myGui = gui.New()
- if !argv.Auto {
+ if !argv.Auto {
myGui.InitEmbed(resources)
}
myGui.Default()
@@ -44,8 +44,14 @@ func main() {
// todo: add the go.work file logic here
homeDir, _ := os.UserHomeDir()
- filepath := filepath.Join(homeDir, "go/src", argv.Repo)
- os.Chdir(filepath)
+ var debpath string
+ if argv.Repo == "." {
+ os.Setenv("GO_DEB_CUSTOM", "true")
+ debpath, _ = os.Getwd()
+ } else {
+ debpath = filepath.Join(homeDir, "go/src", argv.Repo)
+ }
+ os.Chdir(debpath)
// scan the repo
cBox.addRepo(argv.Repo)
@@ -60,19 +66,23 @@ func main() {
// verify the values for the package
if cBox.status == nil {
- log.Info("argv.Repo =", argv.Repo)
- log.Info("repo not found. Try:")
- log.Info("")
- log.Info(" go-clone", argv.Repo)
- log.Info("")
- os.Exit(-1)
+ if argv.Repo == "." {
+ // this means try the local directory for a custom 'control' file
+ } else {
+ log.Info("argv.Repo =", argv.Repo)
+ log.Info("repo not found. Try:")
+ log.Info("")
+ log.Info(" go-clone", argv.Repo)
+ log.Info("")
+ os.Exit(-1)
+ }
}
// set the working directory to argv.Repo
log.Info("cd", cBox.status.Path())
os.Chdir(cBox.status.Path())
- if argv.Auto {
+ if argv.Auto {
shell.TestTerminalColor()
// basicWindow.Show() // broken gui package. convert to protobuf
if ok, err := cBox.buildPackage(); ok {
diff --git a/readControlFile.go b/readControlFile.go
index b307849..8876d64 100644
--- a/readControlFile.go
+++ b/readControlFile.go
@@ -65,6 +65,8 @@ func (c *controlBox) readControlFile() error {
c.Depends.SetText(value)
case "Recommends":
c.Recommends.SetText(value)
+ case "Version":
+ c.Version.SetText(value)
case "Package":
c.Package.SetText(value)
// if c.Package.String() != value {
diff --git a/stateWindow.go b/stateWindow.go
index 99d2f8b..7c4cd83 100644
--- a/stateWindow.go
+++ b/stateWindow.go
@@ -36,6 +36,7 @@ func makebasicWindow() *gadgets.BasicWindow {
basicWindow.Disable()
if ok, err := cBox.buildPackage(); ok {
log.Info("build worked")
+ os.Exit(0)
} else {
log.Warn("build failed", err)
}