fix(aur): respect -uu for AUR downgrade (#1925)

respect -uu for AUR downgrade
This commit is contained in:
Jo authored and GitHub committed 2023-02-21 01:51:52 +00:00
1 parent f0433cc339
commit 6c870db1f1
4 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -74,7 +74,7 @@ func (u *UpgradeService) upGraph(ctx context.Context, graph *topo.Graph[string,
aurdata[pkg.Name] = pkg
}
aurUp = UpAUR(remote, aurdata, u.cfg.TimeUpdate)
aurUp = UpAUR(remote, aurdata, u.cfg.TimeUpdate, enableDowngrade)
}
if u.cfg.Devel {
+2 -2
View File
@@ -60,7 +60,7 @@ func printIgnoringPackage(pkg db.IPackage, newPkgVersion string) {
// UpAUR gathers foreign packages and checks if they have new versions.
// Output: Upgrade type package list.
func UpAUR(remote map[string]db.IPackage, aurdata map[string]*query.Pkg, timeUpdate bool) UpSlice {
func UpAUR(remote map[string]db.IPackage, aurdata map[string]*query.Pkg, timeUpdate, enableDowngrade bool) UpSlice {
toUpgrade := UpSlice{Up: make([]Upgrade, 0), Repos: []string{"aur"}}
for name, pkg := range remote {
@@ -70,7 +70,7 @@ func UpAUR(remote map[string]db.IPackage, aurdata map[string]*query.Pkg, timeUpd
}
if (timeUpdate && (int64(aurPkg.LastModified) > pkg.BuildDate().Unix())) ||
(db.VerCmp(pkg.Version(), aurPkg.Version) < 0) {
(db.VerCmp(pkg.Version(), aurPkg.Version) < 0) || enableDowngrade {
if pkg.ShouldIgnore() {
printIgnoringPackage(pkg, aurPkg.Version)
} else {
+1 -1
View File
@@ -71,7 +71,7 @@ func Test_upAUR(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := UpAUR(tt.args.remote, tt.args.aurdata, tt.args.timeUpdate)
got := UpAUR(tt.args.remote, tt.args.aurdata, tt.args.timeUpdate, false)
assert.EqualValues(t, tt.want, got)
})
}
+1 -1
View File
@@ -86,7 +86,7 @@ func upList(ctx context.Context,
wg.Add(1)
go func() {
aurUp = upgrade.UpAUR(remote, aurdata, config.TimeUpdate)
aurUp = upgrade.UpAUR(remote, aurdata, config.TimeUpdate, enableDowngrade)
wg.Done()
}()