diff --git a/builder/builder.go b/builder/builder.go index dd8d366..3d1e49b 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -51,6 +51,10 @@ var UseNewSwupdServer = false // building the chroots. This is an experimental feature. var UseNewChrootBuilder = false +// Offline controls whether mixer attempts to automatically cache upstream +// bundles. In offline mode, all necessary bundles must exist in local-bundles. +var Offline = false + // A Builder contains all configurable fields required to perform a full mix // operation, and is used to encapsulate life time data. type Builder struct { @@ -498,6 +502,10 @@ func getUpstreamBundlesPath(ver string) string { } func (b *Builder) getUpstreamBundles(ver string, prune bool) error { + if Offline { + return nil + } + // Make the folder to store upstream bundles if does not exist if err := os.MkdirAll(upstreamBundlesBaseDir, 0777); err != nil { return errors.Wrap(err, "Failed to create upstream-bundles dir.") @@ -946,7 +954,10 @@ func (b *Builder) ListBundles(listType listType, tree bool) error { } upstreamBundles, err := b.getDirBundlesListAsSet(getUpstreamBundlesPath(b.UpstreamVer)) if err != nil { - return err + if !Offline { + return err + } + upstreamBundles = make(bundleSet) } // Assign "top level" bundles diff --git a/mixer/cmd/root.go b/mixer/cmd/root.go index b451526..a98f0e8 100644 --- a/mixer/cmd/root.go +++ b/mixer/cmd/root.go @@ -146,6 +146,8 @@ func init() { // TODO: Remove this once we migrate to new implementation. RootCmd.PersistentFlags().BoolVar(&builder.UseNewSwupdServer, "new-swupd", false, "EXPERIMENTAL: Use new implementation of swupd-server when possible") + RootCmd.PersistentFlags().BoolVar(&builder.Offline, "offline", false, "Skip caching upstream-bundles; work entirely with local-bundles") + RootCmd.AddCommand(initCmd) RootCmd.Flags().BoolVar(&rootCmdFlags.version, "version", false, "Print version information and quit") RootCmd.Flags().BoolVar(&rootCmdFlags.check, "check", false, "Check all dependencies needed by mixer and quit")