mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 17:17:22 +01:00
fix(aur): respect -uu for AUR downgrade (#1925)
respect -uu for AUR downgrade
This commit is contained in:
parent
f0433cc339
commit
6c870db1f1
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
@ -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()
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user