48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
package solver
|
|
|
|
import (
|
|
"github.com/osbuild/images/pkg/arch"
|
|
"github.com/osbuild/images/pkg/bib/osinfo"
|
|
"github.com/particle-os/debian-bootc-image-builder/bib/internal/aptsolver"
|
|
)
|
|
|
|
// Solver interface for Debian package dependency resolution
|
|
type Solver interface {
|
|
Depsolve(packages []string, maxAttempts int) (interface{}, error)
|
|
GetArch() arch.Arch
|
|
GetOSInfo() *osinfo.Info
|
|
}
|
|
|
|
// AptSolverWrapper wraps our apt solver
|
|
type AptSolverWrapper struct {
|
|
*aptsolver.AptSolver
|
|
}
|
|
|
|
// NewAptSolver creates a new apt solver
|
|
func NewAptSolver(cacheDir string, arch arch.Arch, osInfo *osinfo.Info) *AptSolverWrapper {
|
|
return &AptSolverWrapper{
|
|
AptSolver: aptsolver.NewAptSolver(cacheDir, arch, osInfo),
|
|
}
|
|
}
|
|
|
|
// Depsolve resolves package dependencies using apt
|
|
func (s *AptSolverWrapper) Depsolve(packages []string, maxAttempts int) (interface{}, error) {
|
|
return s.AptSolver.Depsolve(packages, maxAttempts)
|
|
}
|
|
|
|
// GetArch returns the architecture for this solver
|
|
func (s *AptSolverWrapper) GetArch() arch.Arch {
|
|
return s.AptSolver.GetArch()
|
|
}
|
|
|
|
// GetOSInfo returns the OS information for this solver
|
|
func (s *AptSolverWrapper) GetOSInfo() *osinfo.Info {
|
|
return s.AptSolver.GetOSInfo()
|
|
}
|
|
|
|
// NewSolver creates a Debian-focused solver
|
|
func NewSolver(osInfo *osinfo.Info, cacheDir string, arch arch.Arch) (Solver, error) {
|
|
// For now, we'll always use the APT solver since this is a Debian fork
|
|
// In the future, we could add support for other Debian-based distributions
|
|
return NewAptSolver(cacheDir, arch, osInfo), nil
|
|
}
|