mirror of
https://github.com/mudler/luet.git
synced 2025-08-30 21:52:10 +00:00
Add packageset
This commit is contained in:
parent
db90a8f69c
commit
0813f75546
@ -52,6 +52,29 @@ type Package interface {
|
||||
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
|
||||
type DefaultPackage struct {
|
||||
Name string
|
||||
|
@ -16,7 +16,6 @@
|
||||
package pkg_test
|
||||
|
||||
import (
|
||||
"github.com/crillab/gophersat/bf"
|
||||
. "github.com/mudler/luet/pkg/package"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -84,7 +83,7 @@ var _ = Describe("Package", func() {
|
||||
a1 := NewPackage("A", "1.0", []*DefaultPackage{}, []*DefaultPackage{})
|
||||
f, err := a1.BuildFormula()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(f).To(Equal([]bf.Formula(nil)))
|
||||
Expect(f).To(BeNil())
|
||||
})
|
||||
It("builds constraints correctly", func() {
|
||||
a11 := NewPackage("A", "1.1", []*DefaultPackage{}, []*DefaultPackage{})
|
||||
|
Loading…
Reference in New Issue
Block a user