From 3c6d484150a8e13431caa6801921bf8fd3e5fc71 Mon Sep 17 00:00:00 2001 From: Matthias Wolf Date: Fri, 11 Jan 2019 22:57:11 +0100 Subject: enh: `buildcache list` should behave similar to `find` (#10052) The current output of buildcache list is very verbose and I feel like some details are getting lost. By making the output similar to find, I think users will be able to get a better overview of what is stored in the cache. --- lib/spack/spack/cmd/buildcache.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index 1a45849cff..5e8c211b70 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -13,6 +13,8 @@ import spack.repo import spack.store import spack.spec import spack.binary_distribution as bindist +import spack.cmd.common.arguments as arguments +from spack.cmd import display_specs description = "create, download and install binary packages" section = "packaging" @@ -63,6 +65,11 @@ def setup_parser(subparser): install.set_defaults(func=installtarball) listcache = subparsers.add_parser('list', help=listspecs.__doc__) + arguments.add_common_arguments(listcache, ['long', 'very_long']) + listcache.add_argument('-v', '--variants', + action='store_true', + dest='variants', + help='show variants in output (can be long)') listcache.add_argument('-f', '--force', action='store_true', help="force new download of specs") listcache.add_argument( @@ -254,22 +261,10 @@ def listspecs(args): specs = bindist.get_specs(args.force) if args.packages: pkgs = set(args.packages) - for pkg in pkgs: - tty.msg("buildcache spec(s) matching " + - "%s and commands to install them" % pkgs) - for spec in sorted(specs): - if spec.satisfies(pkg): - tty.msg('Enter\nspack buildcache install /%s\n' % - spec.dag_hash(7) + - ' to install "%s"' % - spec.format()) + specs = [s for s in specs for p in pkgs if s.satisfies(p)] + display_specs(specs, args, all_headers=True) else: - tty.msg("buildcache specs and commands to install them") - for spec in sorted(specs): - tty.msg('Enter\nspack buildcache install /%s\n' % - spec.dag_hash(7) + - ' to install "%s"' % - spec.format()) + display_specs(specs, args, all_headers=True) def getkeys(args): -- cgit v1.2.3-60-g2f50