diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2013-03-01 18:42:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-02 13:00:56 +0000 |
commit | b892099902402c1179d7183b6ac97ca517faae7a (patch) | |
tree | 1f1e1ebb2deafe3fd7adc72f0cb76156e219dfa0 /meta/classes | |
parent | 22b1f63223f2d817cf5ff0672e6925826afdf858 (diff) | |
download | poky-b892099902402c1179d7183b6ac97ca517faae7a.tar.gz |
sanity.bbclass: always use oe.lsb.distro_identifier method
* even when /etc/redhat-release or /etc/SuSE-release exists
* don't read /etc/lsb-release manually, NATIVELSBSTRING is not
reading it too
(From OE-Core rev: 3dba05d74821f08cd96a18351805c8812ddd626c)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/sanity.bbclass | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index 94c6ce340f..06e95e3562 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
@@ -263,39 +263,11 @@ def check_supported_distro(sanity_data): | |||
263 | if not tested_distros: | 263 | if not tested_distros: |
264 | return | 264 | return |
265 | 265 | ||
266 | if os.path.exists("/etc/redhat-release"): | 266 | try: |
267 | f = open("/etc/redhat-release", "r") | 267 | distro = oe.lsb.distro_identifier() |
268 | try: | 268 | except Exception: |
269 | distro = f.readline().strip() | 269 | distro = None |
270 | finally: | ||
271 | f.close() | ||
272 | elif os.path.exists("/etc/SuSE-release"): | ||
273 | import re | ||
274 | f = open("/etc/SuSE-release", "r") | ||
275 | try: | ||
276 | distro = f.readline() | ||
277 | # Remove the architecture suffix e.g. (i586) | ||
278 | distro = re.sub(r' \([a-zA-Z0-9\-_]*\)$', '', distro).strip() | ||
279 | finally: | ||
280 | f.close() | ||
281 | else: | ||
282 | # Use LSB method | ||
283 | try: | ||
284 | distro = oe.lsb.distro_identifier() | ||
285 | except Exception: | ||
286 | distro = None | ||
287 | 270 | ||
288 | if not distro: | ||
289 | if os.path.exists("/etc/lsb-release"): | ||
290 | f = open("/etc/lsb-release", "r") | ||
291 | try: | ||
292 | for line in f: | ||
293 | lns = line.split('=') | ||
294 | if lns[0] == "DISTRIB_DESCRIPTION": | ||
295 | distro = lns[1].strip('"\n') | ||
296 | break | ||
297 | finally: | ||
298 | f.close() | ||
299 | if distro: | 271 | if distro: |
300 | if distro not in [x.strip() for x in tested_distros.split('\\n')]: | 272 | if distro not in [x.strip() for x in tested_distros.split('\\n')]: |
301 | bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro) | 273 | bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro) |