Skip to contentSkip to conversation

systemd.bbclass fixes

PATCH Superseded Andreas Müller 2 participants 6 messages May 31, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover systemd.bbclass fixes

This patch series superseeds [1-2]. It supersedes Martin's suggestion [3] and includes his PR bump [4].

It was build tested and the results were checked with buildhistory.

[1] http://patches.openembedded.org/patch/28843/
[2] http://patches.openembedded.org/patch/28841/
[3] http://patches.openembedded.org/patch/28939/
[4] http://patches.openembedded.org/patch/28943/

Andreas Müller (3):
systemd-systemctl-native: Add additional messages for better
debugging
systemd.bbclass: remove unused code systemd.bbclass: extract SYSTEMD_SERVICE properly

Martin Jansa (1):
recipes: bump PR to fix -systemd postinsts where SYSTEMD_SERVICE was
used without PN* suffix

 meta-efl/recipes-efl/efl/elsa_svn.bb               |    2 +
 meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb         |    2 +-
 meta-oe/classes/systemd.bbclass                    |   27 ++++++++++++-------
 meta-oe/recipes-bsp/keymaps/keymaps_1.0.bbappend   |    2 +-
 .../cherokee/cherokee_1.2.98.bb                    |    2 +-
 .../recipes-connectivity/gateone/gateone_git.bb    |    2 +-
 .../networkmanager/networkmanager_0.9.2.0.bb       |    2 +-
 .../openssh/openssh_6.0p1.bbappend                 |    2 +-
 .../systemd/systemd-machine-units_1.0.bb           |    2 +
 .../systemd/systemd-systemctl-native.bb            |    2 +-
 .../systemd/systemd-systemctl-native/systemctl     |    5 +++
 meta-oe/recipes-extended/rsyslog/rsyslog.inc       |    2 +-
 .../xinput-calibrator/xinput-calibrator_0.7.5.bb   |    2 +-
 meta-oe/recipes-navigation/gpsd/gpsd_3.4.bb        |    2 +
 meta-oe/recipes-navigation/gpsd/gpsd_3.5.bb        |    2 +
 meta-oe/recipes-navigation/gpsd/gpsd_git.bb        |    2 +
 meta-oe/recipes-support/syslog-ng/syslog-ng.inc    |    2 +-
 17 files changed, 42 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH 1/4 systemd-systemctl-native: Add additional messages for better debugging

These messages helped me to fix the breakage of networkmanager/systemd

---
 .../systemd/systemd-systemctl-native.bb            |    2 +-
 .../systemd/systemd-systemctl-native/systemctl     |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)
meta-oe/recipes-core/systemd/systemd-systemctl-native.bb +1 -1
index 78eb8f3..7ca77ae 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Wrapper to enable of systemd services"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
 
-PR = "r2"
+PR = "r3"
 
 inherit native
 
meta-oe/recipes-core/systemd/systemd-systemctl-native/systemctl +5 -0
index 6e7a05d..ff9e6a7 100755
@@ -1,4 +1,5 @@
 #!/bin/sh
+echo "Started $0 $*"
 
 ROOT=
 
@@ -42,6 +43,7 @@ while [ $# != 0 ]; do
 done
 
 for service in $services; do
+	echo "Try to find location of $service..."
 	# find service file
 	for p in $ROOT/etc/systemd/system \
 		 $ROOT/lib/systemd/system \
@@ -55,6 +57,7 @@ for service in $services; do
 		echo "'$service' couldn't be found; exiting with error"
 		exit 1
 	fi
+	echo "Found $service in $service_file"
 
 	# create the required symbolic links
 	wanted_by=$(grep WantedBy $ROOT/$service_file \
@@ -63,6 +66,7 @@ for service in $services; do
 		        | grep '\.target$')
 
 	for r in $wanted_by; do
+		echo "WantedBy=$r found in $service"
 		if [ "$action" = "enable" ]; then
 			mkdir -p $ROOT/etc/systemd/system/$r.wants
 			ln -s $service_file $ROOT/etc/systemd/system/$r.wants
@@ -79,6 +83,7 @@ for service in $services; do
 		   | sed 's,Also=,,g' \
 		   | tr ',' '\n')
 	for a in $also; do
+		echo "Also=$a found in $service"
 		if [ "$action" = "enable" ]; then
 			$0 --root=$ROOT enable $a
 		fi
Signature · 1 line
1.7.6.5
#2 lore raw

PATCH 2/4 systemd.bbclass: remove unused code

In reply to Andreas Müller
---
 meta-oe/classes/systemd.bbclass |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
meta-oe/classes/systemd.bbclass +0 -5
index db35717..2881abf 100644
@@ -54,11 +54,6 @@ def systemd_after_parse(d):
 						"\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \
 						( bb_filename, pkg_systemd)
 
-		# check SYSTEMD_SERVICE
-		for pkg_systemd in systemd_pkgs.split():
-			service_pkg = 'SYSTEMD_SERVICE' + "_" + pkg_systemd
-			systemd_services = d.getVar(service_pkg, 1) or d.getVar('SYSTEMD_SERVICE', 1) or ""
-
 	# prepend systemd-packages not already included
 	def systemd_create_package(pkg_systemd):
 		packages = d.getVar('PACKAGES', 1)
Signature · 1 line
1.7.6.5
#3 lore raw

PATCH 3/4 systemd.bbclass: extract SYSTEMD_SERVICE properly

In reply to Andreas Müller

To set service files the following syntax is allowed:

SYSTEMD_SERVICE = <service_file>
or
SYSTEMD_SERVICE_{<systemd_package_name>} = <service_file>

A function get_package_var was introduced to handle all use-cases [1] properly.

Build tested / buildhistory checks

[1] http://lists.linuxtogo.org/pipermail/openembedded-devel/2012-May/039870.html

---
 meta-oe/classes/systemd.bbclass |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
meta-oe/classes/systemd.bbclass +17 -5
index 2881abf..976346f 100644
@@ -24,6 +24,20 @@ systemd_postrm() {
 systemctl disable ${SYSTEMD_SERVICE}
 }
 
+def get_package_var(d, var, pkg):
+	val = d.getVar('%s_%s' % (var, pkg), d, 1)
+	if val:
+		val = val.strip()
+	else:
+		val = ""
+	if val == "":
+		val = bb.data.getVar(var, d, 1)
+		if val:
+			val = val.strip()
+		else:
+			val = ""
+	return val
+
 def systemd_after_parse(d):
 	def systemd_check_vars():
 		if d.getVar('BB_WORKERCONTEXT', True) is not None:
@@ -155,8 +169,7 @@ python populate_packages_prepend () {
 		systemd_packages = d.getVar('SYSTEMD_PACKAGES', 1)
 		has_exactly_one_service = len(systemd_packages.split()) == 1
 		if has_exactly_one_service:
-			systemd_services = d.getVar('SYSTEMD_SERVICE' + "_" + systemd_packages, 1) or d.getVar('SYSTEMD_SERVICE', 1)
-			has_exactly_one_service = len(systemd_services.split()) == 1
+			has_exactly_one_service = len(get_package_var(d, 'SYSTEMD_SERVICE', systemd_packages)) == 1
 
 		keys = 'Also' # Conflicts??
 		if has_exactly_one_service:
@@ -164,8 +177,7 @@ python populate_packages_prepend () {
 			keys = 'Also Conflicts'
 		# scan for all in SYSTEMD_SERVICE[]
 		for pkg_systemd in systemd_packages.split():
-			systemd_services = d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) or d.getVar('SYSTEMD_SERVICE', 1)
-			for service in systemd_services.split():
+			for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split():
 				path_found = ''
 				for path in searchpaths.split():
 					if os.path.exists('${D}' + path + service):
@@ -196,7 +208,7 @@ python populate_packages_prepend () {
 	# run all modifications once when creating package
 	if os.path.exists('${D}'):
 		for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
-			if d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1) and d.getVar('SYSTEMD_SERVICE' + "_" + pkg_systemd, 1).strip():
+			if get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd) != "":
 				systemd_generate_package_scripts(pkg_systemd)
 				systemd_add_rdepends(pkg_systemd)
 		systemd_check_services()
Signature · 1 line
1.7.6.5
#4 lore raw

Re: [meta-oe 3/4] systemd.bbclass: extract SYSTEMD_SERVICE properly

Quoted 4 lines · Andreas Müller
meta-oe/classes/systemd.bbclass +4 -0
+def get_package_var(d, var, pkg):
+       val = d.getVar('%s_%s' % (var, pkg), d, 1)
+       if val:
+               val = val.strip()

meta-oe/classes/systemd.bbclass systemd_postrm() { · line 40

Quoted 10 lines
meta-oe/classes/systemd.bbclass +10 -0
+       else:
+               val = ""
+       if val == "":
+               val = bb.data.getVar(var, d, 1)
+               if val:
+                       val = val.strip()
+               else:
+                       val = ""
+       return val
+

getVar is used inconsistently. secondly can it be restructured a bit seems too many ifs and elses

#5 lore raw

PATCH 4/4 recipes: bump PR to fix -systemd postinsts where SYSTEMD_SERVICE was used without PN* suffix

In reply to Andreas Müller

From: Martin Jansa <[email protected]>

---
 meta-efl/recipes-efl/efl/elsa_svn.bb               |    2 ++
 meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb         |    2 +-
 meta-oe/recipes-bsp/keymaps/keymaps_1.0.bbappend   |    2 +-
 .../cherokee/cherokee_1.2.98.bb                    |    2 +-
 .../recipes-connectivity/gateone/gateone_git.bb    |    2 +-
 .../networkmanager/networkmanager_0.9.2.0.bb       |    2 +-
 .../openssh/openssh_6.0p1.bbappend                 |    2 +-
 .../systemd/systemd-machine-units_1.0.bb           |    2 ++
 meta-oe/recipes-extended/rsyslog/rsyslog.inc       |    2 +-
 .../xinput-calibrator/xinput-calibrator_0.7.5.bb   |    2 +-
 meta-oe/recipes-navigation/gpsd/gpsd_3.4.bb        |    2 ++
 meta-oe/recipes-navigation/gpsd/gpsd_3.5.bb        |    2 ++
 meta-oe/recipes-navigation/gpsd/gpsd_git.bb        |    2 ++
 meta-oe/recipes-support/syslog-ng/syslog-ng.inc    |    2 +-
 14 files changed, 19 insertions(+), 9 deletions(-)
meta-efl/recipes-efl/efl/elsa_svn.bb +2 -0
index 1f1032f..b8a4f63 100644
@@ -4,6 +4,8 @@ LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 SECTION = "e/apps"
 
+PR = "r1"
+
 inherit e gettext
 SRC_URI = "${E_SVN}/trunk/PROTO;module=${SRCNAME};proto=http;scmdata=keep \
   file://0001-pam-use-common-auth-instead-of-system-auth.patch \
meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb +1 -1
index d71c7d8..6ebd587 100644
@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
 DEPENDS = "xinput gnome-panel tcp-wrappers libcanberra libxklavier grep consolekit libpam gnome-doc-utils gtk+ xrdb"
 
-PR = "r7"
+PR = "r8"
 
 inherit gnome update-rc.d systemd
 
meta-oe/recipes-bsp/keymaps/keymaps_1.0.bbappend +1 -1
index b144e9f..cc6cb7c 100644
@@ -1,5 +1,5 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-PRINC := "${@int(PRINC) + 4}"
+PRINC := "${@int(PRINC) + 5}"
 
 SRC_URI += " file://keymaps.service"
 
meta-oe/recipes-connectivity/cherokee/cherokee_1.2.98.bb +1 -1
index 0080195..a4835e0 100644
@@ -5,7 +5,7 @@ SECTION = "network"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
-PR = "r3"
+PR = "r4"
 
 DEPENDS = "libpcre openssl mysql5 ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
meta-oe/recipes-connectivity/gateone/gateone_git.bb +1 -1
index d56c848..c737eae 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "HTML5 (plugin-free) web-based terminal emulator and SSH client"
 LICENSE = "AGPLv3"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=ee5b168fc7de89a0cadc49e27830aa2c"
 
-PR = "r5"
+PR = "r6"
 
 PV = "1.1"
 SRCREV = "bb74e1095adb66b04b51ed6ff10ae0aa96afdd46"
meta-oe/recipes-connectivity/networkmanager/networkmanager_0.9.2.0.bb +1 -1
index 474d98a..221dc2c 100644
@@ -4,7 +4,7 @@ SECTION = "net/misc"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=cbbffd568227ada506640fe950a4823b"
 
-PR = "r5"
+PR = "r6"
 
 DEPENDS = "systemd libnl dbus dbus-glib udev wireless-tools polkit gnutls util-linux ppp"
 inherit gnome gettext systemd
meta-oe/recipes-connectivity/openssh/openssh_6.0p1.bbappend +1 -1
index a459065..de7668f 100644
@@ -1,6 +1,6 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
-PRINC := "${@int(PRINC) + 1}"
+PRINC := "${@int(PRINC) + 2}"
 
 SYSTEMD_PACKAGES = "openssh-sshd-systemd"
 SYSTEMD_SERVICE = "sshd.socket"
meta-oe/recipes-core/systemd/systemd-machine-units_1.0.bb +2 -0
index f223364..f33b2a9 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
+PR = "r1"
+
 inherit systemd
 SYSTEMD_SERVICE = ""
 SYSTEMD_PACKAGES = "${PN}"
meta-oe/recipes-extended/rsyslog/rsyslog.inc +1 -1
index d4552cf..97fd026 100644
@@ -4,7 +4,7 @@ HOMEPAGE = "http://www.rsyslog.com/"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=51d9635e646fb75e1b74c074f788e973"
 
-INC_PR = "r3"
+INC_PR = "r4"
 
 SRC_URI = "http://www.rsyslog.com/files/download/rsyslog/${PN}-${PV}.tar.gz \
            file://rsyslog.conf"
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_0.7.5.bb +1 -1
index 765dcf2..fc5da49 100644
@@ -4,7 +4,7 @@ LICENSE = "MIT-X"
 LIC_FILES_CHKSUM = "file://src/calibrator.cpp;endline=22;md5=998e238a7638a7446eaeb02398f691fc"
 DEPENDS = "virtual/libx11 libxi"
 
-PR = "r6"
+PR = "r7"
 
 inherit autotools systemd
 
meta-oe/recipes-navigation/gpsd/gpsd_3.4.bb +2 -0
index 7f6d0ba..4f00cf4 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
 DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-native"
 PROVIDES = "virtual/gpsd"
 
+PR = "r1"
+
 SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
   file://0001-SConstruct-fix-DSO-build-for-ntpshm-garmin_monitor.patch \
   file://0001-SConstruct-respect-sysroot-setting-when-prepending-L.patch \
meta-oe/recipes-navigation/gpsd/gpsd_3.5.bb +2 -0
index 92060b2..60b30df 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
 DEPENDS = "dbus dbus-glib ncurses python libusb1"
 PROVIDES = "virtual/gpsd"
 
+PR = "r1"
+
 DEFAULT_PREFERENCE = "-1"
 SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
   file://0001-SConstruct-respect-sysroot-setting-when-prepending-L.patch \
meta-oe/recipes-navigation/gpsd/gpsd_git.bb +2 -0
index 2d01a77..0cf0685 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
 DEPENDS = "dbus dbus-glib ncurses python libusb1"
 PROVIDES = "virtual/gpsd"
 
+PR = "r1"
+
 SRCREV = "f8744f4af8cef211de698df5d8e6caddfe33f29d"
 
 DEFAULT_PREFERENCE = "-1"
meta-oe/recipes-support/syslog-ng/syslog-ng.inc +1 -1
index 3489ac5..50ce4a4 100644
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7ec1bcc46f28b11f4722e20d9b7dd4d5"
 # update-rc.d and update-alternatives is important
 RDEPENDS_${PN} += " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
 
-INC_PR = "r7"
+INC_PR = "r8"
 
 inherit autotools systemd
 
Signature · 1 line
1.7.6.5