diff options
| -rw-r--r-- | build.go | 38 | ||||
| -rw-r--r-- | control.read.go | 8 | ||||
| -rw-r--r-- | main.go | 28 | ||||
| -rw-r--r-- | update.go | 16 |
4 files changed, 17 insertions, 73 deletions
@@ -14,33 +14,10 @@ import ( ) func buildPackage(repo *gitpb.Repo) (bool, error) { - /* - go install -ldflags " \ - -X main.GITCOMMIT=${GITCOMMIT} \ - -X main.GOVERSION='${GOVERSION}' \ - -X main.BUILDTIME='${BUILDTIME}' \ - -X main.VERSION=${VERSION}" - */ - // ldflags := "main.GOTAG=" + repo.LastTag() - - filename := repo.Control["Package"] // c.Package.String() - if filename == "" { - return false, errors.New("filename is blank") - } - - arch := repo.Control["Architecture"] // c.Architecture.String() - if arch == "" { - arch = argv.Arch - } - // const layout = "200601021504" - // now := time.Now().UTC() - version := repo.Control["Version"] - if argv.BuildVersion != "" { - version += argv.BuildVersion - } - repo.Control["Version"] = version + filename := me.pb.Package + arch := me.pb.Architecture + version := me.pb.Version log.Info("version is:", version) - // debver := version + "-" + now.Format(layout) debname := filename + "_" + version + "_" + arch + ".deb" var fulldebname string @@ -141,14 +118,7 @@ func buildPackage(repo *gitpb.Repo) (bool, error) { log.Warn("go build worked") } - filebase := filepath.Base(repo.Control["pathL"]) // c.pathL.String()) - if fullfilename != filebase { - // this exception is for when you want to override a package name - // sometimes that's the best option. This way you can keep your - // name, but the .deb package name can be different so you can - // still apt-get it. For an example, look at the gozookeeper package - fullfilename = filebase - } + fullfilename = me.pb.Package if !shell.Exists(fullfilename) { log.Warn("build failed. filename does not exist", fullfilename) diff --git a/control.read.go b/control.read.go index ee0673a..e5de915 100644 --- a/control.read.go +++ b/control.read.go @@ -1,14 +1,8 @@ package main import ( - "bufio" - "os" - "path/filepath" "strings" "unicode" - - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" ) func trimNonNumericPrefix(s string) string { @@ -25,6 +19,7 @@ func trimNonNumericPrefix(s string) string { return s[firstDigitIndex:] } +/* // readGitConfig reads and parses the control file func readControlFile(repo *gitpb.Repo) error { pairs := make(map[string]string) @@ -102,3 +97,4 @@ func readControlFile(repo *gitpb.Repo) error { return nil } +*/ @@ -56,7 +56,7 @@ func main() { } else { me.pb.Architecture = argv.Arch } - me.pb.Version = trimNonNumericPrefix(me.repo.GetCurrentVersion()) + me.pb.Version = trimNonNumericPrefix(me.repo.DebianCurrentVersion()) me.pb.DebInfo.URL = me.repo.URL me.pb.DebInfo.Homepage = me.repo.URL // deprecate this usage (?) log.Info("INITIAL PARSE RESULT:") @@ -88,20 +88,15 @@ func main() { me.repo.Namespace = basename os.Chdir(debpath) - // look for a 'config' file in the repo - if readControlFile(me.repo) == nil { - log.Warn("scan worked") - } else { - log.Warn("scan failed") - } - // computeControlValues(me.repo) - - if argv.Dump != nil { - for v := range me.repo.Control { - log.Infof("CONTROL: %s: %s\n", v, me.repo.Control[v]) + /* + // look for a 'config' file in the repo + if readControlFile(me.repo) == nil { + log.Warn("scan worked") + } else { + log.Warn("scan failed") } - okExit("") - } + // computeControlValues(me.repo) + */ if argv.Gui != nil { // only load teh toolkit if you get this far @@ -112,10 +107,9 @@ func main() { log.Info("go-deb: attempting to build package") if ok, err := buildPackage(me.repo); ok { - log.Info("build worked") + me.sh.GoodExit("build worked") } else { - log.Warn("build failed:", err) - os.Exit(-1) + me.sh.BadExit("build failed", err) } os.Exit(0) } diff --git a/update.go b/update.go deleted file mode 100644 index eadda10..0000000 --- a/update.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -func updateControl(c *controlBox) { - c.Namespace.SetText(me.repo.Namespace) - c.URL.SetText(me.repo.URL) - c.Package.SetText(me.repo.Control["Package"]) - c.Source.SetText(me.repo.Control["Source"]) - c.Maintainer.SetText(me.repo.Control["Maintainer"]) - c.Packager.SetText(me.repo.Control["Packager"]) - c.Version.SetText(me.repo.Control["Version"]) - c.Description.SetText(me.repo.Control["Description"]) - c.Depends.SetText(me.repo.Control["Depends"]) - c.Recommends.SetText(me.repo.Control["Recommends"]) - - c.Architecture.SetText(argv.Arch) -} |
