Closed regexident closed 2 years ago
Thanks for the PR! I'm curious what's the use for this is. I'm more than happy to merge it, mostly wondering what prompted it :)
Also, there are a couple notes I have on the code changes:
/opt/rustwide/patch/{id}
behind the scenes would greatly improve the API (you can get the /opt/rustwide
with crate::cmd::ROOT_DIR
).Thanks for the PR! I'm curious what's the use for this is. I'm more than happy to merge it, mostly wondering what prompted it :)
The idea behind the addition is being able to run an experiment from your local working directory rather than having to have a remote branch on a git repo.
Also, there are a couple notes I have on the code changes:
- It'd be nice if Rustwide handled creating the read-only mount point when a path-based patch is added. Right now the API could be confusing, as you have to put the path inside the container in the method call. Mounting it somewhere like
/opt/rustwide/patch/{id}
behind the scenes would greatly improve the API (you can get the/opt/rustwide
withcrate::cmd::ROOT_DIR
).
That would indeed be a nice feature. What would you suggest to use as {id}
here?
- There doesn't seem to be a buildtest for this change. Adding one would make sure this feature doesn't regress.
I looked for tests for the existing branch-based patch, but couldn't find any and didn't know how to best test these.
- What are the interactions with this and running Rustwide itself inside Docker?
I honestly don't know. I'm not all that familiar with Docker, tbh.
Sorry for taking a while to respond!
That would indeed be a nice feature. What would you suggest to use as {id} here?
I'm fine with whatever, even a random string or a number. It just needs to be unique :)
I looked for tests for the existing branch-based patch, but couldn't find any and didn't know how to best test these.
This would require a buildtest. I'd create a dummy crate that requires a patch to compile, provide the patch in the buildtest and ensure the crate builds fine. If you need more pointers you can ping me on Zulip!
I honestly don't know. I'm not all that familiar with Docker, tbh.
Once you have the buildtest working you can easily test this by adding an inside_docker test that tries to execute the buildtest you wrote before.
@pietroalbini Took me a while to actually get to it but it's done now.
Thanks for the great pointers on what I'd need to change and where, btw. Much appreciated!
I wasn't sure what would be the best dummy dependency to use for patching, so used carols10cents' dependencies placeholder crate (as it is unlikely to go away and hasn't been yanked).
It makes for a bit unintuitive toml file though:
[dependencies]
dependencies = "0.1.0"
[patch.crates-io]
dependencies = { path = "./dependencies" }
Open for suggestions on a better dependency to use.
You can use https://crates.io/crates/empty-library as an empty dependency.
Hah, I was sure the project would have something like that. Fixed.
The PR should be ready to merge now, I think @pietroalbini.
The PR should be ready to merge now, I think @pietroalbini.
I think a changelog entry should be added under the unreleased subheading.
@Skgland Done. 🙂
@pietroalbini Is there anything else I can/have to do to have this merged and a release cut with it?
Sorry for taking a long time to merge this, will release it soon!
Released rustwide 0.15.0 with this change.
Thank you so much for this @pietroalbini!
Combined with a sandbox mount this allows for patching with a local file path, instead of a remote git repo branch.