blob: 8f0ae4e55f4817b0b8460f8803947368f9a0f9a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
import (
"fmt"
"go.wit.com/lib/protobuf/zoopb"
"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()
}
log.Info("aptly repo -remove-files -force-replace add wit /home/aptly/incoming/autogenpb_0.5.16_amd64.deb")
log.Info("aptly repo remove wit basicwindow")
log.Info("aptly snapshot create wit-v0.8.3 from repo wit")
log.Info("aptly publish snapshot wit-v0.8.3")
}
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()
}
var installed []string
fmt.Println("Installed Packages:")
loop := me.machine.Wit.SortByName()
for loop.Scan() {
p := loop.Next()
if p.Name == "" {
log.Infof("odd /var/lib/apt/ list parse error. p.Name was blank (should be the package name) p=%v\n", p)
continue
}
if !me.machine.IsInstalled(p.Name) {
continue
}
found := me.machine.FindInstalledByName(p.Name)
if found.Version == p.Version {
log.Info("name version already installed", p.Name, found.Version)
if !argv.Force {
continue
}
} else {
log.Info("name ver diff", p.Name, found.Version, p.Version)
}
if argv.DryRun {
log.Info("should install package", p.Name)
continue
}
installed = append(installed, p.Name)
}
if argv.Force {
// force remove the packages. can be used if binaries change but versions didn't
for _, pkgname := range installed {
aptRemove(pkgname)
}
}
for _, pkgname := range installed {
aptInstall(pkgname)
}
okExit("installed")
return nil
}
|