aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
AgeCommit message (Collapse)AuthorFilesLines
2022-03-24install_symlink: Handle $DESTDIR case for links with absolute pathMarco Trevisan (Treviño)1-2/+4
In case a link is pointing_to an absolute path and we are using $DESTDIR we fail in case the target is missing. This is incorrect because we may need to use an absolute path to an already installed file that is in $DESTDIR. So if an absolute target is not existing, check if we have such file in $DESTDIR before failing for real.
2022-03-09install: Add --strip optionXavier Claessens1-9/+14
2022-03-07Fix default install tag for shared lib symlinksXavier Claessens1-7/+3
Versioned shared libraries should have .so file in devel, .so.1 and .so.1.2.3 in runtime. Fixes: #9811
2022-02-28devenv: Source bash completion scriptsXavier Claessens1-10/+10
2022-02-16fix missing f-string preventing variable formattingEli Schwartz1-1/+1
Detected by flake8 which reported that `e` was an unused variable.
2022-02-09minstall: raise explicit errors, by using MesonExceptionEli Schwartz1-7/+7
RuntimeError is way too generic when we have an explicit class for "Meson reports to the user, something went wrong". Moreover we now tell people that generic exceptions are "Meson bugs and should be reported", so our failure to do the technically correct thing and report the right kind of exception means we get haunted by demons of confusion. Specifically, people complain to us that Meson told them "there is a bug in Meson" when their install fails due to meson.build or build environment issues.
2022-02-01minstall: stop running ldconfig for the userEli Schwartz1-43/+0
This was a nice idea in theory, but in practice it had various problems: - On the only platform where ldconfig is expected to be run, it is really slow, even when the user uses a non-default prefix and ldconfig doesn't even have permission to run, nor can do anything useful due to ld.so.conf state - On FreeBSD, it bricked the system: #9592 - On cross builds, it should not be used and broke installing, because ldconfig may not be runnable without binfmt + qemu: #9707 - it prints weird and confusing errors in the common "custom prefix" layout: #9241 Some of these problems can be or have been fixed. But it's a constant source of footguns and complaints and for something that was originally supposed to be just "it's the right thing to do anyway, so just do it automatically" it is entirely too risky. Ultimately I do not think there is justification for keeping this feature in since it doesn't actually make everyone happy. Better for users to decide whether they need this themselves. This is anyways the case for cmake and autotools and generally any other build system, so it should not be too intimidating... Fixes #9721
2022-01-16install: Setup VS env if we did that during setupNirbheek Chauhan1-1/+4
Otherwise we might not find a ninja that was picked up from the Visual Studio installation. ``` $ meson setup _build ... Activating VS 15.9.40 ... Found ninja-1.8.2 at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.EXE" $ meson compile -C _build Activating VS 15.9.40 ... $ meson install -C _build Can't find ninja, can't rebuild test. ``` Fixes https://github.com/mesonbuild/meson/issues/9774
2021-12-11install: Don't run ldconfig on cross buildsDylan Baker1-4/+5
Even if we install without a DESTDIR set, we should never update ldconfig when cross compiling. Fixes #9707
2021-12-01add install_symlink functionPablo Correa Gómez1-17/+45
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-11-28fix BSD ldconfig handling (#9631)Eli Schwartz1-5/+13
For libraries installed to libdir, it's not expected to have rpath hooked up. But for non-default libdirs, the path might not get searched by default. `ldconfig -m <libdir>` is convenient here, as it will programmatically add a new directory to search for shared libraries, so the resulting installed programs work out of the box. Include the dragonfly BSD platform name, which doesn't match the 'bsd' catch-all pattern.
2021-11-25minstall: do not run ldconfig on the *BSDsEli Schwartz1-0/+4
They don't utilize a soname cache, so running ldconfig without arguments is basically pointless -- and at least some of them are buggy: running ldconfig with the verbose flag switches on "delete all directories from the hints file, and recreate it using 0 command-line positional arguments", which would soft-brick the system. Fixes #9592
2021-10-27fix various flake8 whitespace errorsEli Schwartz1-2/+2
2021-10-10Fix typos discovered by codespellChristian Clauss1-1/+1
2021-10-10minstall: Ignore ldconfig errors when we did not install librariesXavier Claessens1-9/+22
Fixes: #9241
2021-10-08add install_emptydir functionEli Schwartz1-2/+16
This replaces the absolute hack of using ``` install_subdir('nonexisting', install_dir: 'share') ``` which requires you to make sure you don't accidentally or deliberately have a completely different directory with the same name in your source tree that is full of files you don't want installed. It also avoids splitting the name in two and listing them in the wrong order. You can also set the install mode of each directory component by listing them one at a time in order, and in fact create nested structures at all. Fixes #1604 Properly fixes #2904
2021-10-04condense linesEli Schwartz1-10/+5
2021-10-04f-stringsEli Schwartz1-14/+12
2021-08-17Add install tagsXavier Claessens1-9/+15
Fixes: #7007.
2021-08-06minstall: restore_selinux_contexts: fix env testStéphane Cerveau1-6/+3
To avoid extra env test, test destdir presence upper in restore_selinux_contexts
2021-08-06install: apply ldconfig at the end of the installStéphane Cerveau1-1/+19
On linux system ldconfig needs to be called to update the ld.so.cache to be able to load libraries from /usr/local/lib/x86_64-linux-gnu on debian based distributions for example.
2021-08-06install: update restore_selinux to use popen_safeStéphane Cerveau1-7/+8
Use Popen_safe to simplify the code.
2021-08-04destdir: Allow relative to build directoryXavier Claessens1-5/+10
Meson already works like that, except in do_copydir() that requires absolute destdir. Better explicitly support that instead of leaving it undefined and unconsistent.
2021-07-07resolve symlinks passed to -CPaolo Bonzini1-2/+2
"meson setup" is resolving symlinks for the build directory in validate_core_dirs. For consistency with it, do the same when the build directory is passed via -C to devenv, dist, init, install and test. This ensures for example that the path to test dependencies is computed correctly in "meson test". Fixes: #8765
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-22minstall: make intentions clearerDylan Baker1-2/+2
The existing code works, but it probably doesn't do what the author thought it would do. `(x or y or z) is not None` works by checking that each of those things are *truthy* in turn, and returning the first truthy value, which is compared against None. Using `all()` makes it very clear that what you want to do is make sure that each value is not None.
2021-06-22mesonlib: Fix FileMode type annotationsDylan Baker1-1/+2
2021-06-22minstall: fix type annotation for add_argumentsDylan Baker1-1/+1
This takes an `argparse.ArgumentParser` instance, not a namespace
2021-03-18minstall: always track meson-created directoriesEli Schwartz1-5/+1
If a custom_target output is a directory, we install it as a directory, not as a file. And, we try to track subdirectories which are created so uninstalling works. But one directory creation did not go through DirMaker, in the case where the output directory does not have any further subdirectories. Consolidate on makedirs, since I don't see much point in using os.mkdir right here.
2021-03-06minstall: Correctly set uid/gid of installed filesPeter Kjellerstedt1-1/+1
In commit caab4d3d, the uid and gid arguments passed to os.chown() by set_chown() were accidentally swapped, causing files to end up with incorrect owner/group if the owner and group are not the same. Also update the documentation to better indicate which argument to install_mode is which. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-18/+18
performed by running "pyupgrade --py36-plus" and committing the results
2021-02-22minstall: Add --skip-subprojects optionXavier Claessens1-17/+38
By default all subprojects are installed. If --skip-subprojects is given with no value only the main project is installed. If --skip-subprojects is given with a value, it should be a coma separated list of subprojects to skip and all others will be installed. Fixes: #2550.
2021-02-16Fix destdir detection for installation via polkitXℹ Ruoyao1-1/+1
In 0.57.0 installation via polkit won't work anymore. `destdir` is defaulted to an empty string ('') instead of None. But polkit installation code incorrectly tests `destdir is None`.
2021-02-04minstall: Add --dry-run optionXavier Claessens1-24/+100
Closes: #1281
2021-01-30add_install_script: add skip_if_destdir kwargXavier Claessens1-3/+6
It is common, at least in GNOME projects, to have scripts that must be run only in the final destination, to update system icon cache, etc. Skipping them from Meson ensures we can properly log that they have not been run instead of relying on such scripts to to it (they don't always).
2021-01-30minstall: Add --destdir command line optionXavier Claessens1-0/+7
2021-01-30Fix executable as script on WindowsXavier Claessens1-7/+3
On Windows this would fail because of missing DLL: ``` mylib = library(...) exe = executable(..., link_with: mylib) meson.add_install_script(exe) ``` The reason is on Windows we cannot rely on rpath to find libraries from build directory, they are searched in $PATH. We already have all that mechanism in place for custom_target() using ExecutableSerialisation class, so reuse it for install/dist/postconf scripts too. This has bonus side effect to also use exe_wrapper for those scripts. Fixes: #8187
2021-01-13minstall: Fix signature of monkeypatched os.chownDylan Baker1-3/+12
this also clears up the last of the mypy problems in minstall, yay!
2021-01-13minstall: Pass destdir and fullprefix instead of adding them to instanceDylan Baker1-25/+25
Same idea as the last patch, just different data
2021-01-13minstall: Pass DirMaker separately instead of adding to instanceDylan Baker1-24/+23
Add a new attribute to an object outside of the initializer of construtor is considered an antipattern for good reason, it's gross, it's confusing, and it often leads to AttributeErrors down some paths. Let's not do that.
2021-01-13minstall: Add type annotationsDylan Baker1-31/+64
This adds annotations and fixes a couple of issues (passing Set[bytes] where List[byte] is expected), however, there's some very gross addition of attributes to types going on that I haven't fixed yet, and mypy is very grump about.
2021-01-13build: Add some type annotationsDylan Baker1-0/+2
2021-01-13minstall: fix importsDylan Baker1-6/+10
This uses PEP8 style, one per from `import mod`, but with commas from `from mod import a, b`. Also run sort, for niceness.
2020-12-28Fix missed imports in #7902wereii1-0/+3
2020-12-14mtest: only build what is needed for the testsPaolo Bonzini1-1/+17
It is a usual workflow to fix something and retest to see if it is fixed using a particular test. When tests start to become numerous, it becomes time consuming for "meson test" to relink all of them (and in fact rebuild the whole project) where the user has already specified the tests they want to run, as well as the tests' dependencies. Teach meson to be smart and only build what is needed for the test (or suite) that were specified. Fixes: #7473 Related: #7830
2020-12-10install: don't elevate when using destdirThomas Weißschuh1-1/+1
Previously the destdir was ignored completely when using elevated privileges to install files as pkexec stripped the DESTDIR environment variable. As the destdir is not supposed to require any special privileges anyways, just re-raise the error.
2020-09-22pylint: Turn on warnings for incorrect number of argsDylan Baker1-1/+1
This catches some very real errors. The one in scalapack is pretty silly actually, it's failing to figure out that the exploded list is at least two arguments. However, the code is actually clearer by not using a list and exploding it, so I've done that and pylint is happy too.
2020-09-10minstall: Add version field to install dataNirbheek Chauhan1-1/+13
And check the install data in the same way that mtest checks serialisation data. Fixes https://github.com/mesonbuild/meson/issues/2354
2020-09-08minstall: Print a big FAILED when a script failsNirbheek Chauhan1-4/+6
We don't run any further scripts when this happens, so we need to print a big error. The exit code was already correct. Fixes https://github.com/mesonbuild/meson/issues/7627
2020-08-20simplify shutil usage by invoking copy2 where appropriateEli Schwartz1-4/+2
It's equivalent to copyfile + copystat with the same arguments.