actually implement --dir

This commit is contained in:
Jeff Carr 2024-12-16 01:08:56 -06:00
parent 4f27202bce
commit 2141737e7c
4 changed files with 10 additions and 5 deletions

View File

@ -2,7 +2,7 @@
Makes a debian package from a go git repository, but also arbitrary things. Makes a debian package from a go git repository, but also arbitrary things.
# Usage (puts the finished .deb file in ~/incoming/) : # Usage
* go-deb --auto --repo go.wit.com/apps/go-clone # just make the .deb file already * go-deb --auto --repo go.wit.com/apps/go-clone # just make the .deb file already
* go-deb ---repo go.wit.com/apps/go-clone # will try to open a gtk gui * go-deb ---repo go.wit.com/apps/go-clone # will try to open a gtk gui

View File

@ -18,7 +18,7 @@ type args struct {
Auto bool `arg:"--auto" help:"automatically attempt to make the .deb"` Auto bool `arg:"--auto" help:"automatically attempt to make the .deb"`
Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"` Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"`
Repo string `arg:"--repo" help:"go get path to the repo"` Repo string `arg:"--repo" help:"go get path to the repo"`
PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"` OutDir string `arg:"--dir" help:"write .deb file into this directory"`
Release bool `arg:"--release" help:"build a release from the last git tag"` Release bool `arg:"--release" help:"build a release from the last git tag"`
KeepFiles bool `arg:"--keep-files" help:"keep the build files/"` KeepFiles bool `arg:"--keep-files" help:"keep the build files/"`
Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"` Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"`

View File

@ -39,7 +39,12 @@ func (c *controlBox) buildPackage() (bool, error) {
version := c.Version.String() version := c.Version.String()
log.Info("version is:", version) log.Info("version is:", version)
debname := filename + "_" + version + "_" + arch + ".deb" debname := filename + "_" + version + "_" + arch + ".deb"
fulldebname := filepath.Join(homeDir, "incoming", debname) var fulldebname string
if argv.OutDir == "" {
fulldebname = debname
} else {
fulldebname = filepath.Join(argv.OutDir, debname)
}
if shell.Exists(fulldebname) { if shell.Exists(fulldebname) {
log.Info("debian package already built: " + fulldebname) log.Info("debian package already built: " + fulldebname)
if argv.Auto { if argv.Auto {

View File

@ -4,9 +4,9 @@ Package: go-deb
Maintainer: Jeff Carr <jcarr@wit.com> Maintainer: Jeff Carr <jcarr@wit.com>
Packager: Jeff Carr <jcarr@wit.com> Packager: Jeff Carr <jcarr@wit.com>
Architecture: amd64 Architecture: amd64
Depends: Depends: go-gui-toolkits
URL: https://go.wit.com/ URL: https://go.wit.com/
Recommends: go-gui-toolkits Recommends:
Conflicts: testingoldstuff Conflicts: testingoldstuff
Description: create distribution packages for golang repositories Description: create distribution packages for golang repositories
Hopefully, this can make compatible and correct source Hopefully, this can make compatible and correct source