summaryrefslogtreecommitdiff
path: root/doDebian.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-08 01:23:12 -0500
committerJeff Carr <[email protected]>2025-10-08 01:23:12 -0500
commit1f321bc8c3b7bb19f443d73334c6cdcc45a9c75a (patch)
tree02e3b3d4209dc735d85ed04040a8af1cbf135aac /doDebian.go
parentfebcf44d5386f8fc20ab752f0416955f35375335 (diff)
usability cleanups
Diffstat (limited to 'doDebian.go')
-rw-r--r--doDebian.go135
1 files changed, 0 insertions, 135 deletions
diff --git a/doDebian.go b/doDebian.go
deleted file mode 100644
index 00a62bb..0000000
--- a/doDebian.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
-// Use of this source code is governed by the GPL 3.0
-
-package main
-
-import (
- "os"
- "path/filepath"
-
- "go.wit.com/lib/fhelp"
- "go.wit.com/lib/protobuf/gitpb"
- "go.wit.com/log"
-)
-
-func doBuildDeb() 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 := fhelp.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
- }
-
- if shouldBuild(check) == "yes" {
- found.Append(check)
- }
- }
-
- printPackagingTable(found)
-
- me.forge.ConfigRill(16, 16)
- 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 := fhelp.RunRealtimeError([]string{"do-aptly"}); err != nil {
- me.sh.BadExit("aptly failed", nil)
- }
- return nil
-}
-
-// avoids nil panics
-func isDebianRelease() bool {
- if argv.Build == nil {
- return false
- }
- if argv.Build.Debian == nil {
- return false
- }
- return argv.Build.Debian.Release
-}
-
-var totalBuilt int
-
-func buildDeb(check *gitpb.Repo) error {
- var cmd []string
-
- outdir := getOutdir(check)
- os.MkdirAll(outdir, 0755)
-
- if isDebianRelease() {
- cmd = []string{"go-deb", "--release", "--namespace", check.Namespace, "--dir", outdir}
- } else {
- cmd = []string{"go-deb", "--namespace", check.Namespace, "--dir", outdir}
- }
-
- if me.forge.Config.IsPrivate(check.GetNamespace()) {
- cmd = []string{"go-deb", "--namespace", check.Namespace, "--dir", outdir}
- // return nil
- }
-
- if argv.Verbose {
- // log.Info("build cmd:", cmd)
- cmd = append(cmd, "--verbose")
- }
-
- if argv.DryRun {
- log.Info("RUN:", check.FullPath, cmd)
- return nil
- }
-
- log.Info("Building .deb", cmd)
- var err error
- if _, err = check.RunVerboseOnError(cmd); err != nil {
- totalBuilt += 1
- log.Info(check.FullPath, cmd)
- return err
- }
-
- log.Info("build worked", cmd, check.FullPath)
- return nil
-}
-
-func getOutdir(repo *gitpb.Repo) string {
- if me.forge.Config.IsPrivate(repo.GetNamespace()) {
- return "/home/jcarr/incoming-private"
- }
- if argv.Force {
- return "/home/jcarr/incoming"
- }
- if repo.GetLastTag() != repo.GetMasterVersion() {
- return "/home/jcarr/incoming-devel"
- }
-
- if repo.GetCurrentBranchVersion() != repo.GetMasterVersion() {
- return "/home/jcarr/incoming-devel"
- }
-
- if repo.CheckDirty() {
- return "/home/jcarr/incoming-devel"
- }
-
- return "/home/jcarr/incoming"
-}