summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/lsb.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 08:01:28 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 08:02:11 +0100
commit4f31d21bcb1c8c744e9abb33248715afe4a40af0 (patch)
treea43294f03f0f3af4cf586c6e85f85912fc51ad76 /meta/lib/oe/lsb.py
parentde3abcf78ad4cab5c26fa272a5fcccfd17cccdd5 (diff)
downloadpoky-4f31d21bcb1c8c744e9abb33248715afe4a40af0.tar.gz
lib/oe/lsb.py: Map unknown distributions to 'Unknown'
(From OE-Core rev: e12df2ca5c71ad672ebbfefbc47cabbac3333d61) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/lsb.py')
-rw-r--r--meta/lib/oe/lsb.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/meta/lib/oe/lsb.py b/meta/lib/oe/lsb.py
index 36dd12fc80..c8852a2b65 100644
--- a/meta/lib/oe/lsb.py
+++ b/meta/lib/oe/lsb.py
@@ -5,7 +5,7 @@ def release_dict():
5 try: 5 try:
6 output, err = bb.process.run(['lsb_release', '-a'], stderr=PIPE) 6 output, err = bb.process.run(['lsb_release', '-a'], stderr=PIPE)
7 except bb.process.CmdError as exc: 7 except bb.process.CmdError as exc:
8 return 8 return None
9 9
10 data = {} 10 data = {}
11 for line in output.splitlines(): 11 for line in output.splitlines():
@@ -22,7 +22,13 @@ def distro_identifier(adjust_hook=None):
22 with optional adjustment via a hook""" 22 with optional adjustment via a hook"""
23 23
24 lsb_data = release_dict() 24 lsb_data = release_dict()
25 distro_id, release = lsb_data['Distributor ID'], lsb_data['Release'] 25 if lsb_data:
26 distro_id, release = lsb_data['Distributor ID'], lsb_data['Release']
27 else:
28 distro_id, release = None, None
29
26 if adjust_hook: 30 if adjust_hook:
27 distro_id, release = adjust_hook(distro_id, release) 31 distro_id, release = adjust_hook(distro_id, release)
32 if not distro_id:
33 return "Unknown"
28 return '{0}-{1}'.format(distro_id, release).replace(' ','-') 34 return '{0}-{1}'.format(distro_id, release).replace(' ','-')