[meta-oe,2/2] systemd.bbclass: do not mangle PACKAGES variable in native, nativesdk and cross

Submitted by Otavio Salvador on Feb. 24, 2012, 8:55 p.m.

Details

Message ID 6dcaffb8068eb5a1d62c00c44f93e37a070c6065.1330116875.git.otavio@ossystems.com.br
State Accepted
Commit c9f5703aded908f2c61171abe2969e41d35028e2
Headers show

Commit Message

Otavio Salvador Feb. 24, 2012, 8:55 p.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta-oe/classes/systemd.bbclass |   72 +++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 36 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index dd423b5..0329b90 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -28,40 +28,34 @@  systemctl disable ${SYSTEMD_SERVICE}
 
 def systemd_after_parse(d):
 	def systemd_check_vars():
-		bpn = d.getVar('BPN', 1)
-		# not for native / only at parse time
-		if d.getVar('BB_WORKERCONTEXT', True) is None and \
-		bpn + "-native" != d.getVar('PN', 1) and \
-		bpn + "-cross" != d.getVar('PN', 1) and \
-		bpn + "-nativesdk" != d.getVar('PN', 1):
-			bb_filename = d.getVar('FILE')
-			packages = d.getVar('PACKAGES', 1)
-
-			# check SYSTEMD_PACKAGES
-			systemd_pkgs = d.getVar('SYSTEMD_PACKAGES', 1) or ""
-			if systemd_pkgs == "":
-				raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_PACKAGES" % bb_filename
-			for pkg_systemd in systemd_pkgs.split():
-				if pkg_systemd.find("-systemd") == -1:
-					if pkg_systemd != d.getVar('PN', 1):
-						raise bb.build.FuncFailed, \
-							"\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \
-							(bb_filename, pkg_systemd)
-					else:
-						bb.warn("%s: it is recommended to set SYSTEMD_PACKAGES as <existing-package>-systemd" % bb_filename)
+		bb_filename = d.getVar('FILE')
+		packages = d.getVar('PACKAGES', 1)
+
+		# check SYSTEMD_PACKAGES
+		systemd_pkgs = d.getVar('SYSTEMD_PACKAGES', 1) or ""
+		if systemd_pkgs == "":
+			raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_PACKAGES" % bb_filename
+		for pkg_systemd in systemd_pkgs.split():
+			if pkg_systemd.find("-systemd") == -1:
+				if pkg_systemd != d.getVar('PN', 1):
+					raise bb.build.FuncFailed, \
+						"\n\n%s: %s in SYSTEMD_PACKAGES does not match <existing-package>-systemd or ${PN} (deprecated)" % \
+						(bb_filename, pkg_systemd)
 				else:
-					pkg_systemd_base = pkg_systemd.replace('-systemd', '')
-					if pkg_systemd_base not in packages:
-						raise bb.build.FuncFailed, \
-							"\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 ""
-				if systemd_services == "":
-					raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_SERVICE / %s" % (bb_filename, service_pkg)
+					bb.warn("%s: it is recommended to set SYSTEMD_PACKAGES as <existing-package>-systemd" % bb_filename)
+			else:
+				pkg_systemd_base = pkg_systemd.replace('-systemd', '')
+				if pkg_systemd_base not in packages:
+					raise bb.build.FuncFailed, \
+						"\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 ""
+			if systemd_services == "":
+				raise bb.build.FuncFailed, "\n\n%s inherits systemd but doesn't set SYSTEMD_SERVICE / %s" % (bb_filename, service_pkg)
 
 	# prepend systemd-packages not already included
 	def systemd_create_package(pkg_systemd):
@@ -71,9 +65,15 @@  def systemd_after_parse(d):
 			d.setVar('PACKAGES', packages)
 
 
-	systemd_check_vars()
-	for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
-		systemd_create_package(pkg_systemd)
+	bpn = d.getVar('BPN', 1)
+	# not for native / only at parse time
+	if d.getVar('BB_WORKERCONTEXT', True) is None and \
+	bpn + "-native" != d.getVar('PN', 1) and \
+	bpn + "-cross" != d.getVar('PN', 1) and \
+	bpn + "-nativesdk" != d.getVar('PN', 1):
+		systemd_check_vars()
+		for pkg_systemd in d.getVar('SYSTEMD_PACKAGES', 1).split():
+			systemd_create_package(pkg_systemd)
 
 
 python __anonymous() {

Comments

Otavio Salvador Feb. 25, 2012, 1:44 a.m.
On Fri, Feb 24, 2012 at 18:55, Otavio Salvador <otavio@ossystems.com.br> wrote:
>  meta-oe/classes/systemd.bbclass |   72 +++++++++++++++++++-------------------
>  1 files changed, 36 insertions(+), 36 deletions(-)

This broke it; I am fixing it and will send a patch soon.
Otavio Salvador Feb. 25, 2012, 2:33 a.m.
On Fri, Feb 24, 2012 at 23:44, Otavio Salvador <otavio@ossystems.com.br> wrote:
> On Fri, Feb 24, 2012 at 18:55, Otavio Salvador <otavio@ossystems.com.br> wrote:
>>  meta-oe/classes/systemd.bbclass |   72 +++++++++++++++++++-------------------
>>  1 files changed, 36 insertions(+), 36 deletions(-)
>
> This broke it; I am fixing it and will send a patch soon.

I ended sending two patches to fix this. The second one is the right
to be take since it fix the packaging and parsing. Sorry by this
mistake.
Andreas Müller Feb. 26, 2012, 12:06 p.m.
On Sat, Feb 25, 2012 at 3:33 AM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> On Fri, Feb 24, 2012 at 23:44, Otavio Salvador <otavio@ossystems.com.br> wrote:
>> On Fri, Feb 24, 2012 at 18:55, Otavio Salvador <otavio@ossystems.com.br> wrote:
>>>  meta-oe/classes/systemd.bbclass |   72 +++++++++++++++++++-------------------
>>>  1 files changed, 36 insertions(+), 36 deletions(-)
>>
>> This broke it; I am fixing it and will send a patch soon.
>
> I ended sending two patches to fix this. The second one is the right
> to be take since it fix the packaging and parsing. Sorry by this
> mistake.
>
I was about to send a revert - but it's too late now -because I
haven't understood what the original patch is for. Could you please
tell us what it fixes / enhances?

Andreas
Otavio Salvador Feb. 27, 2012, 11:22 a.m.
On Sun, Feb 26, 2012 at 09:06, Andreas Müller
<schnitzeltony@googlemail.com> wrote:
> I was about to send a revert - but it's too late now -because I
> haven't understood what the original patch is for. Could you please
> tell us what it fixes / enhances?

The parsing where being properly skipped in case of native, nativesdk
and cross however the packaging addition not; so it ended up trying to
build cross and native packages; in my case it broken an internal
package that is built using chicken and is cross.