Patchwork [v7] systemd: added python-systemd package generation.

login
register
mail settings
Submitter Yevhen Kyriukha
Date June 26, 2013, 12:15 p.m.
Message ID <1372248906-2554-1-git-send-email-kirgene@gmail.com>
Download mbox | patch
Permalink /patch/52373/
State New
Headers show

Comments

Yevhen Kyriukha - June 26, 2013, 12:15 p.m.
---
 meta/recipes-core/systemd/systemd_204.bb |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
Saul Wold - July 2, 2013, 11:36 p.m.
On 06/26/2013 05:15 AM, Yevhen Kyriukha wrote:
> ---
>   meta/recipes-core/systemd/systemd_204.bb |   20 ++++++++++++++++----
>   1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
> index b8b1290..a12c6c9 100644
> --- a/meta/recipes-core/systemd/systemd_204.bb
> +++ b/meta/recipes-core/systemd/systemd_204.bb
> @@ -13,9 +13,15 @@ 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 pythonnative python-dir
>

There is still a problem with that, that systemd will no bring in python 
native unconditionally even if the PACKAGECONFIG is disabled, we will 
need a way to wrap the inherit some how using variables.

See image.bbclass usage of it around line 100.

Thanks
	Sau!

>   SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \
>              file://touchscreen.rules \
> @@ -51,6 +57,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 +79,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 +100,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 +130,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 +140,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 +199,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"
>
Chris Larson - July 2, 2013, 11:52 p.m.
On Tue, Jul 2, 2013 at 4:36 PM, Saul Wold <sgw@linux.intel.com> wrote:

> On 06/26/2013 05:15 AM, Yevhen Kyriukha wrote:
>
>> ---
>>   meta/recipes-core/systemd/syst**emd_204.bb <http://systemd_204.bb> |
>> 20 ++++++++++++++++----
>>   1 file changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/recipes-core/systemd/sy**stemd_204.bb<http://systemd_204.bb>b/meta/recipes-core/systemd/
>> sy**stemd_204.bb <http://systemd_204.bb>
>> index b8b1290..a12c6c9 100644
>> --- a/meta/recipes-core/systemd/sy**stemd_204.bb <http://systemd_204.bb>
>> +++ b/meta/recipes-core/systemd/sy**stemd_204.bb <http://systemd_204.bb>
>> @@ -13,9 +13,15 @@ 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 pythonnative python-dir
>>
>>
> There is still a problem with that, that systemd will no bring in python
> native unconditionally even if the PACKAGECONFIG is disabled, we will need
> a way to wrap the inherit some how using variables.
>

One possibility might be to split out the python support into a separate
recipe, if you can point it at bits in the sysroot from the main recipe.

Patch

diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
index b8b1290..a12c6c9 100644
--- a/meta/recipes-core/systemd/systemd_204.bb
+++ b/meta/recipes-core/systemd/systemd_204.bb
@@ -13,9 +13,15 @@  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 pythonnative python-dir
 
 SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \
            file://touchscreen.rules \
@@ -51,6 +57,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 +79,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 +100,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 +130,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 +140,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 +199,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"