Reacting to build errors from a Portfile (e.g. giving specific hints)
René J.V. Bertin
rjvbertin at gmail.com
Sat Aug 24 23:11:10 UTC 2024
Hi,
It there any Tcl mechanism we can exploit to let a port react to a build (or destroot) failure, to implement a `notes`-like feature to define messages that are only to be printed in case something goes wrong during the build? Say, print a suggestion of a way to try again?
One way I could think of is to use one of the `atexit` implementations that float on the interwebs, to install a callback that will print a message if one is set. So, set the message in the `pre-build`, unset it in the `post-build`.
The question is of course
- can I override the `exit` function from within a Portfile, and will that override then be called when the `port` command exits?
- will the callbacks be called in their original context will all variables still set?
(I could try, but if things don't work I'll never know if that's because I'm overlooking something or if I'm trying the impossible ^^)
R.
More information about the macports-dev
mailing list