You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by "juergbi (via GitHub)" <gi...@apache.org> on 2024/04/05 12:19:42 UTC

Re: [PR] Support mapping subproject aliases to aliases of the parent project [buildstream]

juergbi commented on code in PR #1906:
URL: https://github.com/apache/buildstream/pull/1906#discussion_r1553527430


##########
src/buildstream/_project.py:
##########
@@ -220,6 +221,17 @@ def translate_url(self, url, *, first_pass=False):
             url_alias, url_body = url.split(utils._ALIAS_SEPARATOR, 1)
             alias_url = config._aliases.get_str(url_alias, default=None)
             if alias_url:
+                if self.junction:
+                    parent_project = self.junction._get_project()
+                    parent_alias = self.junction.get_parent_alias(url_alias)
+                    if parent_alias:
+                        # Delegate translation to parent project
+                        return parent_project.translate_url(
+                            parent_alias + utils._ALIAS_SEPARATOR + url_body, first_pass=first_pass
+                        )
+                    elif parent_project.disallow_subproject_uris:

Review Comment:
   If the junction has a mapping from the subproject alias to a parent project alias, `translate_url()` should be delegated to the parent project independent of whether the parent project enforces this delegation or not.
   
   If we want to support alias mappings in junctions only if the parent project enforces delegation for all aliases, we should instead report an error when encountering an alias mapping in a junction (as it would otherwise be unused, which would only cause confusion). However, I don't see a reason for such a restriction.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org