🎨 Port package to types

This refactors DefaultPackage into types.Package and gets rid of the
interface. This is a preceeding for a follow up where accessors will be
removed from the code.
It also does several cleanup, so we get rid also of some unneeded
dependencies.
This commit is contained in:
Ettore Di Giacinto
2022-01-06 23:57:56 +01:00
parent 9c61210b5b
commit ba0d625b5f
98 changed files with 2694 additions and 6525 deletions

View File

@@ -22,9 +22,10 @@ import (
"regexp"
"strings"
"github.com/mudler/luet/pkg/api/core/types"
_gentoo "github.com/Sabayon/pkgs-checker/pkg/gentoo"
"github.com/mudler/luet/cmd/util"
pkg "github.com/mudler/luet/pkg/package"
)
func CreateRegexArray(rgx []string) ([]*regexp.Regexp, error) {
@@ -83,7 +84,7 @@ func gentooVersion(gp *_gentoo.GentooPackage) string {
return pkgVersion
}
func ParsePackageStr(p string) (*pkg.DefaultPackage, error) {
func ParsePackageStr(p string) (*types.Package, error) {
if packageHasGentooSelector(p) {
gp, err := _gentoo.ParsePackageStr(p)
@@ -95,7 +96,7 @@ func ParsePackageStr(p string) (*pkg.DefaultPackage, error) {
gp.Condition = _gentoo.PkgCondGreaterEqual
}
return &pkg.DefaultPackage{
return &types.Package{
Name: gp.Name,
Category: gp.Category,
Version: gentooVersion(gp),
@@ -115,7 +116,7 @@ func ParsePackageStr(p string) (*pkg.DefaultPackage, error) {
cat, name = packageData(p)
}
return &pkg.DefaultPackage{
return &types.Package{
Name: name,
Category: cat,
Version: ver,