2021-11-01 16:41:07 +01:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2023-03-07 22:04:06 +01:00
|
|
|
"github.com/Jguer/yay/v12/pkg/db"
|
2021-11-01 16:41:07 +01:00
|
|
|
|
|
|
|
"github.com/Jguer/go-alpm/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
IPackage = alpm.IPackage
|
|
|
|
Depend = alpm.Depend
|
|
|
|
Upgrade = db.Upgrade
|
|
|
|
)
|
|
|
|
|
2022-11-20 01:51:55 +01:00
|
|
|
type DBExecutor struct {
|
|
|
|
db.Executor
|
2023-02-17 20:01:26 +01:00
|
|
|
AlpmArchitecturesFn func() ([]string, error)
|
|
|
|
InstalledRemotePackageNamesFn func() []string
|
|
|
|
InstalledRemotePackagesFn func() map[string]IPackage
|
2023-03-31 23:22:57 +02:00
|
|
|
IsCorrectVersionInstalledFn func(string, string) bool
|
|
|
|
LocalPackageFn func(string) IPackage
|
|
|
|
LocalPackagesFn func() []IPackage
|
|
|
|
LocalSatisfierExistsFn func(string) bool
|
|
|
|
PackageDependsFn func(IPackage) []Depend
|
|
|
|
PackageOptionalDependsFn func(alpm.IPackage) []alpm.Depend
|
|
|
|
PackageProvidesFn func(IPackage) []Depend
|
|
|
|
PackagesFromGroupFn func(string) []IPackage
|
2023-03-05 18:31:11 +01:00
|
|
|
RefreshHandleFn func() error
|
2023-02-17 20:01:26 +01:00
|
|
|
ReposFn func() []string
|
2023-03-31 23:22:57 +02:00
|
|
|
SyncPackageFn func(string) IPackage
|
|
|
|
SyncSatisfierFn func(string) IPackage
|
|
|
|
SyncUpgradesFn func(bool) (map[string]db.SyncUpgrade, error)
|
2023-02-17 20:01:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *DBExecutor) InstalledRemotePackageNames() []string {
|
|
|
|
if t.InstalledRemotePackageNamesFn != nil {
|
|
|
|
return t.InstalledRemotePackageNamesFn()
|
|
|
|
}
|
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *DBExecutor) InstalledRemotePackages() map[string]IPackage {
|
|
|
|
if t.InstalledRemotePackagesFn != nil {
|
|
|
|
return t.InstalledRemotePackagesFn()
|
|
|
|
}
|
|
|
|
panic("implement me")
|
2022-11-20 01:51:55 +01:00
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) AlpmArchitectures() ([]string, error) {
|
2022-12-29 13:34:53 +01:00
|
|
|
if t.AlpmArchitecturesFn != nil {
|
|
|
|
return t.AlpmArchitecturesFn()
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) BiggestPackages() []IPackage {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) Cleanup() {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) IsCorrectVersionInstalled(s, s2 string) bool {
|
|
|
|
if t.IsCorrectVersionInstalledFn != nil {
|
|
|
|
return t.IsCorrectVersionInstalledFn(s, s2)
|
2022-12-16 18:23:44 +01:00
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) LastBuildTime() time.Time {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) LocalPackage(s string) IPackage {
|
2023-02-21 00:14:59 +01:00
|
|
|
if t.LocalPackageFn != nil {
|
|
|
|
return t.LocalPackageFn(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
panic("implement me")
|
2021-11-01 16:41:07 +01:00
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) LocalPackages() []IPackage {
|
2023-03-31 23:22:57 +02:00
|
|
|
if t.LocalPackagesFn != nil {
|
|
|
|
return t.LocalPackagesFn()
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) LocalSatisfierExists(s string) bool {
|
|
|
|
if t.LocalSatisfierExistsFn != nil {
|
|
|
|
return t.LocalSatisfierExistsFn(s)
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackageConflicts(iPackage IPackage) []Depend {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackageDepends(iPackage IPackage) []Depend {
|
2023-03-31 23:22:57 +02:00
|
|
|
if t.PackageDependsFn != nil {
|
|
|
|
return t.PackageDependsFn(iPackage)
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackageGroups(iPackage IPackage) []string {
|
2021-11-01 16:41:07 +01:00
|
|
|
return []string{}
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackageOptionalDepends(iPackage IPackage) []Depend {
|
2023-03-31 23:22:57 +02:00
|
|
|
if t.PackageOptionalDependsFn != nil {
|
|
|
|
return t.PackageOptionalDependsFn(iPackage)
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackageProvides(iPackage IPackage) []Depend {
|
2023-03-31 23:22:57 +02:00
|
|
|
if t.PackageProvidesFn != nil {
|
|
|
|
return t.PackageProvidesFn(iPackage)
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2022-12-18 21:14:41 +01:00
|
|
|
func (t *DBExecutor) PackagesFromGroup(s string) []IPackage {
|
|
|
|
if t.PackagesFromGroupFn != nil {
|
|
|
|
return t.PackagesFromGroupFn(s)
|
|
|
|
}
|
|
|
|
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) RefreshHandle() error {
|
2023-03-05 18:31:11 +01:00
|
|
|
if t.RefreshHandleFn != nil {
|
|
|
|
return t.RefreshHandleFn()
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SyncUpgrades(b bool) (map[string]db.SyncUpgrade, error) {
|
|
|
|
if t.SyncUpgradesFn != nil {
|
|
|
|
return t.SyncUpgradesFn(b)
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) Repos() []string {
|
|
|
|
if t.ReposFn != nil {
|
|
|
|
return t.ReposFn()
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SatisfierFromDB(s, s2 string) IPackage {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SyncPackage(s string) IPackage {
|
2022-12-18 21:14:41 +01:00
|
|
|
if t.SyncPackageFn != nil {
|
|
|
|
return t.SyncPackageFn(s)
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SyncPackages(s ...string) []IPackage {
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SyncSatisfier(s string) IPackage {
|
2022-12-18 21:14:41 +01:00
|
|
|
if t.SyncSatisfierFn != nil {
|
|
|
|
return t.SyncSatisfierFn(s)
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2023-02-17 20:01:26 +01:00
|
|
|
func (t *DBExecutor) SyncSatisfierExists(s string) bool {
|
2023-04-11 23:15:21 +02:00
|
|
|
if t.SyncSatisfierFn != nil {
|
|
|
|
return t.SyncSatisfierFn(s) != nil
|
|
|
|
}
|
2021-11-01 16:41:07 +01:00
|
|
|
panic("implement me")
|
|
|
|
}
|