summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/fetch.py13
-rw-r--r--lib/spack/spack/cmd/mirror.py12
-rw-r--r--lib/spack/spack/mirror.py2
3 files changed, 24 insertions, 3 deletions
diff --git a/lib/spack/spack/cmd/fetch.py b/lib/spack/spack/cmd/fetch.py
index 6f9e7ab5e2..57d6f6b63b 100644
--- a/lib/spack/spack/cmd/fetch.py
+++ b/lib/spack/spack/cmd/fetch.py
@@ -34,9 +34,12 @@ def setup_parser(subparser):
'-n', '--no-checksum', action='store_true', dest='no_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(
'packages', nargs=argparse.REMAINDER, help="specs of packages to fetch")
-
def fetch(parser, args):
if not args.packages:
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)
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.do_fetch()
diff --git a/lib/spack/spack/cmd/mirror.py b/lib/spack/spack/cmd/mirror.py
index 4a1ce00b75..89d51bbe04 100644
--- a/lib/spack/spack/cmd/mirror.py
+++ b/lib/spack/spack/cmd/mirror.py
@@ -55,6 +55,8 @@ def setup_parser(subparser):
create_parser.add_argument(
'-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(
'-o', '--one-version-per-spec', action='store_const', const=1, default=0,
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
package archives."""
# 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 args.file:
@@ -131,6 +133,14 @@ def mirror_create(args):
specs = [Spec(n) for n in spack.db.all_package_names()]
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>
directory = args.directory
if not directory:
diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py
index ee0bf6de11..6fbf82de14 100644
--- a/lib/spack/spack/mirror.py
+++ b/lib/spack/spack/mirror.py
@@ -146,7 +146,7 @@ def create(path, specs, **kwargs):
stage = None
try:
# 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)
mkdirp(subdir)