From 77171e9de802b339ba1b96fce158a04616071727 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 10 Dec 2025 07:22:59 +0000 Subject: [PATCH] Verify QT_VERSION Add task to verify that QT_VERSION matches the version used in the Qt sources. Pick-to: 6.8 Change-Id: I0065bf3bcda7174a337960f4ec1ac7c403599fcf Reviewed-by: Ari Parkkila Reviewed-by: Mikko Gronoff (cherry picked from commit e32ce33ee2d749cef931c3e5992603d299336c3a) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit e45ceca70d607aeae061cc82e22a036eb21a639a) --- classes/verify-qt-version.bbclass | 22 ++++++++++++++++++++++ recipes-qt/qt6/qtbase_git.bb | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 classes/verify-qt-version.bbclass diff --git a/classes/verify-qt-version.bbclass b/classes/verify-qt-version.bbclass new file mode 100644 index 0000000..80717a6 --- /dev/null +++ b/classes/verify-qt-version.bbclass @@ -0,0 +1,22 @@ +python do_verify_qt_version() { + import os, re + + qt_version = d.getVar('QT_VERSION') + + cmake_conf = os.path.join(d.getVar('S'), '.cmake.conf') + with open(cmake_conf, 'r', encoding='utf-8') as f: + data = f.read() + + m = re.search(r'set\(QT_REPO_MODULE_VERSION "([0-9.]+)"\)', data) + if not m: + bb.fatal("Could not parse QT_REPO_MODULE_VERSION from %s" % cmake_conf) + + repo_version = m.group(1) + + if qt_version != repo_version: + bb.fatal("Qt version mismatch: QT_VERSION (%s) does not match the sources (%s)" \ + % (qt_version, repo_version)) +} + +addtask verify_qt_version after do_patch before do_configure + diff --git a/recipes-qt/qt6/qtbase_git.bb b/recipes-qt/qt6/qtbase_git.bb index cb7c319..be6d192 100644 --- a/recipes-qt/qt6/qtbase_git.bb +++ b/recipes-qt/qt6/qtbase_git.bb @@ -15,7 +15,7 @@ LIC_FILES_CHKSUM = " \ file://LICENSES/Qt-GPL-exception-1.0.txt;md5=9a13522cd91a88fba784baf16ea66af8 \ " -inherit qt6-cmake +inherit qt6-cmake verify-qt-version include recipes-qt/qt6/qt6-git.inc include recipes-qt/qt6/qt6.inc