Merge pull request #227 from trws/fetch-deps
fetch: add options to fetch missing or all deps
This commit is contained in:
commit
1b086c928c
4 changed files with 25 additions and 4 deletions
|
@ -33,10 +33,13 @@ def setup_parser(subparser):
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'-n', '--no-checksum', action='store_true', dest='no_checksum',
|
'-n', '--no-checksum', action='store_true', dest='no_checksum',
|
||||||
help="Do not check packages against checksum")
|
help="Do not check packages against checksum")
|
||||||
|
subparser.add_argument(
|
||||||
|
'-m', '--missing', action='store_true', help="Also fetch all missing dependencies")
|
||||||
|
subparser.add_argument(
|
||||||
|
'-D', '--dependencies', action='store_true', help="Also fetch all dependencies")
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'packages', nargs=argparse.REMAINDER, help="specs of packages to fetch")
|
'packages', nargs=argparse.REMAINDER, help="specs of packages to fetch")
|
||||||
|
|
||||||
|
|
||||||
def fetch(parser, args):
|
def fetch(parser, args):
|
||||||
if not args.packages:
|
if not args.packages:
|
||||||
tty.die("fetch requires at least one package argument")
|
tty.die("fetch requires at least one package argument")
|
||||||
|
@ -46,5 +49,13 @@ def fetch(parser, args):
|
||||||
|
|
||||||
specs = spack.cmd.parse_specs(args.packages, concretize=True)
|
specs = spack.cmd.parse_specs(args.packages, concretize=True)
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
|
if args.missing or args.dependencies:
|
||||||
|
to_fetch = set()
|
||||||
|
for s in spec.traverse():
|
||||||
|
package = spack.db.get(s)
|
||||||
|
if args.missing and package.installed:
|
||||||
|
continue
|
||||||
|
package.do_fetch()
|
||||||
|
|
||||||
package = spack.db.get(spec)
|
package = spack.db.get(spec)
|
||||||
package.do_fetch()
|
package.do_fetch()
|
||||||
|
|
|
@ -54,6 +54,8 @@ def setup_parser(subparser):
|
||||||
'specs', nargs=argparse.REMAINDER, help="Specs of packages to put in mirror")
|
'specs', nargs=argparse.REMAINDER, help="Specs of packages to put in mirror")
|
||||||
create_parser.add_argument(
|
create_parser.add_argument(
|
||||||
'-f', '--file', help="File with specs of packages to put in mirror.")
|
'-f', '--file', help="File with specs of packages to put in mirror.")
|
||||||
|
create_parser.add_argument(
|
||||||
|
'-D', '--dependencies', action='store_true', help="Also fetch all dependencies")
|
||||||
create_parser.add_argument(
|
create_parser.add_argument(
|
||||||
'-o', '--one-version-per-spec', action='store_const', const=1, default=0,
|
'-o', '--one-version-per-spec', action='store_const', const=1, default=0,
|
||||||
help="Only fetch one 'preferred' version per spec, not all known versions.")
|
help="Only fetch one 'preferred' version per spec, not all known versions.")
|
||||||
|
@ -118,7 +120,7 @@ def mirror_create(args):
|
||||||
"""Create a directory to be used as a spack mirror, and fill it with
|
"""Create a directory to be used as a spack mirror, and fill it with
|
||||||
package archives."""
|
package archives."""
|
||||||
# try to parse specs from the command line first.
|
# try to parse specs from the command line first.
|
||||||
specs = spack.cmd.parse_specs(args.specs)
|
specs = spack.cmd.parse_specs(args.specs, concretize=True)
|
||||||
|
|
||||||
# If there is a file, parse each line as a spec and add it to the list.
|
# If there is a file, parse each line as a spec and add it to the list.
|
||||||
if args.file:
|
if args.file:
|
||||||
|
@ -131,6 +133,14 @@ def mirror_create(args):
|
||||||
specs = [Spec(n) for n in spack.db.all_package_names()]
|
specs = [Spec(n) for n in spack.db.all_package_names()]
|
||||||
specs.sort(key=lambda s: s.format("$_$@").lower())
|
specs.sort(key=lambda s: s.format("$_$@").lower())
|
||||||
|
|
||||||
|
if args.dependencies:
|
||||||
|
new_specs = set()
|
||||||
|
for spec in specs:
|
||||||
|
spec.concretize()
|
||||||
|
for s in spec.traverse():
|
||||||
|
new_specs.add(s)
|
||||||
|
specs = list(new_specs)
|
||||||
|
|
||||||
# Default name for directory is spack-mirror-<DATESTAMP>
|
# Default name for directory is spack-mirror-<DATESTAMP>
|
||||||
directory = args.directory
|
directory = args.directory
|
||||||
if not directory:
|
if not directory:
|
||||||
|
|
|
@ -146,7 +146,7 @@ def create(path, specs, **kwargs):
|
||||||
stage = None
|
stage = None
|
||||||
try:
|
try:
|
||||||
# create a subdirectory for the current package@version
|
# create a subdirectory for the current package@version
|
||||||
archive_path = os.path.abspath(join_path(path, mirror_archive_path(spec)))
|
archive_path = os.path.abspath(join_path(mirror_root, mirror_archive_path(spec)))
|
||||||
subdir = os.path.dirname(archive_path)
|
subdir = os.path.dirname(archive_path)
|
||||||
mkdirp(subdir)
|
mkdirp(subdir)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class PyCffi(Package):
|
||||||
"""Foreign Function Interface for Python calling C code"""
|
"""Foreign Function Interface for Python calling C code"""
|
||||||
homepage = "http://cffi.readthedocs.org/en/latest/"
|
homepage = "http://cffi.readthedocs.org/en/latest/"
|
||||||
# base https://pypi.python.org/pypi/cffi
|
# base https://pypi.python.org/pypi/cffi
|
||||||
url = "https://pypi.python.org/packages/source/c/cffi/cffi-1.1.2.tar.gz#md5="
|
url = "https://pypi.python.org/packages/source/c/cffi/cffi-1.1.2.tar.gz"
|
||||||
|
|
||||||
version('1.1.2', 'ca6e6c45b45caa87aee9adc7c796eaea')
|
version('1.1.2', 'ca6e6c45b45caa87aee9adc7c796eaea')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue