mirror of
https://github.com/mudler/luet.git
synced 2025-09-05 01:00:44 +00:00
@@ -52,10 +52,10 @@ func (i ArtifactIndex) CleanPath() ArtifactIndex {
|
|||||||
// which will consist in just of an repository.yaml which is just the repository structure with the list of package artifact.
|
// which will consist in just of an repository.yaml which is just the repository structure with the list of package artifact.
|
||||||
// In this way a generic client can fetch the packages and, after unpacking the tree, performing queries to install packages.
|
// In this way a generic client can fetch the packages and, after unpacking the tree, performing queries to install packages.
|
||||||
type PackageArtifact struct {
|
type PackageArtifact struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Dependencies []*PackageArtifact `json:"dependencies"`
|
Dependencies []*PackageArtifact `json:"dependencies"`
|
||||||
CompileSpec *LuetCompilationSpec `json:"compilationspec"`
|
CompileSpec *LuetCompilationSpec `json:"compilationspec"`
|
||||||
|
Checksums Checksums `json:"checksums"`
|
||||||
SourceAssertion solver.PackagesAssertions `json:"-"`
|
SourceAssertion solver.PackagesAssertions `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ func NewPackageArtifact(path string) Artifact {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewPackageArtifactFromYaml(data []byte) (Artifact, error) {
|
func NewPackageArtifactFromYaml(data []byte) (Artifact, error) {
|
||||||
p := &PackageArtifact{}
|
p := &PackageArtifact{Checksums: Checksums{}}
|
||||||
err := yaml.Unmarshal(data, &p)
|
err := yaml.Unmarshal(data, &p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return p, err
|
return p, err
|
||||||
@@ -73,7 +73,30 @@ func NewPackageArtifactFromYaml(data []byte) (Artifact, error) {
|
|||||||
return p, err
|
return p, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *PackageArtifact) Hash() error {
|
||||||
|
return a.Checksums.Generate(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *PackageArtifact) Verify() error {
|
||||||
|
sum := Checksums{}
|
||||||
|
err := sum.Generate(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = sum.Compare(a.Checksums)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (a *PackageArtifact) WriteYaml(dst string) error {
|
func (a *PackageArtifact) WriteYaml(dst string) error {
|
||||||
|
// First compute checksum of artifact. When we write the yaml we want to write up-to-date informations.
|
||||||
|
err := a.Hash()
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "Failed generating checksums for artifact")
|
||||||
|
}
|
||||||
|
|
||||||
//p := a.CompileSpec.GetPackage().GetPath()
|
//p := a.CompileSpec.GetPackage().GetPath()
|
||||||
|
|
||||||
//a.CompileSpec.GetPackage().SetPath("")
|
//a.CompileSpec.GetPackage().SetPath("")
|
||||||
|
@@ -65,6 +65,8 @@ type Artifact interface {
|
|||||||
Unpack(dst string, keepPerms bool) error
|
Unpack(dst string, keepPerms bool) error
|
||||||
Compress(src string) error
|
Compress(src string) error
|
||||||
FileList() ([]string, error)
|
FileList() ([]string, error)
|
||||||
|
Hash() error
|
||||||
|
Verify() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArtifactNode struct {
|
type ArtifactNode struct {
|
||||||
|
Reference in New Issue
Block a user