-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Redesign link creation for installer of CLI tools #4400
Comments
I find this rather interesting but clearly I have to read about it as I haven't looked as DSM7 symlink nor followed-up on your SPK_LINKS variables... So I have a bit of catch-up before being able to comment. |
@publicarray as I wrote a comment and a hint I am not sure whether it is a good or a bad idea to switch from sc link creation to official usr-local-linker. |
Yes, writing files outside the package directory directly are not permitted (except when allowed through settings, for example shared folders) the only way to do that now is through resource "workers". I think giving a package "system" permissions may also work but I've not messed with that (I don't think it's the right approach but may be used as a band-aid with bubblegum).
I think if more advanced features are required package developers can create the JSON resource file themselves, and we can add more variables to define the other resource types. If we can I would like to avoid including python. just my 2 cents |
I have written a small python file to do this. We already have python 3 in the development environment, and this script runs on the development system only. |
Cool, My only concern would be is that we make spksrc more complicated for new contributors. Maybe makefiles/shellscripts where not the right choice and everything should be python or golang etc. But that's' for another topic. Or maybe is just me talking with little python experience. 🤷♂️ |
Actually I'm interested to see the implementation. Maybe |
@publicarray just added the script to the dsm7 branch. |
@hgy59 Thanks! and congrats. only thing missing is the read write permissions for shared folders. Thanks for pushing this because while looking over the code again I've simplified the jq command for SPK_COMMANDS. Sorry for asking but I don't think I understand why is |
your current implementation does not regard different folders.
|
Thanks, I see the difference now. but AFAIK If not should we add a filter? echo '{}' | jq --arg binaries 'bin/foo bin/bar sbin/foooo' '."usr-local-linker" = {"bin": $binaries | split (" ") | map(scan("^bin.*")) }'
{
"usr-local-linker": {
"bin": [
"bin/foo",
"bin/bar"
]
}
} |
AFAIU the dsm developer guide, the supported folders are bin, lib, etc, ... - so the list is not conclusive, and sbin may be supported as well (will have to test this). for my dotnet-sdk evaluation I had to create a custom resource file anyway, as this is neither supported by
the second entry ("share") is supported by the python script. I would rather avoid a filter and make it open for any /usr/local subfolder. |
@publicarray I must revoke my comment above: Just found that
does not create a link in I didn't realize this, as dotnet-sdk is working as expected (without the link to /usr/local/share):
So my suggestions are:
|
It's possible to do with jq, however it's not necessarily readable though: Edit: new version echo '{}' | jq --arg links_str 'etc:var/foo lib:libs/bar etc:share/baz' '."usr-local-linker" += ($links_str | split (" ") | map(split(":")) | group_by(.[0]) | map({(.[0][0]) : map(.[1])}) | add)'
{
"usr-local-linker": {
"etc": [
"var/foo",
"share/baz"
],
"lib": [
"libs/bar"
]
}
} https://stedolan.github.io/jq/manual/
|
solved by |
Some times ago I introduced
SPK_COMMANDS
andSPK_LINKS
makefile variables to create links in/usr/local/bin
and other destinations (see #3852).It is now time for a redesign and to use the officially documented "Resource Config" with so called
usr-local-linker
resources.Benefits
Downside:
Brainstorming:
jq
to generate json from bash scripts is too limited to implement multiple usr/local folders from SPK_COMMANDS variableresource
file from Makefile variablesThe text was updated successfully, but these errors were encountered: