From 2e0bc5c424d929ce648d2e3f97212e254554ebc9 Mon Sep 17 00:00:00 2001 From: Alexander Jung Date: Thu, 21 Nov 2024 17:13:47 +0100 Subject: [PATCH] feat(pkg): Intelligently handle architecture in `--plat` flag Signed-off-by: Alexander Jung --- internal/cli/kraft/pkg/packager_cli_kernel.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/cli/kraft/pkg/packager_cli_kernel.go b/internal/cli/kraft/pkg/packager_cli_kernel.go index 8082ebc8e..202e36dca 100644 --- a/internal/cli/kraft/pkg/packager_cli_kernel.go +++ b/internal/cli/kraft/pkg/packager_cli_kernel.go @@ -29,12 +29,15 @@ func (p *packagerCliKernel) String() string { // Packagable implements packager. func (p *packagerCliKernel) Packagable(ctx context.Context, opts *PkgOptions, args ...string) (bool, error) { - if len(opts.Kernel) > 0 && len(opts.Architecture) > 0 && len(opts.Platform) > 0 { + if len(opts.Kernel) > 0 && len(opts.Platform) > 0 { + if len(opts.Architecture) == 0 && strings.Contains(opts.Platform, "/") { + opts.Platform, opts.Architecture, _ = strings.Cut(opts.Platform, "/") + } return true, nil } if len(opts.Kernel) > 0 { - log.G(ctx).Warn("--kernel flag set but must be used in conjunction with -m|--arch and -p|--plat") + log.G(ctx).Warn("--kernel flag set but must be used in conjunction with -m|--arch and/or -p|--plat") } return false, fmt.Errorf("cannot package without path to -k|-kernel, -m|--arch and -p|--plat")