summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/sanity.bbclass18
-rw-r--r--meta/lib/oe/distro_check.py2
-rw-r--r--meta/lib/oe/terminal.py7
3 files changed, 10 insertions, 17 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 9fbc9c18e7..0e20589b22 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -462,13 +462,12 @@ def check_sanity_validmachine(sanity_data):
462# Patch before 2.7 can't handle all the features in git-style diffs. Some 462# Patch before 2.7 can't handle all the features in git-style diffs. Some
463# patches may incorrectly apply, and others won't apply at all. 463# patches may incorrectly apply, and others won't apply at all.
464def check_patch_version(sanity_data): 464def check_patch_version(sanity_data):
465 from distutils.version import LooseVersion
466 import re, subprocess 465 import re, subprocess
467 466
468 try: 467 try:
469 result = subprocess.check_output(["patch", "--version"], stderr=subprocess.STDOUT).decode('utf-8') 468 result = subprocess.check_output(["patch", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
470 version = re.search(r"[0-9.]+", result.splitlines()[0]).group() 469 version = re.search(r"[0-9.]+", result.splitlines()[0]).group()
471 if LooseVersion(version) < LooseVersion("2.7"): 470 if bb.utils.vercmp_string_op(version, "2.7", "<"):
472 return "Your version of patch is older than 2.7 and has bugs which will break builds. Please install a newer version of patch.\n" 471 return "Your version of patch is older than 2.7 and has bugs which will break builds. Please install a newer version of patch.\n"
473 else: 472 else:
474 return None 473 return None
@@ -478,7 +477,6 @@ def check_patch_version(sanity_data):
478# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612. 477# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612.
479# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate. 478# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
480def check_make_version(sanity_data): 479def check_make_version(sanity_data):
481 from distutils.version import LooseVersion
482 import subprocess 480 import subprocess
483 481
484 try: 482 try:
@@ -486,7 +484,7 @@ def check_make_version(sanity_data):
486 except subprocess.CalledProcessError as e: 484 except subprocess.CalledProcessError as e:
487 return "Unable to execute make --version, exit code %d\n%s\n" % (e.returncode, e.output) 485 return "Unable to execute make --version, exit code %d\n%s\n" % (e.returncode, e.output)
488 version = result.split()[2] 486 version = result.split()[2]
489 if LooseVersion(version) == LooseVersion("3.82"): 487 if bb.utils.vercmp_string_op(version, "3.82", "=="):
490 # Construct a test file 488 # Construct a test file
491 f = open("makefile_test", "w") 489 f = open("makefile_test", "w")
492 f.write("makefile_test.a: makefile_test_a.c makefile_test_b.c makefile_test.a( makefile_test_a.c makefile_test_b.c)\n") 490 f.write("makefile_test.a: makefile_test_a.c makefile_test_b.c makefile_test.a( makefile_test_a.c makefile_test_b.c)\n")
@@ -539,12 +537,11 @@ def check_wsl(d):
539# built buildtools-extended-tarball) 537# built buildtools-extended-tarball)
540# 538#
541def check_gcc_version(sanity_data): 539def check_gcc_version(sanity_data):
542 from distutils.version import LooseVersion
543 import subprocess 540 import subprocess
544 541
545 build_cc, version = oe.utils.get_host_compiler_version(sanity_data) 542 build_cc, version = oe.utils.get_host_compiler_version(sanity_data)
546 if build_cc.strip() == "gcc": 543 if build_cc.strip() == "gcc":
547 if LooseVersion(version) < LooseVersion("7.5"): 544 if bb.utils.vercmp_string_op(version, "7.5", "<"):
548 return "Your version of gcc is older than 7.5 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n" 545 return "Your version of gcc is older than 7.5 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
549 return None 546 return None
550 547
@@ -552,14 +549,13 @@ def check_gcc_version(sanity_data):
552# but earlier versions do not; this needs to work properly for sstate 549# but earlier versions do not; this needs to work properly for sstate
553# Version 1.28 is needed so opkg-build works correctly when reproducibile builds are enabled 550# Version 1.28 is needed so opkg-build works correctly when reproducibile builds are enabled
554def check_tar_version(sanity_data): 551def check_tar_version(sanity_data):
555 from distutils.version import LooseVersion
556 import subprocess 552 import subprocess
557 try: 553 try:
558 result = subprocess.check_output(["tar", "--version"], stderr=subprocess.STDOUT).decode('utf-8') 554 result = subprocess.check_output(["tar", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
559 except subprocess.CalledProcessError as e: 555 except subprocess.CalledProcessError as e:
560 return "Unable to execute tar --version, exit code %d\n%s\n" % (e.returncode, e.output) 556 return "Unable to execute tar --version, exit code %d\n%s\n" % (e.returncode, e.output)
561 version = result.split()[3] 557 version = result.split()[3]
562 if LooseVersion(version) < LooseVersion("1.28"): 558 if bb.utils.vercmp_string_op(version, "1.28", "<"):
563 return "Your version of tar is older than 1.28 and does not have the support needed to enable reproducible builds. Please install a newer version of tar (you could use the project's buildtools-tarball from our last release or use scripts/install-buildtools).\n" 559 return "Your version of tar is older than 1.28 and does not have the support needed to enable reproducible builds. Please install a newer version of tar (you could use the project's buildtools-tarball from our last release or use scripts/install-buildtools).\n"
564 return None 560 return None
565 561
@@ -567,14 +563,13 @@ def check_tar_version(sanity_data):
567# The kernel tools assume git >= 1.8.3.1 (verified needed > 1.7.9.5) see #6162 563# The kernel tools assume git >= 1.8.3.1 (verified needed > 1.7.9.5) see #6162
568# The git fetcher also had workarounds for git < 1.7.9.2 which we've dropped 564# The git fetcher also had workarounds for git < 1.7.9.2 which we've dropped
569def check_git_version(sanity_data): 565def check_git_version(sanity_data):
570 from distutils.version import LooseVersion
571 import subprocess 566 import subprocess
572 try: 567 try:
573 result = subprocess.check_output(["git", "--version"], stderr=subprocess.DEVNULL).decode('utf-8') 568 result = subprocess.check_output(["git", "--version"], stderr=subprocess.DEVNULL).decode('utf-8')
574 except subprocess.CalledProcessError as e: 569 except subprocess.CalledProcessError as e:
575 return "Unable to execute git --version, exit code %d\n%s\n" % (e.returncode, e.output) 570 return "Unable to execute git --version, exit code %d\n%s\n" % (e.returncode, e.output)
576 version = result.split()[2] 571 version = result.split()[2]
577 if LooseVersion(version) < LooseVersion("1.8.3.1"): 572 if bb.utils.vercmp_string_op(version, "1.8.3.1", "<"):
578 return "Your version of git is older than 1.8.3.1 and has bugs which will break builds. Please install a newer version of git.\n" 573 return "Your version of git is older than 1.8.3.1 and has bugs which will break builds. Please install a newer version of git.\n"
579 return None 574 return None
580 575
@@ -796,9 +791,8 @@ def check_sanity_everybuild(status, d):
796 status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n') 791 status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n')
797 792
798 # Check the bitbake version meets minimum requirements 793 # Check the bitbake version meets minimum requirements
799 from distutils.version import LooseVersion
800 minversion = d.getVar('BB_MIN_VERSION') 794 minversion = d.getVar('BB_MIN_VERSION')
801 if (LooseVersion(bb.__version__) < LooseVersion(minversion)): 795 if bb.utils.vercmp_string_op(bb.__version__, minversion, "<"):
802 status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__)) 796 status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__))
803 797
804 sanity_check_locale(d) 798 sanity_check_locale(d)
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index 88e46c354d..4b2a9bec01 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -26,7 +26,7 @@ def find_latest_numeric_release(url, d):
26 maxstr="" 26 maxstr=""
27 for link in get_links_from_url(url, d): 27 for link in get_links_from_url(url, d):
28 try: 28 try:
29 # TODO use LooseVersion 29 # TODO use bb.utils.vercmp_string_op()
30 release = float(link) 30 release = float(link)
31 except: 31 except:
32 release = 0 32 release = 0
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 59aa80de66..53186c4a3e 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -5,7 +5,6 @@ import logging
5import oe.classutils 5import oe.classutils
6import shlex 6import shlex
7from bb.process import Popen, ExecutionError 7from bb.process import Popen, ExecutionError
8from distutils.version import LooseVersion
9 8
10logger = logging.getLogger('BitBake.OE.Terminal') 9logger = logging.getLogger('BitBake.OE.Terminal')
11 10
@@ -86,10 +85,10 @@ class Konsole(XTerminal):
86 def __init__(self, sh_cmd, title=None, env=None, d=None): 85 def __init__(self, sh_cmd, title=None, env=None, d=None):
87 # Check version 86 # Check version
88 vernum = check_terminal_version("konsole") 87 vernum = check_terminal_version("konsole")
89 if vernum and LooseVersion(vernum) < '2.0.0': 88 if vernum and bb.utils.vercmp_string_op(vernum, "2.0.0", "<"):
90 # Konsole from KDE 3.x 89 # Konsole from KDE 3.x
91 self.command = 'konsole -T "{title}" -e {command}' 90 self.command = 'konsole -T "{title}" -e {command}'
92 elif vernum and LooseVersion(vernum) < '16.08.1': 91 elif vernum and bb.utils.vercmp_string_op(vernum, "16.08.1", "<"):
93 # Konsole pre 16.08.01 Has nofork 92 # Konsole pre 16.08.01 Has nofork
94 self.command = 'konsole --nofork --workdir . -p tabtitle="{title}" -e {command}' 93 self.command = 'konsole --nofork --workdir . -p tabtitle="{title}" -e {command}'
95 XTerminal.__init__(self, sh_cmd, title, env, d) 94 XTerminal.__init__(self, sh_cmd, title, env, d)
@@ -260,7 +259,7 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
260 259
261def check_tmux_version(desired): 260def check_tmux_version(desired):
262 vernum = check_terminal_version("tmux") 261 vernum = check_terminal_version("tmux")
263 if vernum and LooseVersion(vernum) < desired: 262 if vernum and bb.utils.vercmp_string_op(vernum, desired, "<"):
264 return False 263 return False
265 return vernum 264 return vernum
266 265