mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 07:45:02 +00:00
Add package buildtimestamp and luet upgrade --sync
Annotate the package build time when compiling, and use that from the client to force upgrade of packages that changed the artifact, but didn't changed any version. The client can trigger this behavior with `luet upgrade --sync`
This commit is contained in:
@@ -107,6 +107,9 @@ type Package interface {
|
||||
HumanReadableString() string
|
||||
HashFingerprint(string) string
|
||||
|
||||
SetBuildTimestamp(s string)
|
||||
GetBuildTimestamp() string
|
||||
|
||||
Clone() Package
|
||||
}
|
||||
|
||||
@@ -170,9 +173,10 @@ type DefaultPackage struct {
|
||||
// Path is set only internally when tree is loaded from disk
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
Description string `json:"description,omitempty"`
|
||||
Uri []string `json:"uri,omitempty"`
|
||||
License string `json:"license,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Uri []string `json:"uri,omitempty"`
|
||||
License string `json:"license,omitempty"`
|
||||
BuildTimestamp string `json:"buildtimestamp,omitempty"`
|
||||
|
||||
Labels map[string]string `json:"labels,omitempty"` // Affects YAML field names too.
|
||||
}
|
||||
@@ -207,7 +211,7 @@ func (p *DefaultPackage) GetFingerPrint() string {
|
||||
|
||||
func (p *DefaultPackage) HashFingerprint(salt string) string {
|
||||
h := md5.New()
|
||||
io.WriteString(h, fmt.Sprintf("%s-%s",p.GetFingerPrint(),salt))
|
||||
io.WriteString(h, fmt.Sprintf("%s-%s", p.GetFingerPrint(), salt))
|
||||
return fmt.Sprintf("%x", h.Sum(nil))
|
||||
}
|
||||
|
||||
@@ -229,6 +233,16 @@ func (p *DefaultPackage) GetPackageName() string {
|
||||
return fmt.Sprintf("%s-%s", p.Name, p.Category)
|
||||
}
|
||||
|
||||
// GetBuildTimestamp returns the package build timestamp
|
||||
func (p *DefaultPackage) GetBuildTimestamp() string {
|
||||
return p.BuildTimestamp
|
||||
}
|
||||
|
||||
// SetBuildTimestamp sets the package Build timestamp
|
||||
func (p *DefaultPackage) SetBuildTimestamp(s string) {
|
||||
p.BuildTimestamp = s
|
||||
}
|
||||
|
||||
// GetPath returns the path where the definition file was found
|
||||
func (p *DefaultPackage) GetPath() string {
|
||||
return p.Path
|
||||
|
Reference in New Issue
Block a user