summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-09 04:31:10 -0500
committerJeff Carr <[email protected]>2025-10-09 04:31:10 -0500
commit98bb38d6999f94d507868247841d9b8d6eff8a75 (patch)
treef1dc35b0dad362e128d975d4b8a04247756838a2
parent0b646a20b812f337251c0ed950afeba9b97cfcc7 (diff)
cleaning up publish
-rw-r--r--argv.go1
-rw-r--r--doBuild.debian.go14
-rw-r--r--doBuild.go7
-rw-r--r--doPublish.go2
-rw-r--r--main.go41
-rw-r--r--tablePackaging.go5
6 files changed, 39 insertions, 31 deletions
diff --git a/argv.go b/argv.go
index df33691..188d891 100644
--- a/argv.go
+++ b/argv.go
@@ -60,6 +60,7 @@ type DebianCmd struct {
DryRun bool `arg:"--dry-run" help:"only show what would be packaged"`
Verbose bool `arg:"--verbose" help:"be loud about it"`
Force bool `arg:"--force" help:"rebuild everything"`
+ Priv bool `arg:"--private" help:"build private repos"`
All bool `arg:"--all" help:"build everything again"`
}
diff --git a/doBuild.debian.go b/doBuild.debian.go
index 76a56f7..701b46b 100644
--- a/doBuild.debian.go
+++ b/doBuild.debian.go
@@ -17,6 +17,7 @@ import (
var totalBuilt int
func doBuildDeb() (string, error) {
+ log.Info("STARTING DEBIAN PACKAGE BUILD")
// clean out old deb files
globPattern := filepath.Join(me.homedir, "incoming", "*.deb")
files, err := filepath.Glob(globPattern)
@@ -37,6 +38,11 @@ func doBuildDeb() (string, error) {
if me.forge.Config.IsReadOnly(check.GetNamespace()) {
continue
}
+ if me.forge.Config.IsPrivate(check.GetNamespace()) {
+ if !argv.Build.Debian.Priv {
+ continue
+ }
+ }
if !check.IsBinary() {
continue
@@ -46,8 +52,8 @@ func doBuildDeb() (string, error) {
}
found.ActualSort()
- printPackagingTable(found)
- // me.forge.PrintTable(found)
+ footer := printPackagingTable(found)
+ log.Info("This is what will and will not be built:", footer)
me.forge.ConfigRill(16, 16)
stats := me.forge.RunOnRepos(found, buildDeb)
@@ -57,6 +63,10 @@ func doBuildDeb() (string, error) {
}
}
if totalBuilt == 0 {
+ if argv.DryRun {
+ log.Info("")
+ return "--dry-run TRUE (nothing done)", nil
+ }
// nothing built, no need to talk to mirrors
return "everything is current", nil
}
diff --git a/doBuild.go b/doBuild.go
index 90b04c1..441ab97 100644
--- a/doBuild.go
+++ b/doBuild.go
@@ -56,14 +56,17 @@ func doInstall() error {
}
found.Append(check)
}
- me.forge.PrintForgedTable(found)
+ footer := me.forge.PrintForgedTable(found)
+ log.Info("Starting 'go install' on these repos:", footer)
if argv.DryRun {
- me.sh.GoodExit("")
+ return nil
}
me.forge.ConfigRill(16, 16)
+ os.Setenv("GO111MODULE", "off")
stats := me.forge.RunOnRepos(found, doInstallRepo)
+ os.Unsetenv("GO111MODULE")
for s, stat := range stats {
if stat.Err == nil {
continue
diff --git a/doPublish.go b/doPublish.go
index 0b72ee6..c3ac3f9 100644
--- a/doPublish.go
+++ b/doPublish.go
@@ -48,12 +48,10 @@ func doPublish() error {
time.Sleep(time.Second)
me.forge.Repos.Load()
- os.Setenv("GO111MODULE", "off")
if err := doInstall(); err != nil {
log.Info("doInstall() failed", err)
me.sh.BadExit("merge failed", nil)
}
- os.Unsetenv("GO111MODULE")
if os.Getenv("GUIRELEASE_REASON") == "" {
os.Setenv("GUIRELEASE_REASON", "automated")
diff --git a/main.go b/main.go
index f70a605..f67c0f1 100644
--- a/main.go
+++ b/main.go
@@ -26,48 +26,41 @@ var resources embed.FS
func main() {
me = new(mainType)
// autocomplete must be processed before there is anything sent to STDOUT or STDERR
- me.sh = prep.Bash3(&argv) // add support for bash autocomplete with go-arg
+ me.sh = prep.Bash(&argv) // add support for bash autocomplete with go-arg
me.homedir, _ = os.UserHomeDir() // store shortcut here todo: add better logic
+ if me.sh.Cmd == "" {
+ // user didn't enter a sub command
+ // doDefaultBehavior()
+ me.sh.GoodExit("do what?")
+ }
+
+ // Standard subcommand handling starts here
+ var s string
+ var err error
+
if argv.Upgrade != nil {
doUpgrade()
me.sh.GoodExit("")
}
if argv.Linux != nil {
- var s string
- var err error
if argv.Linux.Rdate != nil {
s, err = doRdate()
}
- if err != nil {
- me.sh.BadExit(s, err)
- }
- me.sh.GoodExit(s)
}
if argv.Build != nil {
- doBuild()
- me.sh.GoodExit("")
+ s, err = doBuild()
}
if argv.Git != nil {
initMachine()
- me.sh.GoodExit("")
-
- s, err := doGit()
- if err != nil {
- me.sh.BadExit(s, err)
- }
- me.sh.GoodExit(s)
+ s, err = doGit()
}
if argv.PB != nil {
- s, err := doIdentifyPB("unknown.pb")
- if err != nil {
- me.sh.BadExit(s, err)
- }
- me.sh.GoodExit(s)
+ s, err = doIdentifyPB("unknown.pb")
}
if argv.Clone != nil {
@@ -107,8 +100,10 @@ func main() {
}
me.sh.GoodExit("do something here")
}
-
- me.sh.GoodExit("do what?")
+ if err != nil {
+ me.sh.BadExit(s, err)
+ }
+ me.sh.GoodExit(s)
}
// this is dumb. sync this with go-deb
diff --git a/tablePackaging.go b/tablePackaging.go
index 0da43b1..74f2e0d 100644
--- a/tablePackaging.go
+++ b/tablePackaging.go
@@ -38,10 +38,11 @@ func getDebFilename(repo *gitpb.Repo) string {
return ""
}
-func printPackagingTable(pb *gitpb.Repos) {
+func printPackagingTable(pb *gitpb.Repos) string {
tablePB := makePackagingTable(pb)
tablePB.PrintTable()
- log.Printf("wit.packagingTable() %d repos\n", pb.Len())
+ s := log.Sprintf("wit.packagingTable() %d repos", pb.Len())
+ return s
}
func makePackagingTable(pb *gitpb.Repos) *gitpb.ReposTable {