-
Notifications
You must be signed in to change notification settings - Fork 16
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
Revamping wrapper scripts in CURI #455
Comments
I agree that is unfortunate and fixing it would be beneficial enough to offset the drawbacks listed.
I'm not clear what purpose the Somewhat related is that it is currently possible for someone to have both |
On Windows they are mandatory, because Windows does not understand shebang lines. On everything else shebang lines are an option. But shebang lines are very limited in what they can do.
Ouch. This sucks. Do you know whether there are any usecases other than rolling your own wrappers? If no, I'd vote for disallow. |
Potentially to provide not-commonly used public scripts without squatting on certain names more appropriate for more common usage code. Or for making it explicit what the tool is for. For example macOS comes with |
That's an interesting point. I think there are conflicting interests here, which we'll have to trade off.
In addition I think we don't want to overengineer. All ideas I can come up with that could potentially satisfy all requirements seem fragile or too magical to me. They are:
More thoughts:
My current tendency is to give clear limitations and guidelines on how script files are to be named. I.e. in the If there are any other ideas how we could solve this / how a good tradeoff could look, please tell! |
People will still want to be able to run their code without it being installed, ideally with the same program name as if it were installed. For example to install zef you do |
Do you have an idea how to achive that? I personally don't find this specific inconvenience too bad, because:
One idea that comes to mind: Forbid files ending in One more thought: There is this duality that on the one hand we want to provide the convenience of generating sensible wrappers for the module authors' scripts and on the other hand keep the notion that the files in
|
A huge problem is those specific instructions (zef install) are in use and documented all over the place. For instance all existing rakubrew installations would be broken if bin/zef didn’t exist in zefs repository. |
On December 6, 2024 3:22:59 PM GMT+01:00, Nick Logan ***@***.***> wrote:
> I personally don't find this specific inconvenience too bad
A huge problem is those specific instructions (zef install) are in use and documented all over the place. For instance all existing rakubrew installations would be broken if bin/zef didn’t exist in zefs repository.
Phew. So it's a back compat issue as well. Now I'm glad I created a problem-solving issue. This has gotten a lot more hairy than I originally anticipated.
Do you have any ideas what to do? I am a bit stumped. It seems that whatever we do, some part of it always sucks.
The best idea I can come up with is to add some detection logic that checks if a script is valid Raku. If so, assume it had a `.raku` extension. And then deprecation-periodify our way out for new modules.
I just now realize, that we can't just dictate a new module format. We have a large set of existing modules that we can't magically migrate to the new format. So we'll have to support the current format indefinitely, right?
|
The only thing that comes to mind is that maybe #393 could help solve it somehow.
Could be hard. Many of my bin scripts are literally just
If you're talking about the module format of installed modules? Then that can be changed with the upgrade-repository thing I linked earlier. If you're talking about the module format of individual modules being distributed and installed via zef, then yeah that becomes a bit harder. We nagged people to e.g. update META6.info to META6.json, but zef had already supported both options for a long time so any version of zef that was already installed likely already supported the new name for multiple years. On the other hand we've tried call |
I've started on a proof of concept implementation. That implementation is currently indifferent to whether the script has the
Yes, that's what I was referring to.
I guess the best we can do is we can encourage people to name their script with a |
(I know I break the rules by presenting a solution in the first post. But I mostly seek feedback on my proposal, I don't want to kick of a brainstorming round.)
The bat wrappers we generate on Windows don't kick it and never will. To give one example: It's currently impossible to run
zef install 'ABC:ver<0.6.13>:auth<zef:colomon>'
on Windows. The<
and>
characters don't survive a trip through CMD-land.Thus I believe I need to pick up rakudo/rakudo#3716 (comment) again. Here is an updated copy of that post.
The following is my (potentially incorrect) understanding of how things work. Please correct me where I'm wrong.
A CURI (CompUnit::Repository::Installation) is a store represented as a folder for installed modules. It contains everything a module needs, including the actual
something.raku
script. All contents (including that script) are stored in a way opaque to the user. Running such an installed script requires calling the following Raku method:Wrappers which basically only execute the above call are installed in the
curi_store/bin
subfolder. For those wrapper scripts to work their path must be in PATH or they need to be called with their absolute path. (Sidenote: On Windows there are no shebang lines. There additional.bat
files are generated.)There are three standard CURIs every Rakudo installation brings with it:
core
,site
andvendor
installed into$prefix/share/perl6/
. In principle thesite
andvendor
CURIs could be shared between multiple Rakudo installations, but that doesn't make much sense, as every installation brings its own set with it.There can be additional CURIs in arbitrary places. Which CURIs are used is configurable.
Relocatable Rakudo installations have a well defined directory layout. Things (
rakudo
executables, CURIs, libs, ...) are always in the same place relative to each other.There are different situations we need to consider:
rakudo
excutable in the shebang line.env
in the shebang line and hope that the PATH points to the Rakudo this CURI belongs to. (That's not guaranteed.)rakudo
path based on the location of the wrapper. Something like$wrapper_path/../../../bin/rakudo
.env
and just use the Rakudo that happens to be in the PATH.In every case we want to keep our ability to call a script by passing it to some rakudo:
/some/rakudo /path/to/curi/share/perl6/site/bin/my_script.raku
.I tend towards the following:
bin/
. A*.raku
file that is not executable and an executablesh
/exe
wrapper script/program.PATH
.Before I start implementing things, I'd like to get the outline right.
There are two key points that I feel I want to have a second opinion on (because they are unconventional).
I want to generate native executables for each script in a CURI on Windows. I believe I can do that by integrating https://sr.ht/~patrickb/Devel-ExecRunnerGenerator/ into the Rakudo core. It's basically a native executable that can be tuned by attaching a config to the end of the binary file to do what we want it to do. My idea is to compile that executable as a part of the Rakudo build process. The executable is 16.5KiB.
Potential problems I see: Dynamically creating executables on Windows might be an anti-virus / Microsoft security nightmare. I do not know if this will be a problem or if it can be worked around.
I want to always put two files in the
bin/
folder. A*.raku
script, not marked executable, and ash
script (*nix) /.exe
(Windows). That's the only way I managed to come up with that gives us the flexibility we need to support all of our use cases.Potential problems I see: People hate having twice as many files in
bin/
or having non-executable files inbin/
or having non-raku files inbin/
.The text was updated successfully, but these errors were encountered: