mirror of
https://github.com/Jguer/yay.git
synced 2025-12-27 11:06:51 -05:00
fixed issue #2471 where it wouldn't show info when packages are in a group and modified test
This commit is contained in:
14
query.go
14
query.go
@@ -43,6 +43,20 @@ func syncInfo(ctx context.Context, run *runtime.Runtime,
|
|||||||
)
|
)
|
||||||
|
|
||||||
pkgS = query.RemoveInvalidTargets(run.Logger, pkgS, run.Cfg.Mode)
|
pkgS = query.RemoveInvalidTargets(run.Logger, pkgS, run.Cfg.Mode)
|
||||||
|
|
||||||
|
expandedPackages := []string{}
|
||||||
|
for _, pkg := range pkgS {
|
||||||
|
groupPackages := dbExecutor.PackagesFromGroup(pkg)
|
||||||
|
if len(groupPackages) > 0 {
|
||||||
|
for _, p := range groupPackages {
|
||||||
|
expandedPackages = append(expandedPackages, p.Name())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
expandedPackages = append(expandedPackages, pkg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pkgS = expandedPackages
|
||||||
|
|
||||||
aurS, repoS := packageSlices(pkgS, run.Cfg, dbExecutor)
|
aurS, repoS := packageSlices(pkgS, run.Cfg, dbExecutor)
|
||||||
|
|
||||||
if len(repoS) == 0 && len(aurS) == 0 {
|
if len(repoS) == 0 && len(aurS) == 0 {
|
||||||
|
|||||||
@@ -84,6 +84,12 @@ func TestSyncInfo(t *testing.T) {
|
|||||||
wantShow: []string{},
|
wantShow: []string{},
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Si arduino",
|
||||||
|
args: []string{"S", "i"},
|
||||||
|
targets: []string{"arduino"},
|
||||||
|
wantShow: []string{"pacman", "-S", "-i", "--config", "/etc/pacman.conf", "--", "arduino-cli"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dbExc := &mock.DBExecutor{
|
dbExc := &mock.DBExecutor{
|
||||||
@@ -94,9 +100,20 @@ func TestSyncInfo(t *testing.T) {
|
|||||||
PBase: "linux",
|
PBase: "linux",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if s == "arduino-cli" {
|
||||||
|
return &mock.Package{
|
||||||
|
PName: "arduino-cli",
|
||||||
|
PBase: "arduino-cli",
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
PackagesFromGroupFn: func(s string) []mock.IPackage {
|
PackagesFromGroupFn: func(s string) []mock.IPackage {
|
||||||
|
if s == "arduino" {
|
||||||
|
return []mock.IPackage{
|
||||||
|
&mock.Package{PName: "arduino-cli"},
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user