From c017b2a016429560223a0f8654994bc772977460 Mon Sep 17 00:00:00 2001 From: Nathan Rossi Date: Tue, 30 May 2017 18:46:21 +1000 Subject: feature-microblaze-versions.inc: Simplify version formatting functions Simplify the functions used to generate the TUNE_CCARGS and PKGARCH version strings. Signed-off-by: Nathan Rossi --- .../microblaze/feature-microblaze-versions.inc | 30 ++++++---------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/conf/machine/include/microblaze/feature-microblaze-versions.inc b/conf/machine/include/microblaze/feature-microblaze-versions.inc index 53d0b9bf..7e9aa954 100644 --- a/conf/machine/include/microblaze/feature-microblaze-versions.inc +++ b/conf/machine/include/microblaze/feature-microblaze-versions.inc @@ -24,28 +24,14 @@ def microblaze_version_conflict(ver, d): conflict.append(i) return " ".join(conflict) -def microblaze_current_version(d): +def microblaze_current_version(d, gcc = False): tunes = (d.getVar("TUNE_FEATURES") or "").split() - for i in tunes: - version = microblaze_parse_version(i) - if version: - return version - return None - -def microblaze_format_gcc_version(ver): - if ver: - if ver[0] <= 8 and len(ver) > 2: - return "v%d.%d.%s" % ver[0:3] - else: - return "v%d.%d" % ver[0:2] - return "" - -def microblaze_format_pkg_version(ver): - if ver: - if ver[0] <= 8 and len(ver) > 2 and ver[2] != "a": - return "v%d.%d.%s" % ver[0:3] + version = next((v for v in [microblaze_parse_version(i) for i in tunes] if v), None) + if version: + if version[0] <= 8 and len(version) > 2 and (gcc or version[2] != "a"): + return "v%d.%d.%s" % version[0:3] else: - return "v%d.%d" % ver[0:2] + return "v%d.%d" % version[0:2] return "" # MicroBlaze versions @@ -89,6 +75,6 @@ TUNECONFLICTS[v8.10] += "reorder" TUNECONFLICTS[v8.20] += "reorder" # Version flags -TUNE_CCARGS += "-mcpu=${@microblaze_format_gcc_version(microblaze_current_version(d))}" -MBPKGARCH_VERSION = "-${@microblaze_format_pkg_version(microblaze_current_version(d))}" +TUNE_CCARGS += "-mcpu=${@microblaze_current_version(d, True)}" +MBPKGARCH_VERSION = "-${@microblaze_current_version(d)}" -- cgit v1.2.3-54-g00ecf