polkit-org / polkit

polkit (formerly PolicyKit) is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to speak to privileged processes.
Other
48 stars 27 forks source link

meson: decouple session tracking mechanism from unit and sysusers #417

Closed bluca closed 1 month ago

bluca commented 7 months ago

Session tracking build options are about whether logind or other APIs are used in the polkit code, at compilation and linking time.

units, sysusers and tmpfiles files have nothing to do with code changes or APIs, they simply install config files, that can just be ignored if they are not needed. Use pkg-config if available, but otherwise have a hard-coded fallback with the well-known defaults.

This also fixes another bug, 'systemdsystemunitdir' is specified as an option the systemd_dep variable is not defined, but the sysusers.d directory lookup uses it, causing a build failure:

dh_auto_configure -- \
    -Dexamples=false \
    -Dintrospection=true \
    -Dman=true \
    -Dsystemdsystemunitdir=/usr/lib/systemd/system \
    -Dtests=true \
    -Dgtk_doc=true -Dsession_tracking=libsystemd-login
    cd obj-x86_64-linux-gnu && DEB_PYTHON_INSTALL_LAYOUT=deb LC_ALL=C.UTF-8 meson setup .. --wrap-mode=nodownload --buildtype=plain --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=lib/x86_64-linux-gnu -Dpython.bytecompile=-1 -Dexamples=false -Dintrospection=true -Dman=true -Dsystemdsystemunitdir=/usr/lib/systemd/system -Dtests=true -Dgtk_doc=true -Dsession_tracking=libsystemd-login
The Meson build system
Version: 1.3.1
Source dir: /builds/bluca/polkit/debian/output/source_dir Build dir: /builds/bluca/polkit/debian/output/source_dir/obj-x86_64-linux-gnu Build type: native build
Project name: polkit
Project version: 124

<...>

Run-time dependency libsystemd found: YES 255
Checking for function "sd_uid_get_display" with dependency libsystemd: YES
Checking for function "sd_pidfd_get_session" with dependency libsystemd: YES
../meson.build:222:37: ERROR: Unknown variable "systemd_dep".

Follow-up for 24f1e0af3f7bd17e220cb96201f3c654e737ad34

fanyx commented 2 months ago

Please be aware that in the current state this commit is in you would be breaking https://github.com/polkit-org/polkit/commit/042897ed0efd5d622367c2ff4ac224d0b05cccee again.

jrybar-rh commented 1 month ago

I got a message that tools like tmpfiles.d and systemd-sysusers can also exist separately from systemd, hence it make sense (since we use those tools) to provide configuration files for them. IF they are not desired on a specific distro, a package maintainer for that distro can always exclude those files. Agreed?
Anyway, thanks, @bluca, for your time and your work!

bluca commented 1 month ago

I got a message that tools like tmpfiles.d and systemd-sysusers can also exist separately from systemd, hence it make sense (since we use those tools) to provide configuration files for them

Yes there are separate implementations in bash for both. Thanks.