Skip to content

Commit

Permalink
fix(pkg): Minor fixes affecting packaging kernel (#1967)
Browse files Browse the repository at this point in the history
Reviewed-by: Cezar Craciunoiu <[email protected]>
Approved-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc authored Nov 21, 2024
2 parents b64f58f + 5b3a40c commit c204c38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/cli/kraft/pkg/packager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ type packager interface {
// is used with the controller.
func packagers() []packager {
return []packager{
&packagerCliKernel{},
&packagerKraftfileUnikraft{},
&packagerKraftfileRuntime{},
&packagerCliKernel{},
&packagerDockerfile{},
}
}
8 changes: 6 additions & 2 deletions internal/cli/kraft/pkg/packager_cli_kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package pkg
import (
"context"
"fmt"
"strings"

"kraftkit.sh/config"
"kraftkit.sh/internal/cli/kraft/utils"
Expand All @@ -29,12 +30,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")
Expand Down

0 comments on commit c204c38

Please sign in to comment.