Skip to contentSkip to conversation

mctp: split mctp tools and mctpd into separate recipes

PATCH Superseded James Lee 2 participants 10 messages Aug 11 – Aug 14

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

James Lee

author
#0 lore raw

PATCH v2 1/2 mctp: split mctp tools and mctpd into separate recipes

The current mctp recipe relies on the upstream's conditional build and install of the mctpd binary if systemd is present, only building the mctp utility otherwise. Future upstream changes allowing running as non-root require more control over the build process. We will need to add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least one user will be created, failing the recipe otherwise. Building without mctpd would then cause the recipe to fail as conditionally inheriting useradd seems infeasible.

To make useradd available for the new upstream release, split the recipe into "mctp" for the utilities and "mctpd" for the daemon, isolating the systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from user choice, rather than auto-detecting based on the presence of systemd. It will also let us express the useradd rules only when they're needed for the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++
 .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-----------------
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++
 3 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 meta-networking/recipes-support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-support/mctp/mctpd_2.5.bb
meta-networking/recipes-support/mctp/mctp.inc new file +11 -0
new file mode 100644
index 0000000000..98225cffea
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"
+
+SRC_URI = "git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v${PV}"
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +3 -43

48 lines not on this page · raw message

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +28 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP) control protocol daemon"
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(), which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
Signature · 1 line
2.47.3
author
#1 lore raw

PATCH v2 2/2 mctp: upgrade 2.5 -> 2.6

Bumped mctp and mctp-daemon version to 2.6, and added the new system user to own mctpd's service.

---
 meta-networking/recipes-support/mctp/mctp.inc                | 2 +-
 .../recipes-support/mctp/{mctp_2.5.bb => mctp_2.6.bb}        | 0
 .../recipes-support/mctp/{mctpd_2.5.bb => mctpd_2.6.bb}      | 5 ++++-
 3 files changed, 5 insertions(+), 2 deletions(-)
 rename meta-networking/recipes-support/mctp/{mctp_2.5.bb => mctp_2.6.bb} (100%)
 rename meta-networking/recipes-support/mctp/{mctpd_2.5.bb => mctpd_2.6.bb} (89%)
meta-networking/recipes-support/mctp/mctp.inc +1 -1
index 98225cffea..c8fc98f63a 100644
@@ -4,7 +4,7 @@ LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"
 
 SRC_URI = "git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v${PV}"
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+SRCREV = "31ac0e86b0e23d32abf34d191653a87a47f3c9a7"
 
 inherit meson pkgconfig
 
meta-networking/recipes-support/mctp/mctp_2.6.bb renamed from meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -0
similarity index 100%
rename from meta-networking/recipes-support/mctp/mctp_2.5.bb
rename to meta-networking/recipes-support/mctp/mctp_2.6.bb
meta-networking/recipes-support/mctp/mctpd_2.6.bb renamed from meta-networking/recipes-support/mctp/mctpd_2.5.bb +4 -1
similarity index 89%
rename from meta-networking/recipes-support/mctp/mctpd_2.5.bb
rename to meta-networking/recipes-support/mctp/mctpd_2.6.bb
index f049be646b..f4c5bb976c 100644
@@ -2,7 +2,7 @@ require mctp.inc
 
 SUMMARY = "Management Component Transport Protocol (MCTP) control protocol daemon"
 
-inherit systemd
+inherit systemd useradd
 
 do_install:append () {
     install -d ${D}${systemd_system_unitdir}
@@ -17,6 +17,9 @@ do_install:append () {
 
 SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
 
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "-r -U -s /bin/false mctpd"
+
 DEPENDS += "systemd"
 
 # Meson adds mctp utility binaries to FILES and do_install(), which cannot be
Signature · 1 line
2.47.3
#2 lore raw

Re: [oe] [meta-networking] [PATCH v2 2/2] mctp: upgrade 2.5 -> 2.6

this has to be made specific to systemd distros alone otherwise we endup with

Consider defining a PREFERRED_PROVIDER entry to match virtual/freeglut
ERROR: Nothing PROVIDES 'systemd' (but /srv/pokybuild/yocto-worker/meta-oe/build/meta-openembedded/meta-networking/recipes-support/mctp/mctpd_2.6.bb DEPENDS on or otherwise requires it)
systemd was skipped: using DISTRO 'poky', which is missing required
DISTRO_FEATURES: 'usrmerge systemd'
NOTE: Multiple providers are available for runtime libnss-mdns
(avahi-libnss-mdns, mdns)
Consider defining a PREFERRED_RPROVIDER entry to match libnss-mdns
ERROR: Nothing RPROVIDES 'mctpd' (but /srv/pokybuild/yocto-worker/meta-oe/build/meta-openembedded/meta-networking/recipes-support/mctp/mctpd_2.6.bb RDEPENDS on or otherwise requires it)
No eligible RPROVIDERs exist for 'mctpd'
NOTE: Runtime target 'mctpd' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['mctpd']
ERROR: Nothing RPROVIDES 'mctpd-dev' (but /srv/pokybuild/yocto-worker/meta-oe/build/meta-openembedded/meta-networking/recipes-support/mctp/mctpd_2.6.bb RDEPENDS on or otherwise requires it)
No eligible RPROVIDERs exist for 'mctpd-dev'

Quoted 80 lines · James Lee via lists.openembedded.org

Bumped mctp and mctp-daemon version to 2.6, and added the new system user to own mctpd's service.

---
 meta-networking/recipes-support/mctp/mctp.inc                | 2 +-
 .../recipes-support/mctp/{mctp_2.5.bb => mctp_2.6.bb}        | 0
 .../recipes-support/mctp/{mctpd_2.5.bb => mctpd_2.6.bb}      | 5 ++++-
 3 files changed, 5 insertions(+), 2 deletions(-)
 rename meta-networking/recipes-support/mctp/{mctp_2.5.bb => mctp_2.6.bb}
(100%)
 rename meta-networking/recipes-support/mctp/{mctpd_2.5.bb => mctpd_2.6.bb}

(89%)

meta-networking/recipes-support/mctp/mctp.inc +0 -0
index 98225cffea..c8fc98f63a 100644
@@ -4,7 +4,7 @@ LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"
 
 SRC_URI = "git://
 github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v${PV}

<http://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v$%7BPV%7D>
"

meta-networking/recipes-support/mctp/mctp.inc +1 -1
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+SRCREV = "31ac0e86b0e23d32abf34d191653a87a47f3c9a7"
 
 inherit meson pkgconfig
meta-networking/recipes-support/mctp/mctp_2.6.bb renamed from meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -0
similarity index 100%
rename from meta-networking/recipes-support/mctp/mctp_2.5.bb
rename to meta-networking/recipes-support/mctp/mctp_2.6.bb
meta-networking/recipes-support/mctp/mctpd_2.6.bb renamed from meta-networking/recipes-support/mctp/mctpd_2.5.bb +0 -0
similarity index 89%
rename from meta-networking/recipes-support/mctp/mctpd_2.5.bb
rename to meta-networking/recipes-support/mctp/mctpd_2.6.bb
index f049be646b..f4c5bb976c 100644
@@ -2,7 +2,7 @@ require mctp.inc
 
 SUMMARY = "Management Component Transport Protocol (MCTP) control

protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.6.bb renamed from meta-networking/recipes-support/mctp/mctpd_2.5.bb +4 -1
-inherit systemd
+inherit systemd useradd
 
 do_install:append () {
     install -d ${D}${systemd_system_unitdir}
@@ -17,6 +17,9 @@ do_install:append () {
 
 SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
 
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "-r -U -s /bin/false mctpd"
+
 DEPENDS += "systemd"
 
 # Meson adds mctp utility binaries to FILES and do_install(), which

cannot be
--
2.47.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#128923):
https://lists.openembedded.org/g/openembedded-devel/message/128923
Mute This Topic: https://lists.openembedded.org/mt/120698533/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to James Lee

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}

Quoted 161 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional build and install of the mctpd binary if systemd is present, only building the mctp utility otherwise. Future upstream changes allowing running as non-root require more control over the build process. We will need to add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least one user will be created, failing the recipe otherwise. Building without mctpd would then cause the recipe to fail as conditionally inheriting useradd seems infeasible.

To make useradd available for the new upstream release, split the recipe into "mctp" for the utilities and "mctpd" for the daemon, isolating the systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from user choice, rather than auto-detecting based on the presence of systemd. It will also let us express the useradd rules only when they're needed for the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++
 .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-----------------
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++
 3 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 meta-networking/recipes-support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-support/mctp/mctpd_2.5.bb
meta-networking/recipes-support/mctp/mctp.inc new file +6 -0
new file mode 100644
index 0000000000..98225cffea
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"
+
+SRC_URI = "git://

github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v${PV}
<http://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v$%7BPV%7D>
"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +2 -8
index a8787d3f2b..5811495c66 100644
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol utilities"
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM = "file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"
+SUMMARY = "Management Component Transport Protocol (MCTP) utilities"
 
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI = "git://
 github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v${PV}

<http://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag=v$%7BPV%7D>
"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -20
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects libsystemd; in which case
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false',

d)}; then

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -15
-        install -d ${D}${systemd_system_unitdir}
-        install -m 0644 ${S}/conf/mctpd.service \
-                ${D}${systemd_system_unitdir}/mctpd.service
-        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d
-        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf
-    fi
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '', d)} \
-"
+MESON_TARGET = "mctp mctp-client"
meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP) control

protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +19 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(), which

cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to correct.

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +5 -1
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
--

2.47.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#128922):
https://lists.openembedded.org/g/openembedded-devel/message/128922
Mute This Topic: https://lists.openembedded.org/mt/120698532/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#4 lore raw

I believe that would work, but think it's important to have a clear split at this point.

The mctp utilities and mctpd daemon have different use-cases and dependencies, and do not depend on each other. The split allows users to install the mctp utilities on systemd distros without automatically adding the daemon. It also makes it clear that the mctp package does not depend on systemd or useradd.

Quoted 170 lines · Khem Raj

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}

Quoted 164 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional build and
install of the mctpd binary if systemd is present, only building the
mctp utility otherwise. Future upstream changes allowing running as non-root require more control over the build process. We will need to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least one
user will be created, failing the recipe otherwise. Building without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split the recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're needed for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++ .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-------------
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++

 3 files changed, 42 insertions(+), 43 deletions(-)

 create mode 100644 meta-networking/recipes-support/mctp/mctp.inc create mode 100644 meta-networking/recipes- support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag =v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -5
index a8787d3f2b..5811495c66 100644
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol utilities"
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag =v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects libsystemd; in

which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true',

'false', d)}; then
-        install -d ${D}${systemd_system_unitdir} -        install -m 0644 ${S}/conf/mctpd.service \
-                ${D}${systemd_system_unitdir}/mctpd.service -        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d -        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf -    fi

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -6
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '', d)} \
-"
+MESON_TARGET = "mctp mctp-client"
meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP) control

protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(),

which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
#5 lore raw
Quoted 9 lines · James Lee

I believe that would work, but think it's important to have a clear split at this point.

The mctp utilities and mctpd daemon have different use-cases and dependencies, and do not depend on each other. The split allows users to install the mctp utilities on systemd distros without automatically adding the daemon. It also makes it clear that the mctp package does not depend on systemd or useradd.

The output can be packaged to be more granular such that daemon goes into package of its own, would that work ?

Quoted 173 lines · Khem Raj
Quoted 170 lines

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}

Quoted 164 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional build and
install of the mctpd binary if systemd is present, only building the
mctp utility otherwise. Future upstream changes allowing running as non-root require more control over the build process. We will need to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least one
user will be created, failing the recipe otherwise. Building without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split the recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're needed for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++
 .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-------------
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++
 3 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 meta-networking/recipes-support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-

support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag =v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -5
index a8787d3f2b..5811495c66 100644
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol utilities"
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https;tag =v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects libsystemd; in

which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true',

'false', d)}; then

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -15
-        install -d ${D}${systemd_system_unitdir}
-        install -m 0644 ${S}/conf/mctpd.service \
-                ${D}${systemd_system_unitdir}/mctpd.service
-        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d
-        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf
-    fi
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '', d)} \
-"
+MESON_TARGET = "mctp mctp-client"
meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP) control

protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(),

which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
author
#6 lore raw
Quoted 18 lines · Khem Raj
Quoted 12 lines · James Lee

I believe that would work, but think it's important to have a clear split at this point.

The mctp utilities and mctpd daemon have different use-cases and dependencies, and do not depend on each other. The split allows users
to install the mctp utilities on systemd distros without automatically
adding the daemon. It also makes it clear that the mctp package does
not depend on systemd or useradd.

Quoted 4 lines

The output can be packaged to be more granular such that daemon goes into
package of its own, would that work ?

I believe that would break the inherit_defer approach?

Quoted 191 lines
Quoted 191 lines · Khem Raj
Quoted 189 lines

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}

Quoted 182 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional build
and
install of the mctpd binary if systemd is present, only building
the
mctp utility otherwise. Future upstream changes allowing running as
non-root require more control over the build process. We will need
to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least
one
user will be created, failing the recipe otherwise. Building without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split the
recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating
the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from
user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're needed
for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++ .../recipes-support/mctp/mctp_2.5.bb          | 46 ++---------
----
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++

 3 files changed, 42 insertions(+), 43 deletions(-)

 create mode 100644 meta-networking/recipes-
support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-
support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https ;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -5
index a8787d3f2b..5811495c66 100644
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol utilities"
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https ;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects libsystemd;

in
which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd',

'true',
'false', d)}; then
-        install -d ${D}${systemd_system_unitdir} -        install -m 0644 ${S}/conf/mctpd.service \
-                ${D}${systemd_system_unitdir}/mctpd.service -        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d -        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf -    fi

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -6
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '', d)} \
-"
+MESON_TARGET = "mctp mctp-client"
meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP)

control
protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(),

which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to
correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
#7 lore raw
Quoted 19 lines · James Lee
Quoted 18 lines · Khem Raj
Quoted 12 lines · James Lee

I believe that would work, but think it's important to have a clear split at this point.

The mctp utilities and mctpd daemon have different use-cases and dependencies, and do not depend on each other. The split allows users
to install the mctp utilities on systemd distros without automatically
adding the daemon. It also makes it clear that the mctp package does
not depend on systemd or useradd.

Quoted 7 lines
Quoted 4 lines

The output can be packaged to be more granular such that daemon goes into
package of its own, would that work ?

I believe that would break the inherit_defer approach?

Cant be sure. Looking forward to you experiment with it :)

Quoted 193 lines
Quoted 192 lines
Quoted 192 lines · Khem Raj
Quoted 189 lines

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}

Quoted 182 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional build
and
install of the mctpd binary if systemd is present, only building
the
mctp utility otherwise. Future upstream changes allowing running as
non-root require more control over the build process. We will need
to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least
one
user will be created, failing the recipe otherwise. Building without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split the
recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating
the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable from
user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're needed
for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++
 .../recipes-support/mctp/mctp_2.5.bb          | 46 ++---------
----
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28 +++++++++++
 3 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 meta-networking/recipes-
support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-

support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https ;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -5
index a8787d3f2b..5811495c66 100644
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol utilities"
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=https ;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects libsystemd;

in
which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd',

'true',
'false', d)}; then

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -15
-        install -d ${D}${systemd_system_unitdir}
-        install -m 0644 ${S}/conf/mctpd.service \
-                ${D}${systemd_system_unitdir}/mctpd.service
-        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d
-        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf
-    fi
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '', d)} \
-"
+MESON_TARGET = "mctp mctp-client"
meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
new file mode 100644
index 0000000000..f049be646b
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP)

control
protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and do_install(),

which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to
correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
author
#8 lore raw
Quoted 31 lines · Khem Raj
Quoted 27 lines · James Lee
Quoted 25 lines · Khem Raj
Quoted 4 lines · James Lee

I believe that would work, but think it's important to have a clear
split at this point.

Quoted 10 lines

The mctp utilities and mctpd daemon have different use-cases and
dependencies, and do not depend on each other. The split allows users
to install the mctp utilities on systemd distros without automatically
adding the daemon. It also makes it clear that the mctp package does
not depend on systemd or useradd.

The output can be packaged to be more granular such that daemon goes
into
package of its own, would that work ?

Quoted 6 lines
Quoted 2 lines

I believe that would break the inherit_defer approach?

Cant be sure. Looking forward to you experiment with it :)

To be clear, I have experimented with this approach and didn't find a way to detect which packages are being installed with the library functions. Splitting into two recipes was the fallback option.

If you know of any way it could be done, the help would be appreciated.

Quoted 210 lines
Quoted 210 lines
Quoted 210 lines
Quoted 210 lines · Khem Raj
Quoted 207 lines

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
'useradd', '', d)}

Quoted 199 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional
build
and
install of the mctpd binary if systemd is present, only building
the
mctp utility otherwise. Future upstream changes allowing running as
non-root require more control over the build process. We will
need
to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least
one
user will be created, failing the recipe otherwise. Building
without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split
the
recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating
the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable
from
user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're
needed
for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++ .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-----
----
----
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28
+++++++++++

 3 files changed, 42 insertions(+), 43 deletions(-)

 create mode 100644 meta-networking/recipes-
support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-
support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=h ttps
;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
(quoted diff) +0 -0

support/mctp/mctp_2.5.bb b/meta-networking/recipes-support/mctp/mctp_2.5.bb index a8787d3f2b..5811495c66 100644

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -1
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol

utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -4
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=h ttps
;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects

libsystemd;
in
which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd',

'true',
'false', d)}; then
-        install -d ${D}${systemd_system_unitdir} -        install -m 0644 ${S}/conf/mctpd.service \
-
${D}${systemd_system_unitdir}/mctpd.service
-        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d -        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf -    fi

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -5
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '',

d)} \
-"

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -0
+MESON_TARGET = "mctp mctp-client"
(quoted diff) +0 -0

support/mctp/mctpd_2.5.bb b/meta-networking/recipes-support/mctp/mctpd_2.5.bb new file mode 100644
index 0000000000..f049be646b

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP)

control
protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and

do_install(),
which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to
correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}
#9 lore raw
Quoted 36 lines · James Lee
Quoted 35 lines · Khem Raj
Quoted 29 lines · James Lee
Quoted 20 lines · Khem Raj
Quoted 4 lines · James Lee

I believe that would work, but think it's important to have a clear
split at this point.

Quoted 10 lines

The mctp utilities and mctpd daemon have different use-cases and
dependencies, and do not depend on each other. The split allows users
to install the mctp utilities on systemd distros without automatically
adding the daemon. It also makes it clear that the mctp package does
not depend on systemd or useradd.

Quoted 5 lines

The output can be packaged to be more granular such that daemon goes
into
package of its own, would that work ?

I believe that would break the inherit_defer approach?

Quoted 9 lines
Quoted 2 lines

Cant be sure. Looking forward to you experiment with it :)

To be clear, I have experimented with this approach and didn't find a way to detect which packages are being installed with the library functions. Splitting into two recipes was the fallback option.

If you know of any way it could be done, the help would be appreciated.

OK, then fix the build issues found with distro without systemd eg. poky

Quoted 212 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines · Khem Raj
Quoted 207 lines

Can we do something like
inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
'useradd', '', d)}

Quoted 199 lines · James Lee via lists.openembedded.org

The current mctp recipe relies on the upstream's conditional
build
and
install of the mctpd binary if systemd is present, only building
the
mctp utility otherwise. Future upstream changes allowing running as
non-root require more control over the build process. We will
need
to
add a new system user when mctpd is built.

Adding a user requires inheriting useradd, which assumes at least
one
user will be created, failing the recipe otherwise. Building
without
mctpd would then cause the recipe to fail as conditionally inheriting
useradd seems infeasible.

To make useradd available for the new upstream release, split
the
recipe
into "mctp" for the utilities and "mctpd" for the daemon, isolating
the
systemd dependency to "mctpd".

This makes the two parts of the source explicitly selectable
from
user
choice, rather than auto-detecting based on the presence of systemd. It
will also let us express the useradd rules only when they're
needed
for
the mctpd installation in the upcoming version bump.

---
 meta-networking/recipes-support/mctp/mctp.inc | 11 +++++
 .../recipes-support/mctp/mctp_2.5.bb          | 46 ++-----
----
----
----
 .../recipes-support/mctp/mctpd_2.5.bb         | 28
+++++++++++
 3 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 meta-networking/recipes-
support/mctp/mctp.inc
 create mode 100644 meta-networking/recipes-

support/mctp/mctpd_2.5.bb

meta- renamed from meta-networking/recipes-support/mctp/mctp.inc +0 -0

networking/recipes-support/mctp/mctp.inc
new file mode 100644
index 0000000000..98225cffea

meta-networking/recipes-support/mctp/mctp.inc new file +4 -0
@@ -0,0 +1,11 @@
+HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21"

meta-networking/recipes-support/mctp/mctp.inc new file +2 -0
+
+SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=h ttps
;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp.inc new file +5 -0
+SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
+
+inherit meson pkgconfig
+
+EXTRA_OEMESON = "-Dtests=false"
(quoted diff) +0 -0

support/mctp/mctp_2.5.bb b/meta-networking/recipes-support/mctp/mctp_2.5.bb index a8787d3f2b..5811495c66 100644

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -1
@@ -1,45 +1,5 @@
-SUMMARY = "Management Component Control Protocol

utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -4
-HOMEPAGE = "http://www.github.com/CodeConstruct/mctp"
-SECTION = "net"
-LICENSE = "GPL-2.0-only"
+require mctp.inc
 
-LIC_FILES_CHKSUM =

"file://LICENSE;md5=4cc91856b08b094b4f406a29dc61db21" +SUMMARY = "Management Component Transport Protocol (MCTP) utilities"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-SRCREV = "07c7a5d526f686da89bc9ae9cad917e46652b272"
-
-SRC_URI =

"git://github.com/CodeConstruct/mctp;branch=main;protocol=h ttps
;tag
=v${PV}"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -13
-
-
-inherit meson pkgconfig systemd
-
-EXTRA_OEMESON = " \
-    -Dtests=false \
-"
-
-PACKAGECONFIG ??= " \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-"
-
-# mctpd will only be built if pkg-config detects

libsystemd;
in
which case

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-# we'll want to declare the dep and install the service.
-PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -4
-SYSTEMD_AUTO_ENABLE:${PN} = "enable"
-
-do_install:append () {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd',

'true',
'false', d)}; then

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -3
-        install -d ${D}${systemd_system_unitdir}
-        install -m 0644 ${S}/conf/mctpd.service \
-

${D}${systemd_system_unitdir}/mctpd.service

meta-networking/recipes-support/mctp/mctp_2.5.bb +0 -11
-        install -m 0644 ${S}/conf/*.target \
-                ${D}${systemd_system_unitdir}/
-        install -d ${D}${datadir}/dbus-1/system.d
-        install -m 0644 ${S}/conf/mctpd-dbus.conf \
-                ${D}${datadir}/dbus-1/system.d/mctpd.conf
-    fi
-}
-
-FILES:${PN} += " \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', \
-            '${datadir}/dbus-1/system.d/mctpd.conf', '',

d)} \
-"

meta-networking/recipes-support/mctp/mctp_2.5.bb +1 -0
+MESON_TARGET = "mctp mctp-client"
(quoted diff) +0 -0

support/mctp/mctpd_2.5.bb b/meta-networking/recipes-support/mctp/mctpd_2.5.bb new file mode 100644
index 0000000000..f049be646b

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +3 -0
@@ -0,0 +1,28 @@
+require mctp.inc
+
+SUMMARY = "Management Component Transport Protocol (MCTP)

control
protocol daemon"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +15 -0
+
+inherit systemd
+
+do_install:append () {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/conf/mctpd.service \
+            ${D}${systemd_system_unitdir}/mctpd.service
+    install -m 0644 ${S}/conf/*.target \
+            ${D}${systemd_system_unitdir}/
+    install -d ${D}${datadir}/dbus-1/system.d
+    install -m 0644 ${S}/conf/mctpd-dbus.conf \
+            ${D}${datadir}/dbus-1/system.d/mctpd.conf
+}
+
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-

local.target"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+DEPENDS += "systemd"
+
+# Meson adds mctp utility binaries to FILES and

do_install(),
which cannot be
+# overriden by MESON_TARGET. Override FILES and remove binaries to
correct.
+FILES:${PN} = "${datadir}/dbus-1/system.d/mctpd.conf ${sbindir}/mctpd"

meta-networking/recipes-support/mctp/mctpd_2.5.bb new file +4 -0
+
+do_install:append () {
+    rm -r ${D}${bindir}
+}