From 2d7542bef6d7c5d5bb900477c98eefe466018bf9 Mon Sep 17 00:00:00 2001 From: "Kevin C. Wells" Date: Fri, 23 Mar 2018 00:17:49 +0000 Subject: [PATCH] Update 'mixer bundle list' to report packages This patch changes the output for 'mixer bundle list' and 'mixer bundle list --tree' to distinguish between bundles and packages. This should help clarify exactly where items in the mix are coming from. Signed-off-by: Kevin C. Wells --- builder/builder.go | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/builder/builder.go b/builder/builder.go index ca21487..d6c2470 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -887,9 +887,17 @@ func (b *Builder) buildTreePrintValue(bundle *bundle, level int, levelEnded []bo // Set up the value for this bundle value := bundle.Name if b.isLocalBundle(bundle.Filename) { - value += " (local)" + if b.isLocalPackagePath(bundle.Filename) { + value += " (local package)" + } else { + value += " (local bundle)" + } } else { - value += " (upstream)" + if isUpstreamPackagePath(bundle.Filename) { + value += " (upstream package)" + } else { + value += " (upstream bundle)" + } } if level == 0 { @@ -1011,9 +1019,17 @@ func (b *Builder) ListBundles(listType listType, tree bool) error { for _, bundle := range sorted { var location string if _, exists := localBundles[bundle]; exists { - location = "(local)" + if b.isLocalPackagePath(localBundles[bundle].Filename) { + location = "(local package)" + } else { + location = "(local bundle)" + } } else { - location = "(upstream)" + if isUpstreamPackagePath(upstreamBundles[bundle].Filename) { + location = "(upstream package)" + } else { + location = "(upstream bundle)" + } } var included string if _, exists := bundles[bundle]; !exists { @@ -1029,11 +1045,15 @@ func (b *Builder) ListBundles(listType listType, tree bool) error { if _, exists := mixBundles[bundle]; exists { mix = "(in mix)" } + var pkg string + if b.isLocalPackagePath(localBundles[bundle].Filename) { + pkg = "(package)" + } var masking string if _, exists := upstreamBundles[bundle]; exists { masking = "(masking upstream)" } - fmt.Fprintf(tw, "%s\t%s\t%s\n", bundle, mix, masking) + fmt.Fprintf(tw, "%s\t%s\t%s\t%s\n", bundle, pkg, mix, masking) } case UpstreamList: // Only print the top-level set @@ -1043,11 +1063,15 @@ func (b *Builder) ListBundles(listType listType, tree bool) error { if _, exists := mixBundles[bundle]; exists { mix = "(in mix)" } + var pkg string + if isUpstreamPackagePath(upstreamBundles[bundle].Filename) { + pkg = "(package)" + } var masked string if _, exists := localBundles[bundle]; exists { masked = "(masked by local)" } - fmt.Fprintf(tw, "%s\t%s\t%s\n", bundle, mix, masked) + fmt.Fprintf(tw, "%s\t%s\t%s\t%s\n", bundle, pkg, mix, masked) } }