Skip to contentSkip to conversation

base.bbclass: allow specifying an lsb distro hook via the metadata

PATCH Applied Christopher Larson 2 participants 2 messages Aug 2, 2012 – Aug 16, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base.bbclass: allow specifying an lsb distro hook via the metadata

From: Christopher Larson <[email protected]>

This is useful when you have a rather large set of compatible distros. For
example: Centos 5.4, 5.5, 5.6, etc, RHEL server 5.x, RHEL workstation 5.x.

---
 meta/classes/base.bbclass |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/base.bbclass +11 -1
index e15fa26..192c777 100644
@@ -34,11 +34,21 @@ def oe_import(d):
 python oe_import_eh () {
     if isinstance(e, bb.event.ConfigParsed):
         oe_import(e.data)
-        e.data.setVar("NATIVELSBSTRING", oe.lsb.distro_identifier())
+        e.data.setVar("NATIVELSBSTRING", lsb_distro_identifier(e.data))
 }
 
 addhandler oe_import_eh
 
+def lsb_distro_identifier(d):
+    adjust = d.getVar('LSB_DISTRO_ADJUST', True)
+    adjust_func = None
+    if adjust:
+        try:
+            adjust_func = globals()[adjust]
+        except KeyError:
+            pass
+    return oe.lsb.distro_identifier(adjust_func)
+
 die() {
 	bbfatal "$*"
 }
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 28 lines · Christopher Larson

From: Christopher Larson <[email protected]>

This is useful when you have a rather large set of compatible distros. For
example: Centos 5.4, 5.5, 5.6, etc, RHEL server 5.x, RHEL workstation 5.x.

---
  meta/classes/base.bbclass |   12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/base.bbclass +4 -1
index e15fa26..192c777 100644
@@ -34,11 +34,21 @@ def oe_import(d):
  python oe_import_eh () {
      if isinstance(e, bb.event.ConfigParsed):
          oe_import(e.data)
-        e.data.setVar("NATIVELSBSTRING", oe.lsb.distro_identifier())
+        e.data.setVar("NATIVELSBSTRING", lsb_distro_identifier(e.data))
  }
 
  addhandler oe_import_eh
 
+def lsb_distro_identifier(d):
+    adjust = d.getVar('LSB_DISTRO_ADJUST', True)
+    adjust_func = None

meta/classes/base.bbclass def oe_import(d): · line 54

Quoted 10 lines
meta/classes/base.bbclass +7 -0
+    if adjust:
+        try:
+            adjust_func = globals()[adjust]
+        except KeyError:
+            pass
+    return oe.lsb.distro_identifier(adjust_func)
+
  die() {
  	bbfatal "$*"
  }

Merged into OE-Core

Thanks
Sau!