Commit graph

1435 commits

Author SHA1 Message Date
George Kiagiadakis
daa4da5ffc tests: state: remove the "escaped" state file at the end of the test 2021-08-19 10:39:49 +03:00
George Kiagiadakis
07b4a13315 tests: use .local/state instead of .local/.state for the state dir 2021-08-19 10:39:14 +03:00
George Kiagiadakis
c3d48e57d4 systemd: remove AssertPathExists from the templated units
The config files can now be in multiple places, so there is no
good way to check if a file exists before starting wireplumber.
2021-08-19 10:33:55 +03:00
George Kiagiadakis
efc2039795 meson: install configuration in $prefix/share 2021-08-19 10:31:27 +03:00
George Kiagiadakis
3cd9384805 wp: make wp_get_xdg_state_dir() private
It's not used elsewhere, so there is no good reason yet to expose it.
Besides, I expect that GLib will likely add a method in the future
to return the XDG_STATE_HOME (which is relatively new in the xdg spec)
2021-08-19 10:06:37 +03:00
George Kiagiadakis
27ed36c2da wp: make the config file lookup methods more generic
* Make the flags public and give them nicer names
* Pass down the flags from the caller, so the caller can now explicitly
  ask for looking into specific directories
* Rename the methods
* Remove and inline the wp_get_xdg_config_dir() method, since it's only
  used internally
* Refactor the lookup dirs ordering to get both WIREPLUMBER_*_DIR env
  variables to replace all the other directories. Previously, we were looking
  for scripts in WIREPLUMBER_DATA_DIR, but we were also looking in /etc at
  the same time (with precedence, even), which could result in unexpected
  behaviour. Now, if a WIREPLUMBER environment variable is specified,
  we only look in there.
2021-08-19 10:06:37 +03:00
Arun Raghavan
129b44bb0c doc: Add WpImplModule docs for the C and Lua API 2021-08-18 16:04:39 +00:00
Arun Raghavan
ef29018c55 m-lua-scripting: Add WpImplModule bindings 2021-08-18 16:04:39 +00:00
Julian Bouzas
7abd3728e7 build: fix volatile compatible-pointer-types warnings
Happens when compiling with GCC 11
2021-08-18 09:17:05 -04:00
George Kiagiadakis
b9b722c125 properties: adjust documentation for the recent WpPropertiesItem changes 2021-08-11 20:25:16 +03:00
Arun Raghavan
032aa8edf2 wp: Add a WpImplModule for loading modules in WirePlumber context 2021-08-10 11:33:01 -04:00
Marvin Schmidt
da8fc024f5 build: Allow to specify which system lua to use
On Exherbo we allow to install different Lua ABIs in parallel and
users can choose per-package which Lua ABI to use, e.g.

  media/wireplumber LUA_ABIS: -* 5.3

However, wireplumber's build system doesn't provide a way of explicitly
requesting a specific version, which makes the build non-deterministic,
since you get a different result if you install today with Lua 5.3
installed and reinstall tomorrow after installing Lua 5.4.

To fix this, I introduced a `system-lua-version` option that allows to
specify an explicit Lua version to check for and build against:

> $ meson .. -Dsystem-lua=true -Dsystem-lua-version=5.4
> The Meson build system
> Version: 0.58.0
> Source dir: /mnt/development/scm/freedesktop/wireplumber
> Build dir: /mnt/development/scm/freedesktop/wireplumber/build/reconfigure
> Build type: native build
> Project name: wireplumber
> Project version: 0.4.1
> [...]
> Run-time dependency lua-5.4 found: YES 5.4.3
> [...]
> Build targets in project: 56
>
> wireplumber 0.4.1
>
>     Lua version                    : 5.4.3 (system)
>     systemd conf data              : YES

If the specified version isn't found, the build will fail loudly:

> $ meson .. -Dsystem-lua=true -Dsystem-lua-version=5.5
> [...]
> Found CMake: /usr/host/bin/cmake (3.20.5)
> Run-time dependency lua-5.5 found: NO (tried pkgconfig and cmake)
> Run-time dependency lua5.5 found: NO (tried pkgconfig and cmake)
>
> ../meson.build:50:6: ERROR: Problem encountered: Specified Lua version "5.5" not found
2021-08-10 11:55:19 +03:00
Julian Bouzas
8c9da58d76 src: scripts: add alsa-mini.lua monitor 2021-08-10 11:50:51 +03:00
Julian Bouzas
9b8a876662 m-lua-scripting: add GLib access Lua API 2021-08-10 11:50:51 +03:00
Julian Bouzas
907a67fcb1 modules: add new API module to monitor files 2021-08-10 11:50:51 +03:00
jakobrs
92d99f4a75 dump_table: Sort keys before printing 2021-08-10 07:50:01 +00:00
jakobrs
86bfdbea13 Fix not-equals verb having the wrong number of arguments in Lua API 2021-08-08 20:45:56 +02:00
George Kiagiadakis
9ebea2976d wp: refactor and rename wp_iter_conf_files() to use WpIterator
This also corrects the logic of loading config files in m-lua-scripting.
Previously, if an error occured within the iteration function,
the error was not properly propagated to the caller because -EINVAL
was being added to nfiles instead of checked.
2021-07-20 14:42:42 +03:00
George Kiagiadakis
edd8ea7297 wp: polish documentation and add annotations for the config-related functions 2021-07-20 14:42:42 +03:00
George Kiagiadakis
3ff53f19e4 lib: s/G_GNUC_DEPRECATED/G_DEPRECATED/
This one is more portable
2021-07-20 14:42:42 +03:00
George Kiagiadakis
0830362807 lib: explicitly ignore the return value of g_strlcpy() to silence coverity 2021-07-20 14:42:42 +03:00
Julian Bouzas
8b95b4ae23 tests: skip test if specific spa lib is not installed
Avoids tests failing if pipewire was built without the spa lib
2021-07-19 09:40:19 -04:00
Julian Bouzas
eb8f9a1a83 tests: common: add API to check if spa lib is installed
Allows to skip tests if specific spa lib is not installed
2021-07-16 11:49:35 -04:00
Peter Hutterer
ece8f7a78d lib: deprecate the functions to fetch the config directory
Both have been replaced by functions that directly find configuration files
in a hierarchy of paths.
2021-07-15 15:17:01 +00:00
Peter Hutterer
d38c3fb4cc lib: add functions to search in configuration/data directories
The previous approach to loading config files was to ask WP for the
directory and then search those for the config files. This patch changes the
approach - a caller now asks WP to search for a specific config file or
iterate over a config file directory.

This allows us to implement a directory lookup order, i.e.
"wireplumber.conf" may be in XDG_CONFIG_DIR, /etc/,
/usr/share and the first one found is used.

For configuration directories, the new method iterates over all matching
entries (files + directories) and invokes a callback for each entry.

This enables distributions to ship default files in /usr/share/wireplumber
but have admins and users override them on a local basis. For lua scripts in
particular, overriding a distribution-provided file with an empty file
effectively disables it, adding a file adds it in the right sort order.
2021-07-15 15:17:01 +00:00
Peter Hutterer
153e84c8b8 lib: always return the full path from wp_get_config/data_dir
Remove the need for the caller to check if the returned path is absolute or
relative.
2021-07-15 15:17:01 +00:00
Peter Hutterer
2e88a115d1 lib: add a function to return the XDG_CONFIG_DIR 2021-07-15 15:17:01 +00:00
Peter Hutterer
6c3a8d2f83 main: assemble the full config file name and pass that to pipewire
Previously we had the config file split in pipewire-fashion: CONFIG_NAME for
the filename and CONFIG_PREFIX for the (absolute) config directory the file
resides in. Since we always resolved CONFIG_PREFIX to be an absolute path we
might as well just pass the fully resolved config file to pipewire instead.

This will eventually allow us to have multiple lookup directories.
2021-07-15 15:17:01 +00:00
Peter Hutterer
2461654017 doc: fix documentation for passing a config file
WIREPLUMBER_CONFIG_FILE support was replaced with the --config-file option
in 1d0ecc3d88
2021-07-15 15:17:01 +00:00
Peter Hutterer
1132b37f0b modules: fix g_file_test for regular files
From the g_file_test documentation:
"For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return TRUE if
the file exists; the check whether it's a directory doesn't matter since the
existence test is TRUE. With the current set of available tests, there's no
point passing in more than one test at a time."
2021-07-15 15:17:01 +00:00
Julian Bouzas
2792cecbcf properties: use a boxed WpPropertiesItem type when iterating
Needed for JavaScript bindings
2021-07-15 08:55:00 -04:00
Niklāvs Koļesņikovs
cb41ecc6c6 meson.build: adds summary() about Lua implementation used 2021-07-14 14:27:04 +00:00
Peter Hutterer
be1a077eaf state: store our WpState files in $XDG_STATE_HOME/wireplumber 2021-07-14 14:44:11 +10:00
Peter Hutterer
ab62af1748 lib: add a function to get the xdg state dir
Added recently to the XDG spec, XDG_STATE_HOME ($HOME/.local/state/) is for
files that are neither configuration/data files nor runtime/cache files.
2021-07-14 13:18:49 +10:00
Peter Hutterer
fd37c0cd2e meson.build: let meson handle the prefix + bindir concatination
For bindir, libdir and datadir, meson enforces that either
- the value is an absolute path that is a subdir of $prefix
- the value is a relative path that is then made a subdir of $prefix

Example meson error message:
ERROR: The value of the 'bindir' option is '/usr/foobar' which must be a subdir of the prefix '/usr/local'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.

And meson handles absolute paths for those directories correctly (ignoring
$prefix), so we don't need to manually compose those.

Only exception is sysconfdir which may be outside the prefix but there too
meson handles an absolute path correctly.
2021-07-06 09:40:39 +10:00
Niklāvs Koļesņikovs
d8365fe33e
meson: adds summary() to auto features 2021-07-05 12:30:49 +03:00
George Kiagiadakis
6ef84a1309 docs: document the lua ObjectManager / Interest / Constraint APIs 2021-07-02 20:24:25 +03:00
George Kiagiadakis
ec397aaaca lua: add not-equals to the possible constraint verbs 2021-07-02 20:24:25 +03:00
Julian Bouzas
0c51cf9a7b session-item: fix reference leak when getting properties 2021-07-02 11:59:42 -04:00
George Kiagiadakis
6e6852b391 tests: create wpipc tests sockets also in /tmp with a random name
See #39, #16
2021-07-02 16:34:31 +03:00
George Kiagiadakis
655898e61f tests: run with PIPEWIRE_RUNTIME_DIR=/tmp
... and hope for the best, because sockets apparently can't
have more than 108 characters in their path

See #39, #16
2021-07-02 16:34:28 +03:00
Julian Bouzas
2900dc1c23 object-manager: remove old global when exposing new global with same id
Sometimes, especially when running the wireplumber daemon with valgrind, a new
global with the same Id as another old global owned by a proxy wants to be
exposed before the old proxy is destroyed. If this happens, instead of returning
with an assertion error, we remove the old global and we export the new one.
2021-07-01 14:49:28 -04:00
Julian Bouzas
4275d91675 global-proxy: add extra checks to make sure binding is successful
Globals can be removed by the object manager when their associated proxy is
currently being bound. Adding extra checks in wp_global_proxy_bin() to return
a transition error avoids binding the proxy when that happens.
2021-07-01 14:37:42 -04:00
Julian Bouzas
dc6fa6cbfe m-lua-scripting: unref value pod after adding it to control 2021-06-30 14:06:48 -04:00
George Kiagiadakis
888d6e5033 lua: add Port.get_direction() + documentation for it 2021-06-30 19:51:21 +03:00
George Kiagiadakis
532340cc8f docs: mention the new matrix room in the community resources 2021-06-30 19:51:21 +03:00
George Kiagiadakis
068f7f3000 docs: complete lua Node api docs and fix some ref links 2021-06-30 19:51:21 +03:00
George Kiagiadakis
18fe17fa01 lua: fail if an optional Interest is not none, nil, Interest or table 2021-06-30 19:51:21 +03:00
George Kiagiadakis
795a37d029 lua: complete the WpNode bindings 2021-06-30 19:51:21 +03:00
George Kiagiadakis
7fedb5e9e1 wplua: expose functions to convert enums to strings for lua and vice versa 2021-06-30 19:51:21 +03:00