summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/meson_install.py
Commit message (Collapse)AuthorAgeFilesLines
* Made install a top level Meson command.Jussi Pakkanen2018-06-181-441/+0
|
* meson_install: Don't add DESTDIR to install_nameNirbheek Chauhan2018-06-181-2/+1
| | | | | | | This was added accidentally. Includes a test for it. Also fix a rebase error. The variable was defined incorrectly and was overwritten with the correct value immediately afterwards.
* macos: Rewrite install_name for dependent built libraries on installNirbheek Chauhan2018-06-181-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | On macOS, we set the install_name for built libraries to @rpath/libfoo.dylib, and when linking to the library, we set the RPATH to its path in the build directory. This allows all built binaries to be run as-is from the build directory (uninstalled). However, on install, we have to strip all the RPATHs because they point to the build directory, and we change the install_name of all built libraries to the absolute path to the library. This causes the install name in binaries to be out of date. We now change that install name to point to the absolute path to each built library after installation. Fixes https://github.com/mesonbuild/meson/issues/3038 Fixes https://github.com/mesonbuild/meson/issues/3077 With this, the default workflow on macOS matches what everyone seems to do, including Autotools and CMake. The next step is providing a way for build files to override the install_name that is used after installation for use with, f.ex., private libraries when combined with the install_rpath: kwarg on targets.
* depfixer: Rewrite install_name for dylibs on installNirbheek Chauhan2018-06-181-1/+3
| | | | | | | | | | The install name is used by consumers of the library to find the library at runtime. If it's @rpath/libfoo.dylib, all consumers must manually add the library path to RPATH, which is not what people expect. Almost everyone sets the library install name as the full path to the library, and this is done at install time with install_name_tool.
* Fix issues found by flake8Xavier Claessens2018-06-061-1/+1
|
* Add 'install_mode' to all installable targetsFilipe Brandenburger2018-06-021-11/+13
| | | | | | | | | This makes it possible to customize permissions of all installable targets, such as executable(), libraries, man pages, header files and custom or generated targets. This is useful, for instance, to install setuid/setgid binaries, which was hard to accomplish without access to this attribute.
* Print message when using polkitRyan Gonzalez2018-05-181-0/+2
|
* Fix #3579: Wait for a permissions failure before trying to run pkexecRyan Gonzalez2018-05-181-13/+17
|
* Support installation via polkitRyan Gonzalez2018-05-171-17/+27
|
* Add new builtin option --install-umaskFilipe Brandenburger2018-04-181-8/+33
| | | | | | | | | | | | | | | | | | | | | This option controls the permissions of installed files (except for those specified explicitly using install_mode option, e.g. in install_data rules.) An install-umask of 022 will install all binaries, directories and executable files with mode rwxr-xr-x, while all data and non-executable files will be installed with mode rw-r--r--. Setting install-umask to the string 'preserve' will disable this feature, keeping the permissions of installed files same as the files in the build tree (or source tree for install_data and install_subdir.) Note that, in this case, the umask used when building and that used when checking out the source tree will leak into the install tree. Keep the default as 'preserve', to show that no behavior is changed and all tests keep passing unchanged. Tested: ./run_tests.py
* 🤦🤦🤦Jussi Pakkanen2018-04-141-7/+1
|
* Update depfixer to fix rpaths also on OSX.Jussi Pakkanen2018-04-081-2/+1
|
* Fix FileNotFoundError when restorecon unavailableFabrice Fontaine2018-03-151-0/+4
| | | | | | | Fixes: - http://autobuild.buildroot.net/results/d5dcdfdfab3503fdc387f99e68267972a38c417d Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* Use specific exception types instead of ExceptionAleksey Filippov2018-03-121-1/+1
|
* Do not use bare except [flake8]Aleksey Filippov2018-03-111-1/+1
| | | | | Use more specific exception types where appropriate. This patch does not change bare except calls if exception is re-raised.
* Fix install_subdir() installation messageAleksey Filippov2018-02-051-5/+5
| | | | | | | | Print full destination path in 'Installing subdir ...' message, including DESTDIR, consistent with other installation functions. Use separate dst_dir and full_dst_dir variables to avoid mixing up the order in the future and make code more readable. Closes #3006.
* Refactor and simplify install_subdir()Aleksey Filippov2018-02-041-18/+36
| | | | | | | | | | | | | - Pass exclude_files and exclude_directories relative to src_dir, same as specified by user and documented in public install_subdir(). - Make do_copydir() interface similar to do_copyfile(): install src_dir contents to dst_dir. - Remove src_prefix/src_dir code, it adds confusion and duplicates arguments. Use single src_dir parameter instead. - Make callers specify that src_dir contents should be installed under dst_dir/basename(src_dir) if necessary. - Use os.path.relpath() instead of string manipulations on paths. - Add documentation to do_copydir(): specify types and add usage example.
* Use os.path: basename() and dirname() instead of split()Aleksey Filippov2018-01-301-8/+8
| | | | | | | | | | | | According to Python documentation[1] dirname and basename are defined as follows: os.path.dirname() = os.path.split()[0] os.path.basename() = os.path.split()[1] For the purpose of better readability split() is replaced by appropriate function if only one part of returned tuple is used. [1]: https://docs.python.org/3/library/os.path.html#os.path.split
* Silence failed restorecon calls when $DESTDIR is setZbigniew Jędrzejewski-Szmek2017-11-191-1/+3
| | | | | | | | | | | | This avoids hundres of warnings like: Warning no default label for /var/tmp/instroot.hUbtYJ/path/to/some/binary $DESTDIR is usually set to a temporary path, in which case the path is unknown to selinux. For that case we could just skip the restorecon calls. But sometimes it is used with a path to container. In that case, most of the time, selinux has no context for that path. But we can't rule that out somebody added custom context rules for the container. So let's still call restorecon, but silence the warning.
* Pass restorecon file list through stdin.Elliott Sales de Andrade2017-11-111-5/+7
| | | | This should avoid any issues with command-line argument limits.
* Coalesce restorecon calls into one.Elliott Sales de Andrade2017-11-091-16/+12
| | | | Fixes #2596.
* Made man page gzip creation deterministic. Closes #2363.Jussi Pakkanen2017-09-231-1/+3
|
* install: Also ignore PermissionError for selinuxNirbheek Chauhan2017-09-041-1/+1
| | | | | | | When the user does not have permissions to run `selinuxenabled`, a PermissionError is raised instead of FileNotFoundError. Closes https://github.com/mesonbuild/meson/issues/2257
* Remove leftover debug print statement in meson_install.pyGabríel Arthúr Pétursson2017-08-201-1/+1
|
* Make all functionality invokable via the main Meson binary,Jussi Pakkanen2017-08-181-1/+4
| | | | which can be a Windows .exe file.
* Allow excluding files from `install_subdir`Elliott Sales de Andrade2017-08-061-5/+15
| | | | | | The install_subdir command now accepts a new `exclude` keyword argument that allows specified files to be excluded from the installed subdirectory.
* Remove directories created by ninja installPeter Hutterer2017-08-011-16/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a DirMaker class that disassembles the path up to '/' and stores all directories in a list. That list is in creation order and pre-existing directories are ignored, i.e. creating the two paths '/usr/share/foo/bar/baz' and '/usr/share/foo/bar/boo' is stored as [ '/usr/share/foo', '/usr/share/foo/bar', '/usr/share/foo/bar/baz', '/usr/share/foo/bar/boo' ] This is on the assumption that /usr/share already existed. After all files have been installed, the list of created directories is appended in reverse order to the install log. The uninstall script then triggers rmdir on all directories. If a custom install script drops files into the directories, removing those will fail. This matches the current expectation, see the existing warning "Remember that files created by custom scripts have not been removed." Unfortunately, this makes the behavior on uninstall inconsistent. Assuming a non-existing prefix, ninja install && ninja uninstall removes all traces of the install. However, ninja install && ninja install && ninja uninstall removes the files only, not the directories as they already existed. This could be fixed by just unconditionally removing any (emtpy) directories that we drop files into, at the risk of removing system directories if empty. For example, one could imagine /etc/foo.conf.d/ to be removed in that case if it is empty. https://github.com/mesonbuild/meson/issues/2032
* meson_install: rename 'data' to 'd' for consistencyPeter Hutterer2017-08-011-3/+3
| | | | All other functions call it 'd', let's do it here too
* install: restore the SELinux context on installPeter Hutterer2017-07-311-0/+24
| | | | | | | | | | Try to restore the context for SELinux. If we fail on running 'selinuxenabled', quietly ignore the error and continue. If we fail on the actual restorecon call, we print a message but disable SELinux - chances are high that if one restorecon fails, others will too and that's likely a system setup issue. Fixes #1967
* Remove unused variables.Elliott Sales de Andrade2017-05-171-1/+1
|
* Drop terminating fullstop from "Installing blah to blah" messagesPeter Hutterer2017-04-191-4/+4
| | | | | | | | Grammatically, this full stop isn't needed and with file names it has a potential to be confusing: Installing /foo/bar/filename.1 to /foo/bar/dirname. The full stop caused me to do a double-take more than once, so let's drop it.
* Merge pull request #1518 from centricular/mesonintrospect-evarJussi Pakkanen2017-04-081-1/+1
|\ | | | | Export MESONINTROSPECT to postconf/install/run_command scripts
| * Export MESONINTROSPECT to postconf/install/run_command scriptsNirbheek Chauhan2017-03-281-1/+1
| | | | | | | | | | | | | | | | | | Points to the `mesonintrospect.py` script corresponding to the currently-running version of Meson. Includes a test for all three methods of running scripts/commands. Closes https://github.com/mesonbuild/meson/issues/1385
* | Ignore install as non-existent user or groupJon Turney2017-04-061-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | 'test cases/common/12 data' and 'test cases/common/66 install subdir' both try to install something as 'root'. This user doesn't exist on Cygwin. Perhaps we should automatically convert this to some other user, but it's not clear which. For real projects, it's possibly better for the meson.build to explicitly handle this... 'test cases/common/12 data' also tries to install something with GID 0. There's no guarantee this group exists.
* | Use '.exe' extension for executables for CygwinJon Turney2017-04-061-1/+1
|/ | | | Use '.exe' extension for executables for Cygwin when building and installing
* Install PDB files. Closes #1442.Jussi Pakkanen2017-03-021-0/+5
|
* Use cross stripper when cross compiling and allow overriding native strip ↵Jussi Pakkanen2017-02-271-2/+2
| | | | executable. Closes #1414.
* Do not strip jar targets. Closes #1343.Jussi Pakkanen2017-02-061-0/+3
|
* Support file perms for install_data and install_subdirNirbheek Chauhan2017-01-241-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | With the 'install_mode' kwarg, you can now specify the file and directory permissions and the owner and the group to be used while installing. You can pass either: * A single string specifying just the permissions * A list of strings with: - The first argument a string of permissions - The second argument a string specifying the owner or an int specifying the uid - The third argument a string specifying the group or an int specifying the gid Specifying `false` as any of the arguments skips setting that one. The format of the permissions kwarg is the same as the symbolic notation used by ls -l with the first character that specifies 'd', '-', 'c', etc for the file type omitted since that is always obvious from the context. Includes unit tests for the same. Sadly these only run on Linux right now, but we want them to run on all platforms. We do set the mode in the integration tests for all platforms but we don't check if they were actually set correctly.
* style: fix E124 violationsIgor Gnatenko2017-01-011-1/+1
| | | | | | E124: closing bracket does not match visual indentation Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* style: fix E226 violationsIgor Gnatenko2017-01-011-2/+2
| | | | | | E226: missing whitespace around arithmetic operator Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Fix space before :.Jussi Pakkanen2016-12-311-4/+4
|
* Fix shared library symlink aliasing on installNirbheek Chauhan2016-12-221-2/+2
| | | | | | Set the rules for the symlinking on the target itself, and then reuse that information while generating aliases during the build, and then pass it to the install script too.
* tree-wide: remove unused importsIgor Gnatenko2016-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ./setup.py:17:1: F401 'os' imported but unused import os ^ ./setup.py:37:1: F401 'stat.ST_MODE' imported but unused from stat import ST_MODE ^ ./run_tests.py:17:1: F401 'os' imported but unused import subprocess, sys, os ^ ./run_tests.py:18:1: F401 'shutil' imported but unused import shutil ^ ./run_unittests.py:23:1: F401 'mesonbuild.dependencies.Qt5Dependency' imported but unused from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency ^ ./mesonbuild/build.py:15:1: F401 '.coredata' imported but unused from . import coredata ^ ./mesonbuild/interpreter.py:32:1: F401 'subprocess' imported but unused import os, sys, subprocess, shutil, uuid, re ^ ./mesonbuild/interpreter.py:32:1: F401 're' imported but unused import os, sys, subprocess, shutil, uuid, re ^ ./mesonbuild/dependencies.py:23:1: F401 'subprocess' imported but unused import os, stat, glob, subprocess, shutil ^ ./mesonbuild/mesonlib.py:17:1: F401 'sys' imported but unused import platform, subprocess, operator, os, shutil, re, sys ^ ./mesonbuild/modules/qt5.py:15:1: F401 'subprocess' imported but unused import os, subprocess ^ ./mesonbuild/modules/pkgconfig.py:15:1: F401 '..coredata' imported but unused from .. import coredata, build ^ ./mesonbuild/scripts/scanbuild.py:15:1: F401 'sys' imported but unused import sys, os ^ ./mesonbuild/scripts/meson_exe.py:20:1: F401 'subprocess' imported but unused import subprocess ^ ./mesonbuild/scripts/meson_exe.py:22:1: F401 '..mesonlib.MesonException' imported but unused from ..mesonlib import MesonException, Popen_safe ^ ./mesonbuild/scripts/symbolextractor.py:23:1: F401 'subprocess' imported but unused import os, sys, subprocess ^ ./mesonbuild/scripts/symbolextractor.py:25:1: F401 '..mesonlib.MesonException' imported but unused from ..mesonlib import MesonException, Popen_safe ^ ./mesonbuild/scripts/meson_install.py:19:1: F401 '..mesonlib.MesonException' imported but unused from ..mesonlib import MesonException, Popen_safe ^ ./mesonbuild/scripts/yelphelper.py:15:1: F401 'sys' imported but unused import sys, os ^ ./mesonbuild/scripts/yelphelper.py:20:1: F401 '..mesonlib.MesonException' imported but unused from ..mesonlib import MesonException ^ ./mesonbuild/backend/vs2010backend.py:17:1: F401 're' imported but unused import re ^ ./test cases/vala/8 generated sources/src/copy_file.py:3:1: F401 'os' imported but unused import os ^ ./test cases/common/107 postconf/postconf.py:3:1: F401 'sys' imported but unused import sys, os ^ ./test cases/common/129 object only target/obj_generator.py:5:1: F401 'shutil' imported but unused import sys, shutil, subprocess ^ ./test cases/common/57 custom target chain/usetarget/subcomp.py:3:1: F401 'os' imported but unused import sys, os ^ ./test cases/common/95 dep fallback/subprojects/boblib/genbob.py:3:1: F401 'os' imported but unused import os ^ ./test cases/common/98 gen extra/srcgen.py:4:1: F401 'os' imported but unused import os ^ ./test cases/common/113 generatorcustom/gen.py:3:1: F401 'os' imported but unused import sys, os ^ ./test cases/common/113 generatorcustom/catter.py:3:1: F401 'os' imported but unused import sys, os ^ ./test cases/common/59 object generator/obj_generator.py:5:1: F401 'shutil' imported but unused import sys, shutil, subprocess ^ Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Merge pull request #1216 from mesonbuild/ignatenko/shebangsJussi Pakkanen2016-12-181-2/+0
|\ | | | | Remove shebangs on files inside module
| * remove shebangs from scriptsIgor Gnatenko2016-12-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/regen_checker.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_test.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_benchmark.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_exe.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/symbolextractor.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/commandrunner.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/gtkdochelper.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_install.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/depfixer.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/dirchanger.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/delwithsuffix.py 644 /usr/bin/python3 meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/vcstagger.py 644 /usr/bin/python3 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* | custom_target: Make directory outputs installableNirbheek Chauhan2016-12-181-45/+68
| | | | | | | | | | | | | | | | | | | | | | This is useful in many cases where the list of files cannot be known in advance and is just dumped inside a directory. For example when generating documentation with doxygen and other tools that we don't have built-in support for. Includes a test for the same. Closes #893
* | Allow passing arguments to install scriptsNirbheek Chauhan2016-12-181-19/+8
|/ | | | Closes #1213
* Use universal_newlines=True for all Popen callsNirbheek Chauhan2016-12-111-4/+4
| | | | | | | | | | | Instead of adding it everywhere manually, create a wrapper called mesonlib.Popen_safe and use that everywhere that we call an executable and extract its output. This will also allow us to tweak it to do more/different things if needed for some locales and/or systems. Closes #1079
* misc: Use relative imports everywhereNirbheek Chauhan2016-12-071-2/+2
| | | | | | Using 'mesonbuild' as the module can cause it to use the system-installed module and can also break if we rename the directory, so avoid that by always using relative imports.