Commit Graph

3 Commits

Author SHA1 Message Date
Jehan 8e74a22ce7 tools: improve the install-* meson targets.
Continue installing the list of files to install even if a failure
occured. In particular, I encountered a problem where script-fu was
failing to install because the installed binary was being executed (and
its memory probably mmap-ed). Hence the copy failed with:

> [Errno 26] Text file busy: '/my/prefix/lib64/gimp/2.99/plug-ins/script-fu/script-fu'

Yet trying to reinstall plug-ins while GIMP is being run, hence
script-fu is being executed, is a very common development trick (for me
at least). So instead, when such an error occurs, I simply save it and
output all the exceptions in the end (where these warnings are properly
visible), instead of failing everything.

Of course, ideally the subtarget should not even try to install
script-fu as it is unchanged. This is why I changed shutil.copy() by
shutil.copy2() to install metadata, which include last access timestamp.
Maybe this could be used to decide whether the installed file is already
the last one, thus not retry, though I am actually unsure if this is
enough (on the other hand, the ultimate check of bit-to-bit comparison
may obviously be too much/slow which is counter-productive), which is
why I am not doing this change right now.
2019-09-15 00:00:35 +02:00
Jehan 3bfbf9972a tools: fix install-* meson targets.
We should not rely on the current working directory, as it looks like
meson sets it to be the source directory (even when actually in the
build dir) when running custom target (so it fails).

Instead meson explicitly sets MESON_SOURCE_ROOT and MESON_BUILD_ROOT
environment variables for us. We should use these. This should work in
every cases (whether calling from the source or build dir).

Also removing the special-casing for a _build/ directory. This updated
version is generic and won't assume that you used some generic naming or
direct subdir under the source (even if many people might use this path
and name; I, for one, certainly don't!).

See: https://mesonbuild.com/Run-targets.html
2019-09-11 18:43:34 +02:00
Félix Piédallu db8922738f Add meson_install_subdir script 2019-09-11 16:42:04 +02:00