commit:     ed1caa33d0a89959c8edd0a3e8495ce0ff0ad022
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  4 02:32:39 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Tue Sep  5 13:01:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed1caa33

qt6-build.eclass: re-arrange QT6_BUILD_TYPE, add pre-release

If add _beta and _rc odds are will not want them keyworded by
default, but == release will keyword them all the same so need
something different. If do want to keyword or match both for
one reason or another, can still do == *release.

Re-arranged to avoid repeating SRC_URI/QT6_P/S/etc... albeit it does
make it a bit less clear (then again there's not much going on there).
Also lets us merge the inherit block from below and inherit earlier
for less SRC_URI+S inherit environment pollution.

Also document QT6_BUILD_TYPE for EclassDocMissingVar.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 eclass/qt6-build.eclass | 54 ++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index 7978a25f8eac..11e9844346a4 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -30,41 +30,39 @@ inherit cmake flag-o-matic toolchain-funcs
 # Used for SRC_URI and EGIT_REPO_URI.
 : "${QT6_MODULE:=${PN}}"
 
-case ${PV} in
-       6.9999)
-               # git dev branch
-               readonly QT6_BUILD_TYPE=live
-               EGIT_BRANCH=dev
-               ;;
-       6.*.9999)
-               # git stable branch
-               readonly QT6_BUILD_TYPE=live
-               EGIT_BRANCH=${PV%.9999}
-               ;;
-       *_alpha*|*_beta*|*_rc*)
-               # development release
-               readonly QT6_BUILD_TYPE=release
-               QT6_P=${QT6_MODULE}-everywhere-src-${PV/_/-}
-               
SRC_URI="https://download.qt.io/development_releases/qt/${PV%.*}/${PV/_/-}/submodules/${QT6_P}.tar.xz";
-               S=${WORKDIR}/${QT6_P}
-               ;;
-       *)
-               # official stable release
-               readonly QT6_BUILD_TYPE=release
-               QT6_P=${QT6_MODULE}-everywhere-src-${PV}
-               
SRC_URI="https://download.qt.io/official_releases/qt/${PV%.*}/${PV}/submodules/${QT6_P}.tar.xz";
-               S=${WORKDIR}/${QT6_P}
-               ;;
-esac
-unset QT6_P
+# @ECLASS_VARIABLE: QT6_BUILD_TYPE
+# @DESCRIPTION:
+# Read only variable set based on PV to one of:
+#  - release: official 6.x.x releases
+#  - pre-release: development 6.x.x_rc/beta/alpha releases
+#  - live: *.9999 (dev branch), 6.x.9999 (stable branch)
 
-if [[ ${QT6_BUILD_TYPE} == live ]]; then
+if [[ ${PV} == *.9999 ]]; then
        inherit git-r3
        EGIT_REPO_URI=(
                "https://code.qt.io/qt/${QT6_MODULE}.git";
                "https://github.com/qt/${QT6_MODULE}.git";
        )
+
+       QT6_BUILD_TYPE=live
+       EGIT_BRANCH=dev
+       [[ ${PV} == 6.*.9999 ]] && EGIT_BRANCH=${PV%.9999}
+else
+       QT6_BUILD_TYPE=release
+       _QT6_SRC=official
+
+       if [[ ${PV} == *_@(alpha|beta|rc)* ]]; then
+               QT6_BUILD_TYPE=pre-release
+               _QT6_SRC=development
+       fi
+
+       _QT6_P=${QT6_MODULE}-everywhere-src-${PV/_/-}
+       
SRC_URI="https://download.qt.io/${_QT6_SRC}_releases/qt/${PV%.*}/${PV/_/-}/submodules/${_QT6_P}.tar.xz";
+       S=${WORKDIR}/${_QT6_P}
+
+       unset _QT6_P _QT6_SRC
 fi
+readonly QT6_BUILD_TYPE
 
 HOMEPAGE="https://www.qt.io/";
 LICENSE="|| ( GPL-2 GPL-3 LGPL-3 ) FDL-1.3"

Reply via email to