build-haks now accepts --source-manifest <path>

When that flag is used, sow-tools:
- collects only the assets referenced by that manifest subset
- skips full-project chunk planning for the per-archive run
- reconstructs just the requested archive chunks from the manifest
This commit is contained in:
2026-04-14 12:12:42 +02:00
parent 9577bc853b
commit ab18baf067
3 changed files with 104 additions and 19 deletions
+17 -5
View File
@@ -179,9 +179,10 @@ func runBuildModule(ctx context) error {
}
type buildHAKOptions struct {
filteredHAKs []string
filteredHAKs []string
filteredArchives []string
planOnly bool
sourceManifest string
planOnly bool
}
func runBuildHAKs(ctx context) error {
@@ -207,8 +208,9 @@ func runBuildHAKs(ctx context) error {
result, err = pipeline.PlanHAKsWithProgress(p, progress)
} else {
result, err = pipeline.BuildHAKsWithOptions(p, pipeline.BuildHAKOptions{
Progress: progress,
ArchiveNames: opts.filteredArchives,
Progress: progress,
ArchiveNames: opts.filteredArchives,
SourceManifestPath: opts.sourceManifest,
})
}
if err != nil {
@@ -234,7 +236,7 @@ func parseBuildHAKArgs(args []string) (buildHAKOptions, error) {
arg := args[index]
switch arg {
case "-h", "--help":
return opts, errors.New("usage: build-haks [--hak <hak-name> ...] [--archive <archive-name> ...] [--plan-only]")
return opts, errors.New("usage: build-haks [--hak <hak-name> ...] [--archive <archive-name> ...] [--source-manifest <path>] [--plan-only]")
case "--hak":
index++
if index >= len(args) {
@@ -249,6 +251,12 @@ func parseBuildHAKArgs(args []string) (buildHAKOptions, error) {
opts.filteredArchives = append(opts.filteredArchives, args[index])
case "--plan-only":
opts.planOnly = true
case "--source-manifest":
index++
if index >= len(args) {
return opts, errors.New("--source-manifest requires a value")
}
opts.sourceManifest = args[index]
default:
if value, ok := parseInlineFlagValue(arg, "--hak"); ok {
opts.filteredHAKs = append(opts.filteredHAKs, value)
@@ -258,6 +266,10 @@ func parseBuildHAKArgs(args []string) (buildHAKOptions, error) {
opts.filteredArchives = append(opts.filteredArchives, value)
continue
}
if value, ok := parseInlineFlagValue(arg, "--source-manifest"); ok {
opts.sourceManifest = value
continue
}
return opts, fmt.Errorf("unknown build-haks argument %q", arg)
}
}