Resolve supplied products from local records
This commit is contained in:
@@ -78,3 +78,53 @@ func SuppliedTranscriptCoverage(paths SessionPaths, collection *manifest.Supplie
|
||||
}
|
||||
return covered
|
||||
}
|
||||
|
||||
// hydrateSuppliedProduct publishes one valid supplied identity to the runtime catalog.
|
||||
func (c *ArtifactCatalog) hydrateSuppliedProduct(paths SessionPaths, m *manifest.Manifest, source, configuredPath string) bool {
|
||||
if c == nil || m == nil || m.SuppliedProducts == nil {
|
||||
return false
|
||||
}
|
||||
record, ok := m.SuppliedProducts.Products[source]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
canonical, err := ProductRelativePath(paths.Root, configuredPath)
|
||||
if err != nil || ValidateSuppliedProduct(paths, source, canonical, record) != nil {
|
||||
return false
|
||||
}
|
||||
path := filepath.Join(paths.Root, filepath.FromSlash(record.Path))
|
||||
if err := c.markAvailable(source, path, ArtifactProvenanceSupplied); err != nil {
|
||||
return false
|
||||
}
|
||||
entry := c.entries[source]
|
||||
entry.CanonicalRelPath = canonical
|
||||
entry.Contract = cloneArtifactContract(record.Contract)
|
||||
entry.Checksum = record.Checksum
|
||||
entry.Size = record.Size
|
||||
c.entries[source] = entry
|
||||
return true
|
||||
}
|
||||
|
||||
// SuppliedExtractionComplete reports whether every configured extraction product
|
||||
// is available as a valid supplied product, independent of generation history.
|
||||
func SuppliedExtractionComplete(paths SessionPaths, m *manifest.Manifest, configured map[string]ExtractionArtifactDefinition) bool {
|
||||
if m == nil || m.SuppliedProducts == nil || len(configured) == 0 {
|
||||
return false
|
||||
}
|
||||
for key, definition := range configured {
|
||||
source := ExtractionArtifactSourceID(key)
|
||||
filename := definition.Filename
|
||||
if filename == "" {
|
||||
filename = key + ".json"
|
||||
}
|
||||
path, err := ProductRelativePath(paths.Root, filepath.Join("artifacts", filename))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
record, ok := m.SuppliedProducts.Products[source]
|
||||
if !ok || ValidateSuppliedProduct(paths, source, path, record) != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user