mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 00:06:36 +00:00
Add packageset
This commit is contained in:
@@ -52,6 +52,29 @@ type Package interface {
|
|||||||
GetUses() []string
|
GetUses() []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PackageSet interface {
|
||||||
|
GetPackages() []Package
|
||||||
|
AddPackages(pkgs []Package)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DefaultPackages struct {
|
||||||
|
Packages []Package
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tree interface {
|
||||||
|
GetPackageSet() PackageSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pkgs *DefaultPackages) GetPackages() []Package {
|
||||||
|
return pkgs.Packages
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *DefaultPackages) AddPackages(pkgs []Package) {
|
||||||
|
p.Packages = append(p.Packages, pkgs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPackages(p []Package) PackageSet { return &DefaultPackages{Packages: p} }
|
||||||
|
|
||||||
// DefaultPackage represent a standard package definition
|
// DefaultPackage represent a standard package definition
|
||||||
type DefaultPackage struct {
|
type DefaultPackage struct {
|
||||||
Name string
|
Name string
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
package pkg_test
|
package pkg_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/crillab/gophersat/bf"
|
|
||||||
. "github.com/mudler/luet/pkg/package"
|
. "github.com/mudler/luet/pkg/package"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
@@ -84,7 +83,7 @@ var _ = Describe("Package", func() {
|
|||||||
a1 := NewPackage("A", "1.0", []*DefaultPackage{}, []*DefaultPackage{})
|
a1 := NewPackage("A", "1.0", []*DefaultPackage{}, []*DefaultPackage{})
|
||||||
f, err := a1.BuildFormula()
|
f, err := a1.BuildFormula()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(f).To(Equal([]bf.Formula(nil)))
|
Expect(f).To(BeNil())
|
||||||
})
|
})
|
||||||
It("builds constraints correctly", func() {
|
It("builds constraints correctly", func() {
|
||||||
a11 := NewPackage("A", "1.1", []*DefaultPackage{}, []*DefaultPackage{})
|
a11 := NewPackage("A", "1.1", []*DefaultPackage{}, []*DefaultPackage{})
|
||||||
|
Reference in New Issue
Block a user