Skip to content

Commit

Permalink
lockfiles with --base do not provide build-order (#7551)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsogo committed Aug 19, 2020
1 parent 4654095 commit 39395a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conans/client/conan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,10 @@ def lock_build_order(self, lockfile, cwd=None):
lockfile = _make_abs_path(lockfile, cwd)

graph_lock_file = GraphLockFile.load(lockfile, self.app.cache.config.revisions_enabled)
if graph_lock_file.profile_host is None:
raise ConanException("Lockfiles with --base do not contain profile information, "
"cannot be used. Create a full lockfile")

graph_lock = graph_lock_file.graph_lock
build_order = graph_lock.build_order()
return build_order
Expand Down
8 changes: 8 additions & 0 deletions conans/test/functional/graph_lock/build_order_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def single_consumer_test(self):
jsonbo = json.loads(client.load("bo.json"))
self.assertEqual([], jsonbo)

def test_base_graph(self):
client = TestClient()
client.save({"conanfile.py": GenConanfile("test4", "0.1")})
client.run("lock create conanfile.py --base --lockfile-out=conan.lock")
client.run("lock build-order conan.lock --json=bo.json", assert_error=True)
self.assertIn("Lockfiles with --base do not contain profile information, "
"cannot be used. Create a full lockfile", client.out)

@parameterized.expand([(True,), (False,)])
def build_not_locked_test(self, export):
# https://github.com/conan-io/conan/issues/5727
Expand Down

0 comments on commit 39395a5

Please sign in to comment.