Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "mixer", Long: `Mixer is a tool used to compose OS update content and images.`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if rootCmdFlags.cpuProfile != "" { f, err := os.Create(rootCmdFlags.cpuProfile) if err != nil { failf("couldn't create file for CPU profile: %s", err) } err = pprof.StartCPUProfile(f) if err != nil { failf("couldn't start profiling: %s", err) } } if cmd.Parent() == nil { if rootCmdFlags.version { fmt.Printf("Mixer %s\n", builder.Version) os.Exit(0) } if rootCmdFlags.check { ok := checkAllDeps() if !ok { os.Exit(1) } os.Exit(0) } } noParseConfigCmds := []string{"init", "config"} for _, ignoreCmd := range noParseConfigCmds { if cmdContains(cmd, ignoreCmd) { return checkCmdDeps(cmd) } } b, err := builder.NewFromConfig(configFile) if err != nil { fail(err) } networkCheck := true noNetworkCmds := []string{"list", "edit", "validate", "convert", "set", "repo", "add-rpms"} for _, ignoreCmd := range noNetworkCmds { if cmdContains(cmd, ignoreCmd) { networkCheck = false } } if networkCheck && builder.Native && b.UpstreamURL != "" { hostFormat, upstreamFormat, err := b.GetHostAndUpstreamFormats() if err != nil { fail(err) } if hostFormat == "" { fmt.Println("Warning: Unable to determine host format. Running natively may fail.") } else if hostFormat != upstreamFormat { fmt.Println("Warning: The host format and mix upstream format do not match.", "Mixer may be incompatible with this format; running natively may fail.") } } else if networkCheck { fmt.Printf("Warning: Using Format=%s from mixer.state for this build.\n", b.State.Mix.Format) } if !cmdContains(cmd, "format-bump") && !cmdContains(cmd, "upstream-format") && cmdContains(cmd, "build") { if builder.Offline && !builder.Native { fmt.Println("Warning: Unable to determine upstream format in --offline mode, build may fail if building across format boundaries.") if err := b.RunCommandInContainer(reconstructCommand(cmd, args)); err != nil { fail(err) } return nil } if bumpNeeded, err := b.CheckBumpNeeded(false); err != nil { return err } else if bumpNeeded { cancelRun(cmd) return nil } if !builder.Native { if err := b.RunCommandInContainer(reconstructCommand(cmd, args)); err != nil { fail(err) } cancelRun(cmd) return nil } } return checkCmdDeps(cmd) }, PersistentPostRun: func(cmd *cobra.Command, args []string) { if rootCmdFlags.cpuProfile != "" { pprof.StopCPUProfile() } }, Run: func(cmd *cobra.Command, args []string) { cmd.Print(cmd.UsageString()) }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.