Fixed the way flags on deps are attached so that they aren't moved onto the root before normalize/concretize

This commit is contained in:
Gregory Becker 2016-01-15 16:18:40 -08:00
parent 342f4bc2e0
commit 16e9d658d5
2 changed files with 16 additions and 15 deletions

View file

@ -1806,6 +1806,8 @@ def do_parse(self):
try: try:
while self.next: while self.next:
if self.previous:
specs.append(self.previous.value)
if self.accept(ID): if self.accept(ID):
self.previous = self.token self.previous = self.token
if self.accept(EQ): if self.accept(EQ):
@ -1818,6 +1820,7 @@ def do_parse(self):
specs[-1]._add_flag(self.previous.value, self.token.value) specs[-1]._add_flag(self.previous.value, self.token.value)
else: else:
specs.append(self.spec(self.previous.value)) specs.append(self.spec(self.previous.value))
self.previous = None
elif self.accept(HASH): elif self.accept(HASH):
specs.append(self.spec_by_hash()) specs.append(self.spec_by_hash())
@ -1825,6 +1828,7 @@ def do_parse(self):
if not specs: if not specs:
self.previous = self.token self.previous = self.token
specs.append(self.spec('')) specs.append(self.spec(''))
self.previous = None
if self.accept(HASH): if self.accept(HASH):
specs[-1]._add_dependency(self.spec_by_hash()) specs[-1]._add_dependency(self.spec_by_hash())
else: else:
@ -1911,17 +1915,6 @@ def spec(self, name, check_valid_token = False):
check_valid_token = False check_valid_token = False
elif self.accept(ON): elif self.accept(ON):
# self.expect(ID)
# self.check_identifier()
# option = self.token.value
# if self.accept(EQ):
# if self.accept(QT):
# self.token.value = self.token.value[1:-1]
# else:
# self.expect(ID)
# spec._add_flag(option,self.token.value)
# else:
# spec._add_variant(self.variant(option),True)
spec._add_variant(self.variant(), True) spec._add_variant(self.variant(), True)
check_valid_token = False check_valid_token = False
@ -1933,6 +1926,15 @@ def spec(self, name, check_valid_token = False):
spec._set_compiler(self.compiler()) spec._set_compiler(self.compiler())
check_valid_token = False check_valid_token = False
elif self.accept(ID):
self.previous = self.token
if self.accept(EQ):
self.expect(ID)
spec._add_flag(self.previous.value, self.token.value)
self.previous = None
else:
return spec
else: else:
if check_valid_token: if check_valid_token:
self.unexpected_token() self.unexpected_token()

View file

@ -243,9 +243,6 @@ def test_unsatisfiable_compiler_version(self):
def test_unsatisfiable_architecture(self): def test_unsatisfiable_architecture(self):
set_pkg_dep('mpileaks', 'mpich arch=bgqos_0') set_pkg_dep('mpileaks', 'mpich arch=bgqos_0')
spec = Spec('mpileaks ^mpich arch=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf') spec = Spec('mpileaks ^mpich arch=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf')
print spec
spec.normalize()
print spec
self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, spec.normalize) self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, spec.normalize)
@ -339,7 +336,7 @@ def test_normalize_mpileaks(self):
self.assertEqual(lhs, rhs) self.assertEqual(lhs, rhs)
self.assertEqual(str(lhs), str(rhs)) self.assertEqual(str(lhs), str(rhs))
# Test that equal and equal_dag are doing the right thing # test that equal and equal_dag are doing the right thing
self.assertEqual(spec, expected_flat) self.assertEqual(spec, expected_flat)
self.assertTrue(spec.eq_dag(expected_flat)) self.assertTrue(spec.eq_dag(expected_flat))
@ -440,3 +437,5 @@ def test_copy_concretized(self):
orig_ids = set(id(s) for s in orig.traverse()) orig_ids = set(id(s) for s in orig.traverse())
copy_ids = set(id(s) for s in copy.traverse()) copy_ids = set(id(s) for s in copy.traverse())
self.assertFalse(orig_ids.intersection(copy_ids)) self.assertFalse(orig_ids.intersection(copy_ids))
# LocalWords: libdwarf