Skip to content

Commit

Permalink
fix(aur): respect -uu for AUR downgrade (#1925)
Browse files Browse the repository at this point in the history
respect -uu for AUR downgrade
  • Loading branch information
Jguer authored Feb 21, 2023
1 parent f0433cc commit 6c870db
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/upgrade/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/upgrade/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/upgrade/sources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down
2 changes: 1 addition & 1 deletion upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}()
Expand Down

0 comments on commit 6c870db

Please sign in to comment.