mirror of
https://github.com/mudler/luet.git
synced 2025-09-09 11:10:07 +00:00
Add package category and make fingerprint more unique
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/crillab/gophersat/bf"
|
"github.com/crillab/gophersat/bf"
|
||||||
version "github.com/hashicorp/go-version"
|
version "github.com/hashicorp/go-version"
|
||||||
|
|
||||||
@@ -37,8 +39,11 @@ type Package interface {
|
|||||||
GetRequires() []*DefaultPackage
|
GetRequires() []*DefaultPackage
|
||||||
GetConflicts() []*DefaultPackage
|
GetConflicts() []*DefaultPackage
|
||||||
Expand([]Package) ([]Package, error)
|
Expand([]Package) ([]Package, error)
|
||||||
|
SetCategory(string)
|
||||||
|
|
||||||
GetName() string
|
GetName() string
|
||||||
|
GetCategory() string
|
||||||
|
|
||||||
GetVersion() string
|
GetVersion() string
|
||||||
RequiresContains(Package) bool
|
RequiresContains(Package) bool
|
||||||
|
|
||||||
@@ -51,6 +56,7 @@ type Package interface {
|
|||||||
type DefaultPackage struct {
|
type DefaultPackage struct {
|
||||||
Name string
|
Name string
|
||||||
Version string
|
Version string
|
||||||
|
Category string
|
||||||
UseFlags []string
|
UseFlags []string
|
||||||
State State
|
State State
|
||||||
PackageRequires []*DefaultPackage
|
PackageRequires []*DefaultPackage
|
||||||
@@ -69,7 +75,7 @@ func NewPackage(name, version string, requires []*DefaultPackage, conflicts []*D
|
|||||||
// GetFingerPrint returns a UUID of the package.
|
// GetFingerPrint returns a UUID of the package.
|
||||||
// FIXME: this needs to be unique, now just name is generalized
|
// FIXME: this needs to be unique, now just name is generalized
|
||||||
func (p *DefaultPackage) GetFingerPrint() string {
|
func (p *DefaultPackage) GetFingerPrint() string {
|
||||||
return p.Name
|
return fmt.Sprintf("%s-%s-%s", p.Name, p.Category, p.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddUse adds a use to a package
|
// AddUse adds a use to a package
|
||||||
@@ -116,6 +122,13 @@ func (p *DefaultPackage) GetVersion() string {
|
|||||||
return p.Version
|
return p.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *DefaultPackage) GetCategory() string {
|
||||||
|
return p.Category
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *DefaultPackage) SetCategory(s string) {
|
||||||
|
p.Category = s
|
||||||
|
}
|
||||||
func (p *DefaultPackage) GetUses() []string {
|
func (p *DefaultPackage) GetUses() []string {
|
||||||
return p.UseFlags
|
return p.UseFlags
|
||||||
}
|
}
|
||||||
|
@@ -95,8 +95,8 @@ var _ = Describe("Package", func() {
|
|||||||
f, err := a1.BuildFormula()
|
f, err := a1.BuildFormula()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(len(f)).To(Equal(2))
|
Expect(len(f)).To(Equal(2))
|
||||||
Expect(f[0].String()).To(Equal("or(not(1c6f6460), 0e78200a)"))
|
Expect(f[0].String()).To(Equal("or(not(d698a46c), 0dc06f33)"))
|
||||||
Expect(f[1].String()).To(Equal("or(not(1c6f6460), not(039f5fc3))"))
|
Expect(f[1].String()).To(Equal("or(not(d698a46c), not(2e57efc4))"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user