def listspecs(args): """list binary packages available from mirrors""" specs = bindist.get_specs(args.force, args.allarch) if args.specs: constraints = set(args.specs) specs = [s for s in specs if any(s.satisfies(c) for c in constraints)] display_specs(specs, args, all_headers=True)
def listspecs(args): """list binary packages available from mirrors""" specs = bindist.get_specs(args.force) if args.packages: pkgs = set(args.packages) specs = [s for s in specs for p in pkgs if s.satisfies(p)] display_specs(specs, args, all_headers=True) else: display_specs(specs, args, all_headers=True)
def match_downloaded_specs(pkgs, allow_multiple_matches=False, force=False, other_arch=False): """Returns a list of specs matching the not necessarily concretized specs given from cli Args: specs: list of specs to be matched against buildcaches on mirror allow_multiple_matches : if True multiple matches are admitted Return: list of specs """ # List of specs that match expressions given via command line specs_from_cli = [] has_errors = False specs = bindist.get_specs() if not other_arch: arch = spack.architecture.default_arch().to_spec() specs = [s for s in specs if s.satisfies(arch)] for pkg in pkgs: matches = [] tty.msg("buildcache spec(s) matching %s \n" % pkg) for spec in sorted(specs): if pkg.startswith('/'): pkghash = pkg.replace('/', '') if spec.dag_hash().startswith(pkghash): matches.append(spec) else: if spec.satisfies(pkg): matches.append(spec) # For each pkg provided, make sure it refers to only one package. # Fail and ask user to be unambiguous if it doesn't if not allow_multiple_matches and len(matches) > 1: tty.error('%s matches multiple downloaded packages:' % pkg) for match in matches: tty.msg('"%s"' % match.format()) has_errors = True # No downloaded package matches the query if len(matches) == 0: tty.error('%s does not match any downloaded packages.' % pkg) has_errors = True specs_from_cli.extend(matches) if has_errors: tty.die('use one of the matching specs above') return specs_from_cli
def listspecs(args): specs, links = bindist.get_specs() if args.packages: pkgs = set(args.packages) for pkg in pkgs: tty.msg("buildcache spec(s) matching %s \n" % pkg) for spec in sorted(specs): if re.search("^" + re.escape(pkg), str(spec)): tty.msg('run "spack buildcache install /%s"' % spec.dag_hash(7) + ' to install %s\n' % spec.format()) else: tty.msg("buildcache specs ") for spec in sorted(specs): tty.msg('run "spack buildcache install /%s" to install %s\n' % (spec.dag_hash(7), spec.format()))
def installtarball(args): if not args.packages: tty.die("build cache file installation requires" + " at least one package spec argument") pkgs = set(args.packages) specs, links = bindist.get_specs() matches = set() for spec in specs: for pkg in pkgs: if re.match(re.escape(pkg), str(spec)): matches.add(spec) if re.match(re.escape(pkg), '/%s' % spec.dag_hash()): matches.add(spec) for match in matches: install_tarball(match, args)
def listspecs(args): """list binary packages available from mirrors""" specs = bindist.get_specs() if not args.allarch: arch = spack.architecture.default_arch().to_spec() specs = [s for s in specs if s.satisfies(arch)] if args.specs: constraints = set(args.specs) specs = [s for s in specs if any(s.satisfies(c) for c in constraints)] if sys.stdout.isatty(): builds = len(specs) tty.msg("%s." % plural(builds, 'cached build')) if not builds and not args.allarch: tty.msg("You can query all available architectures with:", "spack buildcache list --allarch") display_specs(specs, args, all_headers=True)
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()) 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())
def match_downloaded_specs(pkgs, allow_multiple_matches=False, force=False): """Returns a list of specs matching the not necessarily concretized specs given from cli Args: specs: list of specs to be matched against buildcaches on mirror allow_multiple_matches : if True multiple matches are admitted Return: list of specs """ # List of specs that match expressions given via command line specs_from_cli = [] has_errors = False specs = bindist.get_specs(force) for pkg in pkgs: matches = [] tty.msg("buildcache spec(s) matching %s \n" % pkg) for spec in sorted(specs): if pkg.startswith('/'): pkghash = pkg.replace('/', '') if spec.dag_hash().startswith(pkghash): matches.append(spec) else: if spec.satisfies(pkg): matches.append(spec) # For each pkg provided, make sure it refers to only one package. # Fail and ask user to be unambiguous if it doesn't if not allow_multiple_matches and len(matches) > 1: tty.error('%s matches multiple downloaded packages:' % pkg) for match in matches: tty.msg('"%s"' % match.format()) has_errors = True # No downloaded package matches the query if len(matches) == 0: tty.error('%s does not match any downloaded packages.' % pkg) has_errors = True specs_from_cli.extend(matches) if has_errors: tty.die('use one of the matching specs above') return specs_from_cli
def listspecs(args): """list binary packages available from mirrors""" 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()) 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())