commit: 8e58d2aed3a7f368d881727bef854a22ff7c18af
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 2 07:36:32 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 2 07:37:37 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e58d2ae
toolchain.eclass: add variable to force fetching patches from git
Useful for pre-release snapshots of a new release series.
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain.eclass | 52 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 90e596f94561..4db0acd592a5 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -35,6 +35,8 @@ if tc_is_live ; then
EGIT_BRANCH="releases/${PN}-${PV%.?.?_pre9999}"
EGIT_BRANCH=${EGIT_BRANCH//./_}
inherit git-r3
+elif [[ -n ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+ inherit git-r3
fi
FEATURES=${FEATURES/multilib-strict/}
@@ -79,6 +81,15 @@ tc_version_is_between() {
# Used to override GCC version. Useful for e.g. live ebuilds or snapshots.
# Defaults to ${PV}.
+# @ECLASS_VARIABLE: TOOLCHAIN_USE_GIT_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Used to force fetching patches from git. Useful for non-released versions
+# of GCC where we don't want to keep creating patchset tarballs for a new
+# release series (e.g. suppose 12.0 just got released, then adding snapshots
+# for 13.0, we don't want to create new patchsets for every single 13.0
snapshot,
+# so just grab patches from git each time if this variable is set).
+
# @ECLASS_VARIABLE: GCC_PV
# @INTERNAL
# @DESCRIPTION:
@@ -502,29 +513,40 @@ toolchain_pkg_setup() {
#---->> src_unpack <<----
+# @FUNCTION: toolchain_fetch_git_patches
+# @INTERNAL
+# @DESCRIPTION:
+# Fetch patches from Gentoo's gcc-patches repository.
+toolchain_fetch_git_patches() {
+ local
gcc_patches_repo="https://anongit.gentoo.org/git/proj/gcc-patches.git
https://github.com/gentoo/gcc-patches"
+
+ # If we weren't given a patchset number, pull it from git too.
+ einfo "Fetching patchset from git as PATCH_VER is unset"
+ EGIT_REPO_URI=${gcc_patches_repo} EGIT_BRANCH="master" \
+ EGIT_CHECKOUT_DIR="${WORKDIR}"/patch.tmp \
+ git-r3_src_unpack
+
+ mkdir "${WORKDIR}"/patch || die
+ mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/gentoo/* "${WORKDIR}"/patch
|| die
+
+ if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ ${CTARGET} ==
*musl* ]] ; then
+ mkdir "${WORKDIR}"/musl || die
+ mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/*
"${WORKDIR}"/musl || die
+ fi
+}
+
toolchain_src_unpack() {
if tc_is_live ; then
git-r3_src_unpack
if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then
- local
gcc_patches_repo="https://anongit.gentoo.org/git/proj/gcc-patches.git
https://github.com/gentoo/gcc-patches"
- # If we weren't given a patchset number, pull it from
git too.
- einfo "Fetching patchset from git as PATCH_VER is unset"
- EGIT_REPO_URI=${gcc_patches_repo} EGIT_BRANCH="master" \
- EGIT_CHECKOUT_DIR="${WORKDIR}"/patch.tmp \
- git-r3_src_unpack
-
- mkdir "${WORKDIR}"/patch || die
- mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/gentoo/*
"${WORKDIR}"/patch || die
-
- if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[
${CTARGET} == *musl* ]] ; then
- mkdir "${WORKDIR}"/musl || die
- mv
"${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/* "${WORKDIR}"/musl || die
- fi
+ toolchain_fetch_git_patches
fi
+ elif [[ -z ${PATCH_VER} && -n ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+ toolchain_fetch_git_patches
fi
- default_src_unpack
+ default
}
#---->> src_prepare <<----