add --reuse
option to spack solve
This commit is contained in:
parent
288176326c
commit
ad5d632eeb
@ -67,6 +67,9 @@ def setup_parser(subparser):
|
|||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'--stats', action='store_true', default=False,
|
'--stats', action='store_true', default=False,
|
||||||
help='print out statistics from clingo')
|
help='print out statistics from clingo')
|
||||||
|
subparser.add_argument(
|
||||||
|
'--reuse', action='store_true', default=False,
|
||||||
|
help='reuse installed dependencies')
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'specs', nargs=argparse.REMAINDER, help="specs of packages")
|
'specs', nargs=argparse.REMAINDER, help="specs of packages")
|
||||||
|
|
||||||
@ -103,7 +106,8 @@ def solve(parser, args):
|
|||||||
|
|
||||||
# dump generated ASP program
|
# dump generated ASP program
|
||||||
result = asp.solve(
|
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:
|
if 'solutions' not in dump:
|
||||||
return
|
return
|
||||||
|
@ -440,7 +440,7 @@ def fact(self, head, assumption=False):
|
|||||||
|
|
||||||
def solve(
|
def solve(
|
||||||
self, solver_setup, specs, dump=None, nmodels=0,
|
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()
|
timer = spack.util.timer.Timer()
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ def solve(
|
|||||||
self.assumptions = []
|
self.assumptions = []
|
||||||
with self.control.backend() as backend:
|
with self.control.backend() as backend:
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
solver_setup.setup(self, specs, tests=tests)
|
solver_setup.setup(self, specs, tests=tests, reuse=reuse)
|
||||||
timer.phase("setup")
|
timer.phase("setup")
|
||||||
|
|
||||||
# read in the main ASP program and display logic -- these are
|
# read in the main ASP program and display logic -- these are
|
||||||
@ -1475,7 +1475,7 @@ def define_variant_values(self):
|
|||||||
for pkg, variant, value in sorted(self.variant_values_from_specs):
|
for pkg, variant, value in sorted(self.variant_values_from_specs):
|
||||||
self.gen.fact(fn.variant_possible_value(pkg, variant, value))
|
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.
|
"""Generate an ASP program with relevant constraints for specs.
|
||||||
|
|
||||||
This calls methods on the solve driver to set up the problem with
|
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.
|
# 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.
|
"""Solve for a stable model of specs.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@ -1823,4 +1824,6 @@ def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False):
|
|||||||
spack.spec.Spec.ensure_valid_variants(s)
|
spack.spec.Spec.ensure_valid_variants(s)
|
||||||
|
|
||||||
setup = SpackSolverSetup()
|
setup = SpackSolverSetup()
|
||||||
return driver.solve(setup, specs, dump, models, timers, stats, tests)
|
return driver.solve(
|
||||||
|
setup, specs, dump, models, timers, stats, tests, reuse
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user