-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Add a library of common helper functions for use in spkg-install #23160
Comments
comment:1
This could also replace the |
comment:2
The whole point of this
is to abort when the variable is not defined. A plain |
comment:3
I would also rename |
comment:4
I'm not sure I understand. It's already defined to exit the script immediately. |
comment:5
Replying to @embray:
Oh, you mean if it's not defined in the first place. |
comment:6
One point I will make though, is that if more of the build functionality is moved into helper functions there's also less effect a script can have if it's run outside the sage environment. For example if |
comment:7
Okay, I'd be fine with something like |
comment:8
That said, this brings me back around to the idea I was mulling earlier, that maybe the Only when the script is copied to the temporary install directory does it get marked executable, and gets a header automatically written which, among other things, ensures that the correct This might limit it to being a shell script, but it could still be a wrapper for a non-shell executable if desired (there are only a couple cases of this currently, such as atlas). |
comment:9
Replying to @embray:
My gut feeling is that this is a bit too much magic. At least the |
comment:10
That was my feeling too at first, which is why I dropped the idea initially. But now that I've tried it I think it has a number of advantages, including the fact that it automatically makes these scripts more robust without their authors having to think about details that aren't immediately related to building/installing the package. |
comment:11
Have a look at #23179. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
|
comment:13
Rebased on latest version of #23179 |
Dependencies: #23179 |
comment:15
Needs to be rebased on the latest version of #23179. Given that I'll probably wait with a review for this ticket until after the next beta, you could also wait until then and then rebase on 8.1.beta0. |
comment:16
True, it needs to be rebased now. I don't mind the timing, but why specifically after the next beta? Or is that just the next point at which #23179 will be merged into develop? |
comment:18
Actually, just to be clear, if you (or anyone else) wants to review this sooner you can still see the diff between this branch and the branch for #23179 like so: sagemath/sagetrac-mirror@u/embray/build/helpers...u/embray/build/script-wrappers That should make reviewing this much easier. |
comment:19
I'd rather be sure that #23179 really is merged. It wouldn't surprise me if problems would come up with that ticket. |
comment:20
It wouldn't surprise me either, though not much of this ticket is really strongly dependent on #23179. It only affects how |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:26
Oops, that was not intentional. It's possible I pushed from a different computer where I still had that commit in the branch. I'm a little confused by that because normally I would have made sure to sync up first, but it was 3 weeks ago so I don't remember. |
comment:27
Replying to @jdemeyer:
Yes, I already added something like that in #22509, but it might be worth pulling into a separate ticket. I just added it there because it became increasingly useful. |
comment:28
I see why I'm confused. This needs to be rebased on the final version of #23179. I don't know why you removed the dependency. I think it's useful to have listed in the ticket even if the dependency has been completed. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:31
If you intend that
These could be handled analogously to |
Dependencies: #23179 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:34
If this otherwise works for you, I'm also going to add some updates to the developer documentation. Of course, I will continue to update the docs as more helpers are added... |
comment:35
Replying to @embray:
On second thought; as it stands with this ticket the helpers that it adds are few in number and trivial enough that there's not enormous advantage to using them. This will change, however, after a few more updates that will add some additional helpers. But maybe the feature isn't worth advertising until it's more complete. In the meantime it will be useful to have the framework in place so that it can be built on. |
comment:36
Works for me... |
Reviewer: Jeroen Demeyer |
comment:37
You want this to be merged? There is no milestone set... |
Changed branch from u/embray/build/helpers to |
This idea has come up before but not been implemented. My implementation simply adds a collection of shell functions with names prefixed by
sdh_
for Sage distribution helpers (this is somewhat inspired by, but much simpler than, thedh_
programs from thedebhelper
package in Debian).These functions are exported by
sage-spkg
, and so are immediately usable by anyspkg-build
,spkg-install
, or similar scripts executed fromsage-spkg
(these are still not required to be shell scripts, but as most are having such a library is convenient).One piece of boilerplate I replaced with a function is the check in most
spkg-install
s for$SAGE_LOCAL
. A downside to this is that if the script is run outside the correct environment, then rather than getting a useful error message we just get thatsdh_check_vars
is undefined. I have two thoughts on this:In general these scripts shouldn't be run directly in the first place. In the case that they are (such as testing) the person developing the package should have some awareness of the fact that these scripts are being run from
sage-spkg
and assumesage-env
has been sourced.Most of the time these scripts are run, it's after they've been copied to a temporary build directory for the package. If nothing else,
sage-spkg
could create a wrapper around these scripts that automatically sets some default assumptions (such as sourcingsage-env
and the newsage-dist-helpers
).In general, though, I think having a library of helper functions will be a big improvement to the consistency and legibility of theses scripts.
This ticket also updates the
spkg-install
forpatch
for demonstration purposes only. I don't intend with this to go on a mass rewriting of install scripts, but having this will be helpful for some other work (e.g. #22509, #22510).Depends on #23179
Component: build
Author: Erik Bray
Branch/Commit:
48fe6ac
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/23160
The text was updated successfully, but these errors were encountered: