Skip to content

Commit

Permalink
fix build order with build=missing with lockfiles (#6529)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Feb 12, 2020
1 parent 190b2e9 commit 3039432
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conans/model/graph_lock.py
Expand Up @@ -273,7 +273,7 @@ def update_check_graph(self, deps_graph, output):
if (pref.id == PACKAGE_ID_UNKNOWN or pref.is_compatible_with(node_pref) or
node.binary == BINARY_BUILD or node.id in affected or
node.recipe == RECIPE_CONSUMER):
self._upsert_node(node)
lock_node.pref = node.pref
else:
raise ConanException("Mismatch between lock and graph:\nLock: %s\nGraph: %s"
% (repr(pref), repr(node.pref)))
Expand Down
20 changes: 20 additions & 0 deletions conans/test/functional/graph_lock/graph_lock_test.py
Expand Up @@ -774,3 +774,23 @@ class Meta(ConanFile):
self.assertIn('"options": "variation=nano"', lockfile)
client.run("create ffmepg ffmpeg/1.0@ --build --lockfile")
self.assertIn("ffmpeg/1.0: Requirements: Variation nano!!", client.out)


class GraphLockBuildRequiresNotNeeded(unittest.TestCase):

def test_build_requires_not_needed(self):
client = TestClient()
client.save({'tool/conanfile.py': GenConanfile(),
'libA/conanfile.py': GenConanfile().with_build_require_plain("tool/1.0"),
'App/conanfile.py': GenConanfile().with_require_plain("libA/1.0")})
client.run("create tool tool/1.0@")
client.run("create libA libA/1.0@")
client.run("create App app/1.0@")

# Create the full graph lock
client.run("graph lock app/1.0@ --build")
client.run("create libA libA/2.0@ --lockfile")
client.run("graph build-order . --json=bo.json --build=missing")
bo1 = client.load("bo.json")
client.run("graph build-order . --json=bo.json --build=missing")
self.assertEqual(bo1, client.load("bo.json"))

0 comments on commit 3039432

Please sign in to comment.