-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Workspaces] Fix conanws.yml requiring 'ref' specification #19115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for raising this issue and contributing the fix @dev0x13!
I have checked the PR, and it seems that it is possible to better leverage the existing packages() to compute the package reference, instead of having to re-implement the logic here.
I am trying these changes and it seems works fine:
diff --git a/conan/api/subapi/workspace.py b/conan/api/subapi/workspace.py
index 41ce0d670..8946d787c 100644
--- a/conan/api/subapi/workspace.py
+++ b/conan/api/subapi/workspace.py
@@ -263,10 +263,10 @@ class WorkspaceAPI:
def super_build_graph(self, deps_graph, profile_host, profile_build):
order = []
- packages = self._ws.packages()
+ packages = self.packages()
def find_folder(ref):
- return next(p["path"] for p in packages if RecipeReference.loads(p["ref"]) == ref)
+ return next(p["path"] for ref, p in packages.items() if ref == ref)
for level in deps_graph.by_levels():
items = [item for item in level if item.recipe == "Editable"]
diff --git a/test/integration/workspace/test_workspace.py b/test/integration/workspace/test_workspace.py
index 271a3a5f9..00911c41b 100644
--- a/test/integration/workspace/test_workspace.py
+++ b/test/integration/workspace/test_workspace.py
@@ -1117,6 +1117,11 @@ def test_workspace_defining_only_paths():
assert "liba/0.1@myuser/mychannel - Editable" in c.out
assert "libb/0.1 - Editable" in c.out
+ c.run("workspace super-install")
+ assert "app1/0.1 - Editable" in c.out
+ assert "liba/0.1@myuser/mychannel - Editable" in c.out
+ assert "libb/0.1 - Editable" in c.out
+ I also think it would be better not to change the new workspace template, removing one of the references there, as it will leave it a bit asymetrical. So I have added a conan workspace super-install call to the test that defines the workspace only with paths, to check it works.
|
@memsharded Thanks for review and for the comments! I made the requested changes with a slight fix to the proposed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, many thanks!!
|
Merged! It will be in next 2.22, thanks! |
Changelog: Omit
Docs: Omit
This PR fixes the seemingly (according to docs) incorrect requirement for
reffield presence in theconanws.ymlfile. Without the fixconan workspace super-installfails withKeyError: 'ref'if any of listed packages lacksrefspecification.It seems that the behaviour was accidentally broken in this commit, so I also removed
refspecification from one of the packages in the workspaces template file, so that it's covered by the existing tests.