Skip to contentSkip to conversation

systemd: added python-systemd package generation.

PATCH In review Yevhen Kyriukha 2 participants 3 messages Jul 4, 2013 – Jul 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 systemd: added python-systemd package generation.

---
 meta/recipes-core/systemd/systemd_204.bb |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
meta/recipes-core/systemd/systemd_204.bb +19 -5
index b8b1290..2a6ed0c 100644
@@ -13,9 +13,16 @@ PE = "1"
 DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
 DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
+# need to export these variables for python-config to work
+export BUILD_SYS
+export HOST_SYS
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
 SECTION = "base/shell"
 
-inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu
+inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu \
+        ${@base_contains('DISTRO_FEATURES', 'python', 'pythonnative python-dir', '', d)}
 
 SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \
            file://touchscreen.rules \
@@ -42,7 +49,8 @@ LDFLAGS_libc-uclibc_append = " -lrt"
 
 GTKDOC_DOCDIR = "${S}/docs/"
 
-PACKAGECONFIG ??= "xz tcp-wrappers"
+PACKAGECONFIG ??= "xz tcp-wrappers \
+                   ${@base_contains('DISTRO_FEATURES', 'python', 'python', '', d)}"
 # Sign the journal for anti-tampering
 PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
 # regardless of PACKAGECONFIG, libgcrypt is always required to expand
@@ -51,6 +59,8 @@ DEPENDS += "libgcrypt"
 # Compress the journal
 PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
 PACKAGECONFIG[tcp-wrappers] = "--enable-tcpwrap,--disable-tcpwrap,tcp-wrappers"
+# Use python-systemd
+PACKAGECONFIG[python] = "--with-python,--without-python,python"
 
 CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill"
 
@@ -71,7 +81,6 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
                  --disable-tcpwrap \
                  --enable-split-usr \
                  --disable-microhttpd \
-                 --without-python \
                  --with-sysvrcnd-path=${sysconfdir} \
                  --with-firmware-path=/lib/firmware \
                  ac_cv_path_KILL=${base_bindir}/kill \
@@ -93,6 +102,8 @@ do_install() {
 	# Provided by a separate recipe
 	rm ${D}${systemd_unitdir}/system/serial-getty* -f
 
+	rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/systemd/*.la
+
 	# Provide support for initramfs
 	ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
 	ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
@@ -121,7 +132,7 @@ python populate_packages_prepend (){
 }
 PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*"
 
-PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install"
+PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install python-${PN}"
 
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
@@ -131,6 +142,9 @@ FILES_${PN}-analyze = "${bindir}/systemd-analyze"
 FILES_${PN}-initramfs = "/init"
 RDEPENDS_${PN}-initramfs = "${PN}"
 
+FILES_python-${PN} = "${PYTHON_SITEPACKAGES_DIR}/systemd/*.py* ${PYTHON_SITEPACKAGES_DIR}/systemd/*.so"
+RDEPENDS_python-${PN} = "python-core python-datetime python-logging python-syslog"
+
 FILES_${PN}-gui = "${bindir}/systemadm"
 
 FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
@@ -187,7 +201,7 @@ FILES_${PN} = " ${base_bindir}/* \
                 /lib/udev/rules.d/99-systemd.rules \
                "
 
-FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
+FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/ ${PYTHON_SITEPACKAGES_DIR}/systemd/.debug"
 FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
 
 RDEPENDS_${PN} += "dbus util-linux-mount"
Signature · 1 line
1.7.9.5
#1 lore raw

meta/recipes-core/systemd/systemd_204.bb PE = "1" · line 25

Quoted 2 lines · Yevhen Kyriukha
meta/recipes-core/systemd/systemd_204.bb +2 -0
+inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu \
+        ${@base_contains('DISTRO_FEATURES', 'python', 'pythonnative python-dir', '', d)}

You've just invented a new DISTRO_FEATURE, right? I don't think we should invent these without due thought. There's a good discussion to be had around a distro feature to enable all Pythonic integration where possible, but it hasn't been had yet.

I see two options here:

1) systemd doesn't enable Python, and we add another recipe systemd-python that only builds and ships the Python bindings.

2) Decide as a project that we need a new DISTRO_FEATURE "python" that means "has full support for Python", meaning that every package that had Python integration should enable it.

I'm currently leaning towards (1) as it's less intrusive on the OE environment as a whole.

Ross

#2 lore raw

Ok, agree with you to have 2 recipes.
But can you show me the way how to avoid building systemd twice (in systemd and python-systemd) while including python bindings in python-systemd.
Best regards,
Yevhen

2013/7/9 Burton, Ross <[email protected]>:

Quoted 22 lines · Yevhen Kyriukha

meta/recipes-core/systemd/systemd_204.bb PE = "1" · line 25

Quoted 2 lines
meta/recipes-core/systemd/systemd_204.bb +2 -0
+inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu \
+        ${@base_contains('DISTRO_FEATURES', 'python', 'pythonnative python-dir', '', d)}

You've just invented a new DISTRO_FEATURE, right? I don't think we should invent these without due thought. There's a good discussion to be had around a distro feature to enable all Pythonic integration where possible, but it hasn't been had yet.

I see two options here:

1) systemd doesn't enable Python, and we add another recipe systemd-python that only builds and ships the Python bindings.

2) Decide as a project that we need a new DISTRO_FEATURE "python" that means "has full support for Python", meaning that every package that had Python integration should enable it.

I'm currently leaning towards (1) as it's less intrusive on the OE environment as a whole.

Ross