Allow running bst commands from workspace directory
Say I want to open a workspace for some GNOME module, let's use gnome-desktop. I do this:
$ cd ~/Projects/gnome-build-meta
$ bst workspace open core/gnome-desktop.bst ~/Projects/gnome-desktop
Now I make some changes to the module and want to build it:
$ cd ~/Projects/gnome-desktop
# change stuff
$ bst build core/gnome-desktop.bst
It doesn't work, because I need to be in my gnome-build-meta directory for any bst commands to work. This means I either need to keep two different terminal windows open at all times, or else continually cd between the workspace directory and the gnome-build-meta directory whenever I want to switch between running bst commands or git commands.
The workspace ought to somehow know that it was checked out from gnome-build-meta, to avoid this problem. It should be doable using git config; bst could have done something like git config set bst.projects-dir ~/Projects/gnome-build-meta
after checking out the git repo, so it would know where to look for the projects and running bst commands would work anywhere within the gnome-desktop repo. That's just one possibility; no doubt there are better ways to make it work.
Update: a proposal has been sent to the mailing list that covers this ticket.
Update by Jonathan Maw on 19th November:
Following a summary E-mail, there are multiple mostly-discrete steps to this:
- Create a .bstproject.yaml file when a workspace is opened, and remove it when the workspace is closed.
- When invoking buildstream in a workspace that exists outside a project, read .bstproject.yaml to find the path to the project, and run all commands that way.
- As 2, but the element name is optional, defaulting to the element that this source belongs to.
- When workspaces are opened with
--force
, keep track of multiple projects accessing this workspace.bst
commands run inside the workspace default to the first project to open this workspace.