[OE-core] [PATCH v2] pulseaudio: add systemd to PACKAGECONFIG if enabled in DISTRO_FEATURES

Pau Espin Pedrol pespin.shar at gmail.com
Mon Jul 13 16:17:59 UTC 2015


2015-07-13 17:51 GMT+02:00 Christopher Larson <clarson at kergoth.com>:
>
> On Mon, Jul 13, 2015 at 3:23 AM, Pau Espin Pedrol <pespin.shar at gmail.com>
> wrote:
>>
>> I am not sure which is the behavior with those paths right now and how
>> it should be.
>>
>> I just checked this:
>>
>> http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Unit%20Load%20Path
>>
>> So, it seems according to documentation that system services should be
>> installed under /usr/lib/systemd/system, but currently they are
>> installed in /lib/systemd/system in my generated image. Is that a
>> expected behaviour? Shouldn't we try to follow documentation? I see
>> that sometimes /lib/systemd/system path is appended to the dirs in
>> systemdsystemunitpath, but it's not stated in the documentation,
>> that's a bit strange.
>
>
> Depends on the distro. Ubuntu, for example, uses /lib/systemd.
>
>>
>> For user services, /usr/lib/systemd/user is already being used as
>> stated in docs.
>>
>> Now, when multilib comes in, I get lost. If I understand correctly,
>> with multilib enabled we have too /lib64 and /usr/lib64. Are then
>> systemd service files suppoused to be installed in /usr/lib/systemd/
>> or in /usr/lib64/systemd/ ? If I undersood correctly your comment you
>> meant they should still be going into /usr/lib/systemd right?
>
>
> Yes, we don’t want arch-independent files going into arch-specific dirs.
>
>> Now, talking about bitbake.conf. I see there's already a line with the
>> following:
>> export systemd_unitdir = "/lib/systemd"
>>
>> So, apart from your nonarch issue, I think it would also be a good
>> idea to split systemd_unitdir into system and user, as done by
>> provided pc in systemd (src/core/systemd.pc.in):
>> 1- If still want system services to be in /lib and user services to be
>> in /usr/lib:
>> export nonarch_libdir = "${prefix}/lib"
>>
>> export systemd_system_unitdir = "${nonarch_base_libdir}/systemd/system"
>> export systemd_user_unitdir = "${nonarch_libdir}/systemd/user"
>> or
>> export systemd_system_unitdir = "${nonarch_base_libdir}/systemd"
>> export systemd_user_unitdir = "${nonarch_libdir}/systemd"
>>
>>
>> 2- If you want both in /usr/lib:
>> export nonarch_libdir = "${prefix}/lib"
>>
>> export systemd_system_unitdir = "${nonarch_libdir}/systemd/system"
>> export systemd_user_unitdir = "${nonarch_libdir}/systemd/user"
>> or
>> export systemd_system_unitdir = "${nonarch_libdir}/systemd"
>> export systemd_user_unitdir = "${nonarch_libdir}/systemd"
>
>
> I don’t really see why one would want some of their service files in one
> libdir and the rest in another. Is there a reason to not just obey
> systemd_unitdir in pulseaudio?

Because they are actually a different type of service files (system vs
user) and they are handled in a different way by systemd. For
instance, if you check the list of paths in which systemd looks for
services, you can see that for system services it actually checks
/lib/systemd/system, but it doesn't for user ones
(/usr/lib/systemd/user):


In systemd, src/shared/path-lookup.c:

                /* For the user units we include share/ in the search
                 * path in order to comply with the XDG basedir spec.
                 * For the system stuff we avoid such nonsense. OTOH
                 * we include /lib in the search path for the system
                 * stuff but avoid it for user stuff. */

                if (running_as == MANAGER_USER) {
                        if (personal)
                                unit_path = user_dirs(generator,
generator_early, generator_late);
                        else
                                unit_path = strv_new(
                                        /* If you modify this you also
want to modify
                                         * systemduserunitpath= in
systemd.pc.in, and
                                         * the arrays in user_dirs() above! */
                                        STRV_IFNOTNULL(generator_early),
                                        USER_CONFIG_UNIT_PATH,
                                        "/etc/systemd/user",
                                        "/run/systemd/user",
                                        STRV_IFNOTNULL(generator),
                                        "/usr/local/lib/systemd/user",
                                        "/usr/local/share/systemd/user",
                                        USER_DATA_UNIT_PATH,
                                        "/usr/lib/systemd/user",
                                        "/usr/share/systemd/user",
                                        STRV_IFNOTNULL(generator_late),
                                        NULL);
                } else
                        unit_path = strv_new(
                                /* If you modify this you also want to modify
                                 * systemdsystemunitpath= in systemd.pc.in! */
                                STRV_IFNOTNULL(generator_early),
                                SYSTEM_CONFIG_UNIT_PATH,
                                "/etc/systemd/system",
                                "/run/systemd/system",
                                STRV_IFNOTNULL(generator),
                                "/usr/local/lib/systemd/system",
                                SYSTEM_DATA_UNIT_PATH,
                                "/usr/lib/systemd/system",
#ifdef HAVE_SPLIT_USR
                                "/lib/systemd/system",
#endif
                                STRV_IFNOTNULL(generator_late),
                                NULL);

And also in systemd, src/core/systemd.pc.in:
systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemdsystemunitdir}:/usr/lib/systemd/system:/lib/systemd/system
systemduserunitpath=${systemduserconfdir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemduserunitdir}:/usr/lib/systemd/user:/usr/share/systemd/user


So, pulseaudio is intended to be used as a systemd user service, not
as a systemd system service, and that means it needs to end up in
/usr/lib/systemd/user and not in /lib/systemd/system/.

All these changes are part of my efforts to improve systemd user
service support in OE, which is kind of bad nowadays imho.

> --
> Christopher Larson
> clarson at kergoth dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Maintainer - Tslib
> Senior Software Engineer, Mentor Graphics



More information about the Openembedded-core mailing list