summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/cmd/solve.py6
-rw-r--r--lib/spack/spack/solver/asp.py13
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/spack/spack/cmd/solve.py b/lib/spack/spack/cmd/solve.py
index e2563ef0c8..123c68862d 100644
--- a/lib/spack/spack/cmd/solve.py
+++ b/lib/spack/spack/cmd/solve.py
@@ -68,6 +68,9 @@ def setup_parser(subparser):
'--stats', action='store_true', default=False,
help='print out statistics from clingo')
subparser.add_argument(
+ '--reuse', action='store_true', default=False,
+ help='reuse installed dependencies')
+ subparser.add_argument(
'specs', nargs=argparse.REMAINDER, help="specs of packages")
@@ -103,7 +106,8 @@ def solve(parser, args):
# dump generated ASP program
result = asp.solve(
- specs, dump=dump, models=models, timers=args.timers, stats=args.stats
+ specs, dump=dump, models=models, timers=args.timers, stats=args.stats,
+ reuse=args.reuse,
)
if 'solutions' not in dump:
return
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index e83b38cf8d..09a03543f8 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -440,7 +440,7 @@ class PyclingoDriver(object):
def solve(
self, solver_setup, specs, dump=None, nmodels=0,
- timers=False, stats=False, tests=False
+ timers=False, stats=False, tests=False, reuse=False,
):
timer = spack.util.timer.Timer()
@@ -457,7 +457,7 @@ class PyclingoDriver(object):
self.assumptions = []
with self.control.backend() as backend:
self.backend = backend
- solver_setup.setup(self, specs, tests=tests)
+ solver_setup.setup(self, specs, tests=tests, reuse=reuse)
timer.phase("setup")
# read in the main ASP program and display logic -- these are
@@ -1475,7 +1475,7 @@ class SpackSolverSetup(object):
for pkg, variant, value in sorted(self.variant_values_from_specs):
self.gen.fact(fn.variant_possible_value(pkg, variant, value))
- def setup(self, driver, specs, tests=False):
+ def setup(self, driver, specs, tests=False, reuse=False):
"""Generate an ASP program with relevant constraints for specs.
This calls methods on the solve driver to set up the problem with
@@ -1803,7 +1803,8 @@ def _develop_specs_from_env(spec, env):
#
# These are handwritten parts for the Spack ASP model.
#
-def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False):
+def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False,
+ reuse=False):
"""Solve for a stable model of specs.
Arguments:
@@ -1823,4 +1824,6 @@ def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False):
spack.spec.Spec.ensure_valid_variants(s)
setup = SpackSolverSetup()
- return driver.solve(setup, specs, dump, models, timers, stats, tests)
+ return driver.solve(
+ setup, specs, dump, models, timers, stats, tests, reuse
+ )