summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go6
-rw-r--r--doDebian.go13
-rw-r--r--doUpgrade.go31
3 files changed, 44 insertions, 6 deletions
diff --git a/argv.go b/argv.go
index ea696c4..f4e3d3d 100644
--- a/argv.go
+++ b/argv.go
@@ -62,8 +62,10 @@ type CloneCmd struct {
}
type UpgradeCmd struct {
- DryRun bool `arg:"--dry-run" help:"don't really do anything"`
- Force bool `arg:"--force" help:"force un-install and re-install each package"`
+ List *EmptyCmd `arg:"subcommand:list" help:"fix urls from the repomap"`
+ All bool `arg:"--all" help:"show all the packages"`
+ DryRun bool `arg:"--dry-run" help:"don't really do anything"`
+ Force bool `arg:"--force" help:"force un-install and re-install each package"`
}
type DefaultCmd struct {
diff --git a/doDebian.go b/doDebian.go
index 34861f0..52753ca 100644
--- a/doDebian.go
+++ b/doDebian.go
@@ -149,13 +149,24 @@ func shouldBuild(repo *gitpb.Repo) bool {
return false
}
+// avoids nil panics
+func isDebianRelease() bool {
+ if argv.Build == nil {
+ return false
+ }
+ if argv.Build.Debian == nil {
+ return false
+ }
+ return argv.Build.Debian.Release
+}
+
func buildDeb(check *gitpb.Repo) error {
var cmd []string
outdir := getOutdir(check)
os.MkdirAll(outdir, 0755)
- if argv.Build.Debian.Release {
+ if isDebianRelease() {
cmd = []string{"go-deb", "--release", "--namespace", check.Namespace, "--dir", outdir}
} else {
cmd = []string{"go-deb", "--namespace", check.Namespace, "--dir", outdir}
diff --git a/doUpgrade.go b/doUpgrade.go
index ee8e7f3..7fb3f88 100644
--- a/doUpgrade.go
+++ b/doUpgrade.go
@@ -10,15 +10,40 @@ import (
"go.wit.com/log"
)
+func doPackageList(all bool) {
+ installed := zoopb.NewPackages()
+ for p := range me.machine.Wit.IterAll() {
+ found := me.machine.FindInstalledByName(p.Name)
+ if found == nil {
+ continue
+ }
+ p.Installed = true
+ installed.Append(p)
+ }
+ if all {
+ me.machine.Wit.PrintTable()
+ } else {
+ installed.PrintTable()
+ }
+}
+
func doUpgrade() error {
+ me.machine, _ = zoopb.InitMachine()
+
+ if argv.Upgrade.List != nil {
+ if argv.Upgrade.All {
+ doPackageList(true)
+ } else {
+ doPackageList(false)
+ }
+ return nil
+ }
+
if !argv.DryRun {
checkSuperuser()
-
aptUpdate()
}
- me.machine, _ = zoopb.InitMachine()
-
var installed []string
fmt.Println("Installed Packages:")