From 983d04951325ad4a71ef05f733748a56afb31b02 Mon Sep 17 00:00:00 2001 From: JustSaft <69754418+justsaft@users.noreply.github.com> Date: Wed, 11 Mar 2026 17:54:57 +0100 Subject: [PATCH 1/6] implements improved error handling --- cmd/build.go | 4 +- core/build.go | 297 +++++++++++++++++++++++++++++++++++++++--------- core/plugins.in | 26 +++-- core/shell.go | 32 +++--- 4 files changed, 275 insertions(+), 84 deletions(-) diff --git a/cmd/build.go b/cmd/build.go index 9f03199..8da9505 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -77,12 +77,12 @@ func buildCommand(cmd *cobra.Command, args []string) error { */ extension := strings.ToLower(strings.TrimLeft(filepath.Ext(recipePath), ".")) if len(extension) == 0 || (extension != "yml" && extension != "yaml") { - return fmt.Errorf("%s is an invalid recipe file", recipePath) + return fmt.Errorf("Recipe `%s` is an invalid recipe file", recipePath) } // Check whether the provided file exists, if not, then return an error if _, err := os.Stat(recipePath); errors.Is(err, os.ErrNotExist) { - return fmt.Errorf("%s does not exist", recipePath) + return fmt.Errorf("Recipe `%s` does not exist", recipePath) } } diff --git a/core/build.go b/core/build.go index d730eba..7e8efde 100644 --- a/core/build.go +++ b/core/build.go @@ -3,6 +3,7 @@ package core import ( "errors" "fmt" + "io/fs" "os" "path/filepath" "strings" @@ -11,6 +12,11 @@ import ( "github.com/vanilla-os/vib/api" ) +var modulesCount int +var includeDepth int +var maxIncludeDepth = 1 +var errorCount = 0 + // Add a WORKDIR instruction to the containerfile func ChangeWorkingDirectory(workdir string, containerfile *os.File) error { if workdir != "" { @@ -46,7 +52,7 @@ func BuildRecipe(recipePath string, arch string, containerfilePath string) (api. return api.Recipe{}, err } - fmt.Printf("Building recipe %s\n", recipe.Name) + fmt.Printf("Building recipe `%s`\n", recipe.Name) // assuming the Containerfile location is relative if len(containerfilePath) == 0 { @@ -331,44 +337,177 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { return nil } +func ExhaustCollectedErrors(_errors *[]error) int { + length := len(*_errors) + if length == 0 { + return 0 + } + + for _, err := range *_errors { + fmt.Printf("%v\n", err) + } + + *_errors = nil + errorCount += length + return length +} + +func MapSlicesToInterfaceSlices(inter []map[string]interface{}) []interface{} { + result := make([]interface{}, len(inter)) + for i, m := range inter { + result[i] = m + } + return result +} + +func MapToInterfaceSlices(m map[string]interface{}) []interface{} { + panic("If you need to use this function, you're likely handling module interfaces wrong") + // result := make([]interface{}, 0, len(m)) + // for _, v := range m { + // result = append(result, v) + // } + // return result +} + +func DecodeModuleToGenericModule(module interface{}, errors *[]error) (Module, error) { + var decodedModule Module + var customErr error = nil + defaultErr := mapstructure.Decode(module, &decodedModule) + + if defaultErr != nil { + customErr = fmt.Errorf("error: yaml decode error: failed to decode module to generic module with further error: %v", defaultErr) + (*errors) = append((*errors), customErr) + } + + return decodedModule, customErr +} + +func CollectModulesRecursively(modules []interface{}, allModules *[]interface{}, occurances *map[string][]int, errors *[]error) { + for _, module := range modules { + modulesCount++ + + decodedModule, err := DecodeModuleToGenericModule(module, errors) + if err != nil { + continue + } + + c := 0 + if decodedModule.Name == "" { + c |= 0b10 + } + if decodedModule.Type == "" { + c |= 0b01 + } + + switch c { + case 0b11: + fmt.Printf("error: module name and type cannot be == \"\"") + continue + case 0b10: + fmt.Printf("error: module name cannot be == \"\"") + continue + case 0b01: + fmt.Printf("error: module type cannot be == \"\"") + continue + case 0b00: + // fallthrough + } + + *allModules = append(*allModules, module) + (*occurances)[decodedModule.Name] = append((*occurances)[decodedModule.Name], modulesCount) + + ExhaustCollectedErrors(errors) + + if len(decodedModule.Modules) > 0 { + CollectModulesRecursively(MapSlicesToInterfaceSlices(decodedModule.Modules), allModules, occurances, errors) + } + } +} + // Build commands for each module in the recipe func BuildModules(recipe *api.Recipe, modules []interface{}, arch string, stageName string) ([]ModuleCommand, error) { + var _errors []error + var allModules []interface{} + modNameOccursInMod := make(map[string][]int) + + CollectModulesRecursively(modules, &allModules, &modNameOccursInMod, &_errors) + cmds := []ModuleCommand{} + for _, moduleInterface := range modules { - var module Module - err := mapstructure.Decode(moduleInterface, &module) + decodedModule, cmd, err := BuildModule(recipe, moduleInterface, &allModules, &modNameOccursInMod, arch, stageName, &_errors) if err != nil { - return nil, err - } + if !(decodedModule.Type == "includes" && (errors.Is(err, os.ErrNotExist) || errors.Is(err, fs.ErrNotExist))) { + _errors = append(_errors, err) + } + ExhaustCollectedErrors(&_errors) + fmt.Printf("Building [%s] module `%s`: failed\n", decodedModule.Type, decodedModule.Name) - cmd, err := BuildModule(recipe, moduleInterface, arch, stageName) - if err != nil { - return nil, err + continue } + ExhaustCollectedErrors(&_errors) + cmds = append(cmds, ModuleCommand{ - Name: module.Name, + Name: decodedModule.Name, Command: append(cmd, ""), // add empty entry to ensure proper newline in Containerfile - Workdir: module.Workdir, + Workdir: decodedModule.Workdir, }) } + for _, occurancesInMods := range modNameOccursInMod { + occurances := len(occurancesInMods) + + if occurances > 1 { + decodedModule, err := DecodeModuleToGenericModule(allModules[occurancesInMods[0]], &_errors) + if err != nil { + panic("This module was previously decoded but now fails to. Needs fix in vib codebase.") + } + _errors = append(_errors, fmt.Errorf("error: found ambiguous module with name `%s` %d times:", decodedModule.Name, occurances)) + + for j := range occurances { + if j > 0 { + decodedModule, err = DecodeModuleToGenericModule(allModules[occurancesInMods[j]], &_errors) + } else if err != nil { + continue + } + _errors = append(_errors, fmt.Errorf("note: found in file `%s`", decodedModule.Workdir)) + // TODO: This is not the correct variable to get the file path of the module, which we should display. + } + ExhaustCollectedErrors(&_errors) + errorCount += occurances + } + } + + if errorCount > 0 { + return nil, fmt.Errorf("Encoutered %d errors while building %d modules\n", errorCount, modulesCount) + } + return cmds, nil } -func buildIncludesModule(moduleInterface interface{}, recipe *api.Recipe, arch string, stageName string) (string, error) { - var include IncludesModule - err := mapstructure.Decode(moduleInterface, &include) - if err != nil { - return "", err +func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, arch string, stageName string, _errors *[]error) (string, error) { + // Note: errors is called _errors here because this function needs the errors package. + + includeDepth++ + defer func() { includeDepth-- }() + + var includeModule IncludesModule + if _err := mapstructure.Decode(module, &includeModule); _err != nil { + return "", _err + } + + if includeDepth > 1 { + return "", fmt.Errorf("[includes] module nesting is currently limited to `%d` layers.\n Found includes module in `%s`\n", maxIncludeDepth, includeModule.Name) } - if len(include.Includes) == 0 { - return "", errors.New("includes module must have at least one module to include") + if len(includeModule.Includes) == 0 { + return "", fmt.Errorf("[includes] module `%s` must have at least one module to include", includeModule.Name) } var commands []string - for _, include := range include.Includes { + var err error = nil + for _, include := range includeModule.Includes { var modulePath string // in case of a remote include, we need to download the @@ -391,74 +530,120 @@ func buildIncludesModule(moduleInterface interface{}, recipe *api.Recipe, arch s modulePath = filepath.Join(recipe.ParentPath, include) } - includeModule, err := GenModule(modulePath) - if err != nil { - return "", err + generatedModule, _err := GenModule(modulePath) + + if errors.Is(_err, os.ErrNotExist) || errors.Is(_err, fs.ErrNotExist) { + customErr := fmt.Errorf("error: [%s] module `%s` includes\n `%s`,\n which doesn't exist", includeModule.Type, includeModule.Name, modulePath) + + (*_errors) = append(*_errors, customErr) + (*_errors) = append(*_errors, _err) + + err = _err + continue + } else if _err != nil { + (*_errors) = append(*_errors, _err) + return "", _err } - buildModule, err := BuildModule(recipe, includeModule, arch, stageName) - if err != nil { - return "", err + ExhaustCollectedErrors(_errors) + + var _errors []error // temporary + + decodedModule, cmd, _err := BuildModule(recipe, generatedModule, allModules, occurances, arch, stageName, &_errors) + if _err != nil { + // _errors = append(_errors, _err) + ExhaustCollectedErrors(&_errors) + err = _err + continue + } + + commands = append(commands, cmd...) + *allModules = append(*allModules, decodedModule) + (*occurances)[decodedModule.Name] = append((*occurances)[decodedModule.Name], modulesCount) + + fmt.Printf("Building all %d submodules of [%s] module `%s` included in `%s`\n", len(decodedModule.Modules), decodedModule.Type, decodedModule.Name, includeModule.Name) + var failed bool = false + includeModuleIdx := len(*allModules) + CollectModulesRecursively(MapSlicesToInterfaceSlices(decodedModule.Modules), allModules, occurances, &_errors) + + modulesLeftToBuild := len(*allModules) - includeModuleIdx + + for i := modulesLeftToBuild; i > 0; i-- { + _, buildModule, _err := BuildModule(recipe, (*allModules)[len(*allModules)-i], allModules, occurances, arch, stageName, &_errors) + if _err != nil { + ExhaustCollectedErrors(&_errors) + fmt.Printf("%d/%d Building [%s] module of submodule `%s` included in `%s`: failed\n", i, len(decodedModule.Modules), decodedModule.Type, decodedModule.Name, includeModule.Name) + failed = true + err = _err + continue + } + + commands = append(commands, buildModule...) + } + + ExhaustCollectedErrors(&_errors) + if failed { + fmt.Printf("Building all %d submodules of [%s] module `%s` included in `%s`: failed\n", len(decodedModule.Modules), decodedModule.Type, decodedModule.Name, includeModule.Name) + } else { + fmt.Printf("Buildung all %d submodules of [%s] module `%s` included in `%s`: success\n", len(decodedModule.Modules), decodedModule.Type, decodedModule.Name, includeModule.Name) } - commands = append(commands, buildModule...) } - return strings.Join(commands, "\n"), nil + return strings.Join(commands, "\n"), err } // Build a command string for the given module in the recipe -func BuildModule(recipe *api.Recipe, moduleInterface interface{}, arch string, stageName string) ([]string, error) { - var module Module - err := mapstructure.Decode(moduleInterface, &module) +func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, arch string, stageName string, _errors *[]error) (Module, []string, error) { + decodedModule, err := DecodeModuleToGenericModule(module, _errors) if err != nil { - return []string{""}, err + return decodedModule, []string{""}, err } - fmt.Printf("Building module [%s] of type [%s]\n", module.Name, module.Type) + commands := []string{fmt.Sprintf("\n# Begin Module %s - %s", decodedModule.Name, decodedModule.Type)} + defer func() { + commands = append(commands, fmt.Sprintf("# End Module %s - %s\n", decodedModule.Name, decodedModule.Type)) + }() - commands := []string{fmt.Sprintf("\n# Begin Module %s - %s", module.Name, module.Type)} + fmt.Printf("Building [%s] module `%s`\n", decodedModule.Type, decodedModule.Name) - if len(module.Modules) > 0 { - for _, nestedModule := range module.Modules { - buildModule, err := BuildModule(recipe, nestedModule, arch, stageName) - if err != nil { - return []string{""}, err - } - commands = append(commands, buildModule...) - } - } - - switch module.Type { + switch decodedModule.Type { case "shell": - command, err := BuildShellModule(moduleInterface, recipe, arch) + command, err := BuildShellModule(module, recipe, arch) if err != nil { - return []string{""}, err + return decodedModule, []string{""}, err } commands = append(commands, command) case "includes": - command, err := buildIncludesModule(moduleInterface, recipe, arch, stageName) + command, err := BuildIncludesModule(recipe, module, allModules, occurances, arch, stageName, _errors) if err != nil { - return []string{""}, err + return decodedModule, []string{""}, err } commands = append(commands, command) + case "": + err := fmt.Errorf("error: module `%s` tried to use a plugin but specified no name", decodedModule.Name) + return decodedModule, []string{""}, err default: - command, err := LoadBuildPlugin(module.Type, moduleInterface, recipe, arch) + command, err := LoadBuildPlugin(decodedModule.Type, module, recipe, arch) if err != nil { - return []string{""}, err + return decodedModule, []string{""}, err } commands = append(commands, command...) } - sourcePath := filepath.Join(recipe.SourcesPath, module.Name) - stageSourcePath := filepath.Join(recipe.SourcesPath, stageName, module.Name) + sourcePath := filepath.Join(recipe.SourcesPath, decodedModule.Name) + stageSourcePath := filepath.Join(recipe.SourcesPath, stageName, decodedModule.Name) + _ = os.MkdirAll(sourcePath, 0o777) _ = os.MkdirAll(filepath.Dir(stageSourcePath), 0o777) + err = os.Rename(sourcePath, stageSourcePath) if err != nil { - return []string{}, fmt.Errorf("could not move source: %w", err) + if errors.Is(err, os.ErrExist) || errors.Is(err, fs.ErrExist) { + fmt.Printf("Multiple module name error!\n") + return decodedModule, []string{}, nil + } + return decodedModule, []string{}, fmt.Errorf("could not rename `%s` to `%s`: %w\n", sourcePath, stageSourcePath, err) } - commands = append(commands, fmt.Sprintf("# End Module %s - %s\n", module.Name, module.Type)) - - fmt.Printf("Module [%s] built successfully\n", module.Name) - return commands, nil + fmt.Printf("Building [%s] module `%s`: success\n", decodedModule.Type, decodedModule.Name) + return decodedModule, commands, nil } diff --git a/core/plugins.in b/core/plugins.in index c4b81ea..1a4fa5c 100644 --- a/core/plugins.in +++ b/core/plugins.in @@ -10,8 +10,8 @@ import ( "github.com/vanilla-os/vib/api" ) import ( - "errors" "encoding/base64" + "errors" "os" "syscall" ) @@ -33,10 +33,12 @@ func decodeBuildCmds(cmds string) ([]string, error) { } func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uintptr, api.PluginInfo, error) { - fmt.Println("Loading new plugin") + if len(name) == 0 { + panic("Cannot load a module without its name. Needs a fix in the codebase.") + } + fmt.Println("Loading plugin [%s]", name) projectPluginPath := fmt.Sprintf("%s/%s.so", recipe.PluginPath, name) - installPrefixPath := fmt.Sprintf("%INSTALLPREFIX%/share/vib/plugins/%s.so", name) globalPluginPathsEnv, isXDDDefined := os.LookupEnv("XDG_DATA_DIRS") @@ -64,24 +66,28 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin // of paths to search. var _errors = make([]error, len(allPluginPaths)) + var fail bool = false + for index, path := range allPluginPaths { _, err := os.Stat(path) if err != nil { _errors = append(_errors, err) + if index == lastIndex { - // If the last available path doesn't exist, - // panic with all the error messages. - panic(errors.Join(_errors...)) - } + _errors = append(_errors, fmt.Errorf("error: couldn't find plugin [%s] on your system.\nnote: Please copy it into one of the searched folders above.", )) - continue + for _, _err := range _errors { + fmt.Printf("%v\n", _err) + } + break + } else continue } loadedPlugin, err = purego.Dlopen(path, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { _errors = append(_errors, err) if index == lastIndex { - // If the last available plugin can't be loaded, + // If the last available plugin path can't be loaded, // panic with all the error messages. panic(errors.Join(_errors...)) } @@ -145,7 +151,7 @@ func LoadBuildPlugin(name string, module interface{}, recipe *api.Recipe, arch s buildModule.PluginInfo = pluginInfo openedBuildPlugins[name] = buildModule } - fmt.Printf("Using plugin: %s\n", buildModule.Name) + fmt.Printf("Using plugin [%s]\n", buildModule.Name) moduleJson, err := json.Marshal(module) if err != nil { return []string{""}, err diff --git a/core/shell.go b/core/shell.go index 70b40dc..2d8afe9 100644 --- a/core/shell.go +++ b/core/shell.go @@ -1,7 +1,7 @@ package core import ( - "errors" + "fmt" "strings" "github.com/mitchellh/mapstructure" @@ -19,21 +19,21 @@ type ShellModule struct { // Build shell module commands and return them as a single string // // Returns: Concatenated shell commands or an error if any step fails -func BuildShellModule(moduleInterface interface{}, recipe *api.Recipe, arch string) (string, error) { - var module ShellModule - err := mapstructure.Decode(moduleInterface, &module) - if err != nil { +func BuildShellModule(module interface{}, recipe *api.Recipe, arch string) (string, error) { + var shellModule ShellModule + + if err := mapstructure.Decode(module, &shellModule); err != nil { return "", err } - for _, source := range module.Sources { + for _, source := range shellModule.Sources { if api.TestArch(source.OnlyArches, arch) { if strings.TrimSpace(source.Type) != "" { - err := api.DownloadSource(recipe, source, module.Name) + err := api.DownloadSource(recipe, source, shellModule.Name) if err != nil { return "", err } - err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, source, module.Name) + err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, source, shellModule.Name) if err != nil { return "", err } @@ -41,17 +41,17 @@ func BuildShellModule(moduleInterface interface{}, recipe *api.Recipe, arch stri } } - if len(module.Commands) == 0 { - return "", errors.New("no commands specified") + if len(shellModule.Commands) == 0 { + return "", fmt.Errorf("no commands specified") } - cmd := "" - for i, command := range module.Commands { - cmd += command - if i < len(module.Commands)-1 { - cmd += " && " + var cmd strings.Builder + for i, command := range shellModule.Commands { + cmd.WriteString(command) + if i < len(shellModule.Commands)-1 { + cmd.WriteString(" && ") } } - return "RUN " + cmd, nil + return "RUN " + cmd.String(), nil } From 4dd64eaa62648ff8b91d7e99a9fa6bd2f8d7c447 Mon Sep 17 00:00:00 2001 From: NN708 Date: Mon, 2 Mar 2026 04:35:09 +0000 Subject: [PATCH 2/6] feat: add cleanup property --- api/cleanup.go | 13 +++++++++++++ api/structs.go | 1 + core/build.go | 23 ++++++++++++----------- core/plugins.in | 16 ++++++++++++---- core/shell.go | 4 +++- core/structs.go | 1 + 6 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 api/cleanup.go diff --git a/api/cleanup.go b/api/cleanup.go new file mode 100644 index 0000000..abffa3d --- /dev/null +++ b/api/cleanup.go @@ -0,0 +1,13 @@ +package api + +import ( + "fmt" + "strings" +) + +func GetCleanupSuffix(cleanup []string) string { + if len(cleanup) > 0 { + return fmt.Sprintf(" && rm -rf %s", strings.Join(cleanup, " ")) + } + return "" +} diff --git a/api/structs.go b/api/structs.go index 61b92ed..6c53339 100644 --- a/api/structs.go +++ b/api/structs.go @@ -44,6 +44,7 @@ type Stage struct { Cmd Cmd `json:"cmd"` Modules []interface{} `json:"modules"` Entrypoint Entrypoint + Cleanup []string `json:"cleanup"` } type PluginType int diff --git a/core/build.go b/core/build.go index 7e8efde..ce9b713 100644 --- a/core/build.go +++ b/core/build.go @@ -98,7 +98,7 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { // build the modules* // * actually just build the commands that will be used // in the Containerfile to build the modules - cmds, err := BuildModules(recipe, stage.Modules, arch, stage.Id) + cmds, err := BuildModules(recipe, stage.Modules, stage.Cleanup, arch, stage.Id) if err != nil { return err } @@ -198,9 +198,10 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { return err } + cleanupSuffix := api.GetCleanupSuffix(stage.Cleanup) for _, cmd := range stage.Runs.Commands { _, err = containerfile.WriteString( - fmt.Sprintf("RUN %s\n", cmd), + fmt.Sprintf("RUN %s\n", cmd+cleanupSuffix), ) if err != nil { return err @@ -425,7 +426,7 @@ func CollectModulesRecursively(modules []interface{}, allModules *[]interface{}, } // Build commands for each module in the recipe -func BuildModules(recipe *api.Recipe, modules []interface{}, arch string, stageName string) ([]ModuleCommand, error) { +func BuildModules(recipe *api.Recipe, modules []interface{}, cleanup []string, arch string, stageName string) ([]ModuleCommand, error) { var _errors []error var allModules []interface{} modNameOccursInMod := make(map[string][]int) @@ -435,7 +436,7 @@ func BuildModules(recipe *api.Recipe, modules []interface{}, arch string, stageN cmds := []ModuleCommand{} for _, moduleInterface := range modules { - decodedModule, cmd, err := BuildModule(recipe, moduleInterface, &allModules, &modNameOccursInMod, arch, stageName, &_errors) + decodedModule, cmd, err := BuildModule(recipe, moduleInterface, &allModules, &modNameOccursInMod, cleanup, arch, stageName, &_errors) if err != nil { if !(decodedModule.Type == "includes" && (errors.Is(err, os.ErrNotExist) || errors.Is(err, fs.ErrNotExist))) { _errors = append(_errors, err) @@ -486,7 +487,7 @@ func BuildModules(recipe *api.Recipe, modules []interface{}, arch string, stageN return cmds, nil } -func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, arch string, stageName string, _errors *[]error) (string, error) { +func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, cleanup []string, arch string, stageName string, _errors *[]error) (string, error) { // Note: errors is called _errors here because this function needs the errors package. includeDepth++ @@ -549,7 +550,7 @@ func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]i var _errors []error // temporary - decodedModule, cmd, _err := BuildModule(recipe, generatedModule, allModules, occurances, arch, stageName, &_errors) + decodedModule, cmd, _err := BuildModule(recipe, generatedModule, allModules, occurances, cleanup, arch, stageName, &_errors) if _err != nil { // _errors = append(_errors, _err) ExhaustCollectedErrors(&_errors) @@ -569,7 +570,7 @@ func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]i modulesLeftToBuild := len(*allModules) - includeModuleIdx for i := modulesLeftToBuild; i > 0; i-- { - _, buildModule, _err := BuildModule(recipe, (*allModules)[len(*allModules)-i], allModules, occurances, arch, stageName, &_errors) + _, buildModule, _err := BuildModule(recipe, (*allModules)[len(*allModules)-i], allModules, occurances, cleanup, arch, stageName, &_errors) if _err != nil { ExhaustCollectedErrors(&_errors) fmt.Printf("%d/%d Building [%s] module of submodule `%s` included in `%s`: failed\n", i, len(decodedModule.Modules), decodedModule.Type, decodedModule.Name, includeModule.Name) @@ -592,7 +593,7 @@ func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]i } // Build a command string for the given module in the recipe -func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, arch string, stageName string, _errors *[]error) (Module, []string, error) { +func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface{}, occurances *map[string][]int, cleanup []string, arch string, stageName string, _errors *[]error) (Module, []string, error) { decodedModule, err := DecodeModuleToGenericModule(module, _errors) if err != nil { return decodedModule, []string{""}, err @@ -607,13 +608,13 @@ func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface switch decodedModule.Type { case "shell": - command, err := BuildShellModule(module, recipe, arch) + command, err := BuildShellModule(module, recipe, cleanup, arch) if err != nil { return decodedModule, []string{""}, err } commands = append(commands, command) case "includes": - command, err := BuildIncludesModule(recipe, module, allModules, occurances, arch, stageName, _errors) + command, err := BuildIncludesModule(recipe, module, allModules, occurances, cleanup, arch, stageName, _errors) if err != nil { return decodedModule, []string{""}, err } @@ -622,7 +623,7 @@ func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface err := fmt.Errorf("error: module `%s` tried to use a plugin but specified no name", decodedModule.Name) return decodedModule, []string{""}, err default: - command, err := LoadBuildPlugin(decodedModule.Type, module, recipe, arch) + command, err := LoadBuildPlugin(decodedModule.Type, module, recipe, cleanup, arch) if err != nil { return decodedModule, []string{""}, err } diff --git a/core/plugins.in b/core/plugins.in index 1a4fa5c..61944a1 100644 --- a/core/plugins.in +++ b/core/plugins.in @@ -7,6 +7,7 @@ import ( "strings" "github.com/ebitengine/purego" + "github.com/mitchellh/mapstructure" "github.com/vanilla-os/vib/api" ) import ( @@ -131,7 +132,13 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin return loadedPlugin, *pluginInfo, nil } -func LoadBuildPlugin(name string, module interface{}, recipe *api.Recipe, arch string) ([]string, error) { +func LoadBuildPlugin(name string, moduleInterface interface{}, recipe *api.Recipe, cleanup []string, arch string) ([]string, error) { + var module Module + err := mapstructure.Decode(moduleInterface, &module) + if err != nil { + return []string{""}, err + } + if openedBuildPlugins == nil { openedBuildPlugins = make(map[string]Plugin) } @@ -165,13 +172,14 @@ func LoadBuildPlugin(name string, module interface{}, recipe *api.Recipe, arch s if strings.HasPrefix(res, "ERROR:") { return []string{""}, fmt.Errorf("%s", strings.Replace(res, "ERROR: ", "", 1)) } else if !buildModule.PluginInfo.UseContainerCmds { - return []string{"RUN " + res}, nil + cleanupSuffix := api.GetCleanupSuffix(append(cleanup, module.Cleanup...)) + return []string{"RUN " + res + cleanupSuffix}, nil } else { return decodeBuildCmds(res) } } -func LoadFinalizePlugin(name string, module interface{}, recipe *api.Recipe, arch string, runtime string, isRoot bool, origGid int, origUid int) error { +func LoadFinalizePlugin(name string, moduleInterface interface{}, recipe *api.Recipe, arch string, runtime string, isRoot bool, origGid int, origUid int) error { if openedFinalizePlugins == nil { openedFinalizePlugins = make(map[string]Plugin) } @@ -235,7 +243,7 @@ func LoadFinalizePlugin(name string, module interface{}, recipe *api.Recipe, arc } scopedata.FS = mountpoint } - moduleJson, err := json.Marshal(module) + moduleJson, err := json.Marshal(moduleInterface) if err != nil { return err } diff --git a/core/shell.go b/core/shell.go index 2d8afe9..0545cbf 100644 --- a/core/shell.go +++ b/core/shell.go @@ -14,12 +14,13 @@ type ShellModule struct { Type string `json:"type"` Sources []api.Source Commands []string + Cleanup []string } // Build shell module commands and return them as a single string // // Returns: Concatenated shell commands or an error if any step fails -func BuildShellModule(module interface{}, recipe *api.Recipe, arch string) (string, error) { +func BuildShellModule(module interface{}, recipe *api.Recipe, cleanup []string, arch string) (string, error) { var shellModule ShellModule if err := mapstructure.Decode(module, &shellModule); err != nil { @@ -52,6 +53,7 @@ func BuildShellModule(module interface{}, recipe *api.Recipe, arch string) (stri cmd.WriteString(" && ") } } + cmd.WriteString(api.GetCleanupSuffix(append(cleanup, shellModule.Cleanup...))) return "RUN " + cmd.String(), nil } diff --git a/core/structs.go b/core/structs.go index d794b33..7633e31 100644 --- a/core/structs.go +++ b/core/structs.go @@ -10,6 +10,7 @@ type Module struct { Type string `json:"type"` Modules []map[string]interface{} Content []byte // The entire module unparsed as a []byte, used by plugins + Cleanup []string `json:"cleanup"` } // Configuration for finalization steps From 246b8b56eb97d9c7d73ff864ba5b4107776f8e60 Mon Sep 17 00:00:00 2001 From: NN708 Date: Fri, 27 Feb 2026 07:30:17 +0000 Subject: [PATCH 3/6] deps: upgrade dependencies --- core/finalize.go | 2 +- go.mod | 43 ++++------- go.sum | 195 +++++++---------------------------------------- 3 files changed, 45 insertions(+), 195 deletions(-) diff --git a/core/finalize.go b/core/finalize.go index e318e59..8256086 100644 --- a/core/finalize.go +++ b/core/finalize.go @@ -2,7 +2,7 @@ package core import ( "fmt" - cstorage "github.com/containers/storage" + cstorage "go.podman.io/storage" "os/exec" "strings" ) diff --git a/go.mod b/go.mod index aaf8447..8619eb9 100644 --- a/go.mod +++ b/go.mod @@ -1,35 +1,28 @@ module github.com/vanilla-os/vib -go 1.24.0 +go 1.25.0 require ( - github.com/containers/storage v1.59.1 - github.com/ebitengine/purego v0.9.0 + github.com/ebitengine/purego v0.10.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/spf13/cobra v1.10.1 - github.com/vanilla-os/vib/api v0.0.0-20251020162135-a8680c18c354 + github.com/spf13/cobra v1.10.2 + github.com/vanilla-os/vib/api v0.0.0-20260302155300-20bdf619aaba + go.podman.io/storage v1.62.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/BurntSushi/toml v1.5.0 // indirect - github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/Microsoft/hcsshim v0.13.0 // indirect - github.com/containerd/cgroups/v3 v3.0.5 // indirect - github.com/containerd/errdefs v1.0.0 // indirect - github.com/containerd/errdefs/pkg v0.3.0 // indirect - github.com/containerd/typeurl/v2 v2.2.3 // indirect - github.com/cyphar/filepath-securejoin v0.5.0 // indirect + cyphar.com/go-pathrs v0.2.4 // indirect + github.com/BurntSushi/toml v1.6.0 // indirect + github.com/cyphar/filepath-securejoin v0.5.2 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/go-intervals v0.0.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.18.1 // indirect + github.com/klauspost/compress v1.18.4 // indirect github.com/klauspost/pgzip v1.2.6 // indirect - github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/mistifyio/go-zfs/v3 v3.1.0 // indirect github.com/moby/sys/capability v0.4.0 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect @@ -37,22 +30,16 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/runtime-spec v1.2.1 // indirect - github.com/opencontainers/selinux v1.12.0 // indirect - github.com/pkg/errors v0.9.1 // indirect + github.com/opencontainers/runtime-spec v1.3.0 // indirect + github.com/opencontainers/selinux v1.13.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sirupsen/logrus v1.9.4 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/tchap/go-patricia/v2 v2.3.3 // indirect github.com/ulikunitz/xz v0.5.15 // indirect github.com/vbatts/tar-split v0.12.2 // indirect - go.opencensus.io v0.24.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.37.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 // indirect - google.golang.org/grpc v1.76.0 // indirect - google.golang.org/protobuf v1.36.10 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + golang.org/x/sync v0.19.0 // indirect + golang.org/x/sys v0.41.0 // indirect ) replace github.com/vanilla-os/vib/api => ./api diff --git a/go.sum b/go.sum index 4cd8d79..8024d32 100644 --- a/go.sum +++ b/go.sum @@ -1,69 +1,24 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= -github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= -github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/Microsoft/hcsshim v0.13.0 h1:/BcXOiS6Qi7N9XqUcv27vkIuVOkBEcWstd2pMlWSeaA= -github.com/Microsoft/hcsshim v0.13.0/go.mod h1:9KWJ/8DgU+QzYGupX4tzMhRQE8h6w90lH6HAaclpEok= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo= -github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins= -github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= -github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= -github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= -github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= -github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40= -github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= -github.com/containers/storage v1.59.1 h1:11Zu68MXsEQGBBd+GadPrHPpWeqjKS8hJDGiAHgIqDs= -github.com/containers/storage v1.59.1/go.mod h1:KoAYHnAjP3/cTsRS+mmWZGkufSY2GACiKQ4V3ZLQnR0= +cyphar.com/go-pathrs v0.2.4 h1:iD/mge36swa1UFKdINkr1Frkpp6wZsy3YYEildj9cLY= +cyphar.com/go-pathrs v0.2.4/go.mod h1:y8f1EMG7r+hCuFf/rXsKqMJrJAUoADZGNh5/vZPKcGc= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.5.0 h1:hIAhkRBMQ8nIeuVwcAoymp7MY4oherZdAxD+m0u9zaw= -github.com/cyphar/filepath-securejoin v0.5.0/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= +github.com/cyphar/filepath-securejoin v0.5.2 h1:w/T2bhKr4pgwG0SUGjU4S/Is9+zUknLh5ROTJLzWX8E= +github.com/cyphar/filepath-securejoin v0.5.2/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k= -github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= +github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-intervals v0.0.2 h1:FGrVEiUnTRKR8yE04qzXYaJMtnIYqobR5QbblK3ixcM= github.com/google/go-intervals v0.0.2/go.mod h1:MkaR3LNRfeKLPmqgJYs4E66z5InYjmCjbbr4TQlcT6Y= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -71,17 +26,12 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co= -github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0= +github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c= +github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mistifyio/go-zfs/v3 v3.1.0 h1:FZaylcg0hjUp27i23VcJJQiuBeAZjrC8lPqCGM1CopY= @@ -101,131 +51,44 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/runtime-spec v1.2.1 h1:S4k4ryNgEpxW1dzyqffOmhI1BHYcjzU8lpJfSlR0xww= -github.com/opencontainers/runtime-spec v1.2.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.12.0 h1:6n5JV4Cf+4y0KNXW48TLj5DwfXpvWlxXplUkdTrmPb8= -github.com/opencontainers/selinux v1.12.0/go.mod h1:BTPX+bjVbWGXw7ZZWUbdENt8w0htPSrlgOOysQaU62U= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/opencontainers/runtime-spec v1.3.0 h1:YZupQUdctfhpZy3TM39nN9Ika5CBWT5diQ8ibYCRkxg= +github.com/opencontainers/runtime-spec v1.3.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.13.1 h1:A8nNeceYngH9Ow++M+VVEwJVpdFmrlxsN22F+ISDCJE= +github.com/opencontainers/selinux v1.13.1/go.mod h1:S10WXZ/osk2kWOYKy1x2f/eXF5ZHJoUs8UU/2caNRbg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= +github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tchap/go-patricia/v2 v2.3.3 h1:xfNEsODumaEcCcY3gI0hYPZ/PcpVv5ju6RMAhgwZDDc= github.com/tchap/go-patricia/v2 v2.3.3/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY= github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vbatts/tar-split v0.12.2 h1:w/Y6tjxpeiFMR47yzZPlPj/FcPLpXbTUi/9H7d3CPa4= github.com/vbatts/tar-split v0.12.2/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635 h1:3uycTxukehWrxH4HtPRtn1PDABTU331ViDjyqrUbaog= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251020155222-88f65dc88635/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= -google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +go.podman.io/storage v1.62.0 h1:0QjX1XlzVmbiaulb+aR/CG6p9+pzaqwIeZPe3tEjHbY= +go.podman.io/storage v1.62.0/go.mod h1:A3UBK0XypjNZ6pghRhuxg62+2NIm5lcUGv/7XyMhMUI= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From f2230847a1b6a24b1a7979f2583b7b3303d839d7 Mon Sep 17 00:00:00 2001 From: NN708 Date: Sat, 28 Feb 2026 00:23:38 +0000 Subject: [PATCH 4/6] Revert "combines add and remove sources" This reverts commit c5bf57efb35b4cb9e7f4730a2e86015d0d8720a5. --- core/build.go | 21 ++------------------- core/plugins.in | 11 +++++++---- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/core/build.go b/core/build.go index ce9b713..ef98d9d 100644 --- a/core/build.go +++ b/core/build.go @@ -258,17 +258,6 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { } } - // SOURCES - sourcePath := filepath.Join("sources", stage.Id) - err = os.MkdirAll(sourcePath, 0o755) - if err != nil { - return fmt.Errorf("could not create source path: %w", err) - } - _, err = containerfile.WriteString(fmt.Sprintf("ADD %s /sources\n", sourcePath)) - if err != nil { - return err - } - for _, cmd := range cmds { err = ChangeWorkingDirectory(cmd.Workdir, containerfile) if err != nil { @@ -306,12 +295,6 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { } } - // DELETE SOURCES - _, err = containerfile.WriteString("RUN rm -r /sources\n") - if err != nil { - return err - } - // ENTRYPOINT err = ChangeWorkingDirectory(stage.Entrypoint.Workdir, containerfile) if err != nil { @@ -331,8 +314,6 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { return err } } - - containerfile.WriteString("\n") } return nil @@ -630,6 +611,8 @@ func BuildModule(recipe *api.Recipe, module interface{}, allModules *[]interface commands = append(commands, command...) } + moduleSourcePath := filepath.Join(recipe.SourcesPath, decodedModule.Name) + _ = os.MkdirAll(moduleSourcePath, 0755) sourcePath := filepath.Join(recipe.SourcesPath, decodedModule.Name) stageSourcePath := filepath.Join(recipe.SourcesPath, stageName, decodedModule.Name) diff --git a/core/plugins.in b/core/plugins.in index 61944a1..381fe11 100644 --- a/core/plugins.in +++ b/core/plugins.in @@ -67,7 +67,7 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin // of paths to search. var _errors = make([]error, len(allPluginPaths)) - var fail bool = false + var _err error = nil for index, path := range allPluginPaths { _, err := os.Stat(path) @@ -75,13 +75,16 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin _errors = append(_errors, err) if index == lastIndex { - _errors = append(_errors, fmt.Errorf("error: couldn't find plugin [%s] on your system.\nnote: Please copy it into one of the searched folders above.", )) + _errors = append(_errors, fmt.Errorf("error: couldn't find plugin [%s] on your system.\nnote: Please copy it into one of the searched folders above.")) for _, _err := range _errors { fmt.Printf("%v\n", _err) } + _err = err break - } else continue + } else { + continue + } } loadedPlugin, err = purego.Dlopen(path, purego.RTLD_NOW|purego.RTLD_GLOBAL) @@ -129,7 +132,7 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin } } - return loadedPlugin, *pluginInfo, nil + return loadedPlugin, *pluginInfo, _err } func LoadBuildPlugin(name string, moduleInterface interface{}, recipe *api.Recipe, cleanup []string, arch string) ([]string, error) { From aea672f1de345bc6fd1b367f0fc95911c08c7980 Mon Sep 17 00:00:00 2001 From: NN708 Date: Sat, 28 Feb 2026 00:30:13 +0000 Subject: [PATCH 5/6] feat: add sources using RUN --mount --- core/plugins.in | 2 +- core/shell.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/plugins.in b/core/plugins.in index 381fe11..571d472 100644 --- a/core/plugins.in +++ b/core/plugins.in @@ -176,7 +176,7 @@ func LoadBuildPlugin(name string, moduleInterface interface{}, recipe *api.Recip return []string{""}, fmt.Errorf("%s", strings.Replace(res, "ERROR: ", "", 1)) } else if !buildModule.PluginInfo.UseContainerCmds { cleanupSuffix := api.GetCleanupSuffix(append(cleanup, module.Cleanup...)) - return []string{"RUN " + res + cleanupSuffix}, nil + return []string{fmt.Sprintf("RUN --mount=source=sources/%s,target=/sources/%s,rw ", module.Name, module.Name) + res + cleanupSuffix}, nil } else { return decodeBuildCmds(res) } diff --git a/core/shell.go b/core/shell.go index 0545cbf..2483342 100644 --- a/core/shell.go +++ b/core/shell.go @@ -47,6 +47,10 @@ func BuildShellModule(module interface{}, recipe *api.Recipe, cleanup []string, } var cmd strings.Builder + _, err := fmt.Fprintf(&cmd, "RUN --mount=source=sources/%s,target=/sources/%s,rw\nRUN ", shellModule.Name, shellModule.Name) + if err != nil { + panic(fmt.Sprintf("Fprintf failed during build of shell module `%s`", shellModule.Name)) + } for i, command := range shellModule.Commands { cmd.WriteString(command) if i < len(shellModule.Commands)-1 { @@ -55,5 +59,5 @@ func BuildShellModule(module interface{}, recipe *api.Recipe, cleanup []string, } cmd.WriteString(api.GetCleanupSuffix(append(cleanup, shellModule.Cleanup...))) - return "RUN " + cmd.String(), nil + return cmd.String(), nil } From 2fa9bc70e25f275a609446edb30a7d73683afafb Mon Sep 17 00:00:00 2001 From: JustSaft <69754418+justsaft@users.noreply.github.com> Date: Mon, 16 Mar 2026 21:30:19 +0100 Subject: [PATCH 6/6] rectifies oversight of #147 and two small issues --- core/build.go | 6 ++++-- core/loader.go | 4 ++++ core/plugins.in | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/build.go b/core/build.go index 3e25055..910a396 100644 --- a/core/build.go +++ b/core/build.go @@ -201,7 +201,7 @@ func BuildContainerfile(recipe *api.Recipe, arch string) error { cleanupSuffix := api.GetCleanupSuffix(stage.Cleanup) for _, cmd := range stage.Runs.Commands { _, err = containerfile.WriteString( - fmt.Sprintf("RUN %s\n", cmd + cleanupSuffix), + fmt.Sprintf("RUN %s\n", cmd+cleanupSuffix), ) if err != nil { return err @@ -498,6 +498,7 @@ func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]i fmt.Printf("Downloading recipe from %s\n", include) modulePath, err = downloadRecipe(include) if err != nil { + *_errors = append(*_errors, err) return "", err } } else if followsGhPattern(include) { @@ -506,7 +507,8 @@ func BuildIncludesModule(recipe *api.Recipe, module interface{}, allModules *[]i fmt.Printf("Downloading recipe from %s\n", include) modulePath, err = downloadGhRecipe(include) if err != nil { - return "", err + *_errors = append(*_errors, err) + continue } } else { modulePath = filepath.Join(recipe.ParentPath, include) diff --git a/core/loader.go b/core/loader.go index 7a66cab..3c21941 100644 --- a/core/loader.go +++ b/core/loader.go @@ -156,6 +156,10 @@ func downloadRecipe(url string) (path string, err error) { } defer resp.Body.Close() + if resp.StatusCode == http.StatusNotFound { + return "", fmt.Errorf("error: resource not found: %s", url) + } + tmpFile, err := os.CreateTemp("", "vib-recipe-") if err != nil { return "", err diff --git a/core/plugins.in b/core/plugins.in index 571d472..496c100 100644 --- a/core/plugins.in +++ b/core/plugins.in @@ -38,7 +38,7 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin panic("Cannot load a module without its name. Needs a fix in the codebase.") } - fmt.Println("Loading plugin [%s]", name) + fmt.Printf("Loading plugin [%s]", name) projectPluginPath := fmt.Sprintf("%s/%s.so", recipe.PluginPath, name) installPrefixPath := fmt.Sprintf("%INSTALLPREFIX%/share/vib/plugins/%s.so", name) @@ -75,7 +75,7 @@ func LoadPlugin(name string, plugintype api.PluginType, recipe *api.Recipe) (uin _errors = append(_errors, err) if index == lastIndex { - _errors = append(_errors, fmt.Errorf("error: couldn't find plugin [%s] on your system.\nnote: Please copy it into one of the searched folders above.")) + _errors = append(_errors, fmt.Errorf("error: couldn't find plugin [%s] on your system.\nnote: Please copy it into one of the searched folders above.", name)) for _, _err := range _errors { fmt.Printf("%v\n", _err)