summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-07 10:39:25 -0500
committerJeff Carr <[email protected]>2025-10-07 10:39:25 -0500
commit379e4b04802d852fea8e3daf03cb85d15a1bb0db (patch)
treea04e1c28eec22e9ab64cb4bf9147bbb9413eacf0
parentb843bce3c30d8139f29e3ca4b4e998bc0bd4053d (diff)
code rearrange
-rw-r--r--argv.go2
-rw-r--r--doBuild.go80
-rw-r--r--doDebian.go78
-rw-r--r--doPublish.go2
4 files changed, 50 insertions, 112 deletions
diff --git a/argv.go b/argv.go
index 1da268c..eb976d5 100644
--- a/argv.go
+++ b/argv.go
@@ -41,7 +41,7 @@ type args struct {
}
type BuildCmd struct {
- Debian *DebianCmd `arg:"subcommand:debian" help:"build missing .deb packages"`
+ Debian *DebianCmd `arg:"subcommand:deb" help:"build missing .deb packages"`
MacBuild *EmptyCmd `arg:"subcommand:macos" help:"build macos packages"`
Install *DefaultCmd `arg:"subcommand:install" help:"run make install in each repo"`
}
diff --git a/doBuild.go b/doBuild.go
index 8dbe9dd..87946b0 100644
--- a/doBuild.go
+++ b/doBuild.go
@@ -29,13 +29,52 @@ func doBuild() error {
}
if argv.Build.Debian != nil {
- doOnlyDebianPackages()
+ doBuildDeb()
okExit("")
}
return nil
}
+func doInstall() error {
+ initForge()
+ doInstallScan()
+
+ found := gitpb.NewRepos()
+ for check := range me.forge.Repos.IterAll() {
+ if me.forge.Config.IsReadOnly(check.Namespace) {
+ continue
+ }
+
+ if !check.IsBinary() {
+ continue
+ }
+
+ if check.IsGoPlugin() {
+ continue
+ }
+ found.Append(check)
+ }
+ me.forge.PrintForgedTable(found)
+
+ if argv.DryRun {
+ okExit("")
+ }
+
+ me.forge.ConfigRill(16, 16)
+ stats := me.forge.RunOnRepos(found, doInstallRepo)
+ for s, stat := range stats {
+ if stat.Err == nil {
+ continue
+ }
+ dur := stat.End.Sub(stat.Start)
+ log.Info("CRAP. INSTALL FAILED", shell.FormatDuration(dur), s, stat.Err)
+ badExit(stat.Err)
+ }
+ os.Remove(filepath.Join(me.homedir, "go/bin/forged"))
+ return nil
+}
+
func doInstallRepo(check *gitpb.Repo) error {
repotype := check.GetRepoType()
if repotype == "binary" || repotype == "plugin" {
@@ -152,42 +191,3 @@ func doInstallScan() {
}
}
}
-
-func doInstall() error {
- initForge()
- doInstallScan()
-
- found := gitpb.NewRepos()
- for check := range me.forge.Repos.IterAll() {
- if me.forge.Config.IsReadOnly(check.Namespace) {
- continue
- }
-
- if !check.IsBinary() {
- continue
- }
-
- if check.IsGoPlugin() {
- continue
- }
- found.Append(check)
- }
- me.forge.PrintForgedTable(found)
-
- if argv.DryRun {
- okExit("")
- }
-
- me.forge.ConfigRill(16, 16)
- stats := me.forge.RunOnRepos(found, doInstallRepo)
- for s, stat := range stats {
- if stat.Err == nil {
- continue
- }
- dur := stat.End.Sub(stat.Start)
- log.Info("CRAP. INSTALL FAILED", shell.FormatDuration(dur), s, stat.Err)
- badExit(stat.Err)
- }
- os.Remove(filepath.Join(me.homedir, "go/bin/forged"))
- return nil
-}
diff --git a/doDebian.go b/doDebian.go
index 37c0315..8e036f6 100644
--- a/doDebian.go
+++ b/doDebian.go
@@ -12,8 +12,7 @@ import (
"go.wit.com/log"
)
-func doDebian() error {
- initForge()
+func doBuildDeb() error {
// clean out old deb files
globPattern := filepath.Join(me.homedir, "incoming", "*.deb")
files, err := filepath.Glob(globPattern)
@@ -28,7 +27,7 @@ func doDebian() error {
return err
}
- // doInstallScan()
+ initForge()
found := gitpb.NewRepos()
for check := range me.forge.Repos.IterAll() {
@@ -45,32 +44,15 @@ func doDebian() error {
printPackagingTable(found)
- // func (f *Forge) isInstalled(repo *gitpb.Repo) string {
- // return "X"
- // }
-
- if !argv.DryRun {
- me.forge.ConfigRill(16, 16)
- stats := me.forge.RunOnRepos(found, doInstallRepo)
- for s, stat := range stats {
- if stat.Err == nil {
- continue
- }
- dur := stat.End.Sub(stat.Start)
- log.Info("CRAP. INSTALL FAILED", shell.FormatDuration(dur), s, stat.Err)
+ me.forge.ConfigRill(16, 16)
+ log.Info("STARTING .deb BUILDS repo len =", found.Len())
+ stats := me.forge.RunOnRepos(found, buildDeb)
+ for s, stat := range stats {
+ if stat.Err != nil {
+ log.Info("ERROR WITH buildDeb", s, stat.Err)
return stat.Err
}
}
-
- if err := doOnlyDebianPackages(); err != nil {
- return err
- }
-
- if !argv.DryRun {
- _, err = shell.RunRealtimeError([]string{"do-aptly"})
- return err
- }
-
return nil
}
@@ -151,47 +133,3 @@ func getOutdir(repo *gitpb.Repo) string {
return "/home/jcarr/incoming"
}
-
-func doOnlyDebianPackages() error {
- // clean out old deb files
- globPattern := filepath.Join(me.homedir, "incoming", "*.deb")
- files, err := filepath.Glob(globPattern)
- if err != nil {
- log.Info("Error during globbing:", err)
- return err
- }
- if len(files) > 0 {
- cmd := []string{"rm"}
- cmd = append(cmd, files...)
- _, err := shell.RunRealtimeError(cmd)
- return err
- }
-
- initForge()
-
- found := gitpb.NewRepos()
- for check := range me.forge.Repos.IterAll() {
- if me.forge.Config.IsReadOnly(check.GetNamespace()) {
- continue
- }
-
- if !check.IsBinary() {
- continue
- }
-
- found.Append(check)
- }
-
- printPackagingTable(found)
-
- me.forge.ConfigRill(16, 16)
- log.Info("STARTING .deb BUILDS repo len =", found.Len())
- stats := me.forge.RunOnRepos(found, buildDeb)
- for s, stat := range stats {
- if stat.Err != nil {
- log.Info("ERROR WITH buildDeb", s, stat.Err)
- return stat.Err
- }
- }
- return nil
-}
diff --git a/doPublish.go b/doPublish.go
index 114c23b..6c2c790 100644
--- a/doPublish.go
+++ b/doPublish.go
@@ -62,7 +62,7 @@ func doPublish() error {
me.sh.BadExit("publishing failed", nil)
}
- if err := doOnlyDebianPackages(); err != nil {
+ if err := doBuildDeb(); err != nil {
me.sh.BadExit("debian packages failed", err)
}
if _, err := shell.RunRealtimeError([]string{"do-aptly"}); err != nil {