deb-bootc-image-builder/bib/internal/solver/solver.go
robojerk be2b81ca6d
Some checks failed
Tests / test (1.21.x) (push) Failing after 1s
Tests / test (1.22.x) (push) Failing after 1s
Update Go code to remove Red Hat dependencies and use Debian equivalents
2025-08-11 09:39:18 -07:00

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
}