Skip to content

Commit

Permalink
bib: avoid duplicating resolvers
Browse files Browse the repository at this point in the history
When not doing a cross arch build use the same resolver as host
and target arch are the same. Also expand the comment a bit.
  • Loading branch information
mvo5 authored and achilleas-k committed Feb 15, 2024
1 parent f2a3f80 commit cce078c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,24 @@ func makeManifest(c *ManifestConfig, cacheRoot string) (manifest.OSBuildManifest
depsolvedSets[name] = res
}

// resolve container
hostArch := arch.Current()
resolverNative := container.NewResolver(hostArch.String())
resolverTarget := container.NewResolver(c.Architecture.String())
// Resolve container - the normal case is that host and target
// architecture are the same. However it is possible to build
// cross-arch images. When this is done the "build" pipeline
// will run with the "native" architecture of the target
// container and the other pipelines (usually just "image"
// will use the target architecture).
hostArch := arch.Current().String()
targetArch := c.Architecture.String()

resolverNative := container.NewResolver(hostArch)
resolverTarget := resolverNative
if hostArch != targetArch {
resolverTarget = container.NewResolver(targetArch)
}

containerSpecs := make(map[string][]container.Spec)
for plName, sourceSpecs := range manifest.GetContainerSourceSpecs() {
var resolver container.Resolver
var resolver *container.Resolver
if plName == "build" {
resolver = resolverNative
} else {
Expand Down

0 comments on commit cce078c

Please sign in to comment.