mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-06 21:51:30 +00:00
Add an "offline" mode for mixer
This patch adds a persistent "--offline" flag to the top-level mixer command, which means every command can pass this flag to make mixer work offline. When mixer works offline, it skips caching upstream bundle definition files. This has the implication that every bundle in the user's mix must be available in local-bundles. Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
This commit is contained in:
+12
-1
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user