Add option for experimental bundled patches

This adds 3 new options to patch order:
* bundled + bundled_exp
* bundled + bundled_exp + local
* local + bundled + bundled_exp

The path for bundled experimental patches is: ${CT_LIB_DIR}/packages/${pkg_dir}/experimental
and patches that are still being reviewed, but not yet applied upstream
may be toggled with ENABLE_EXPERIMENTAL_BUNDLED_PATCHES.

Also fix modelines for editors on bootstrap and scripts/functions, and
fix mix whitespace in scripts/functions.

Closes: #1916

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
This commit is contained in:
Bryan Hundven
2023-03-09 21:52:19 -08:00
committed by Chris Packham
parent fa05153eba
commit db942c3d0d
4 changed files with 76 additions and 29 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# -*- mode: bash; tab-width: 4 -*-
# vi: ts=4:sw=4:et # vi: ts=4:sw=4:et
# vim: filetype=bash
if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then if [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
echo "Your BASH shell version (${BASH_VERSION}) is too old." >&2 echo "Your BASH shell version (${BASH_VERSION}) is too old." >&2

View File

@ -60,6 +60,17 @@ config ALLOW_BUILD_AS_ROOT_SURE
prompt "Are you sure?" prompt "Are you sure?"
depends on ALLOW_BUILD_AS_ROOT depends on ALLOW_BUILD_AS_ROOT
config ENABLE_EXPERIMENTAL_BUNDLED_PATCHES
bool
default n
depends on EXPERIMENTAL
prompt "Enable Experimental Bundled Patches"
help
This option is for advanced users or special senarios where a
patch has been submitted upstream, but still not reviewed
or applied yet, but fix an issue with a package or feature that
is also marked experimental.
config DEBUG_CT config DEBUG_CT
bool bool
prompt "Debug crosstool-NG" prompt "Debug crosstool-NG"

View File

@ -48,6 +48,12 @@ config PATCH_BUNDLED
help help
Only apply patches bundled with crosstool-NG. Only apply patches bundled with crosstool-NG.
config PATCH_BUNDLED_EXP
bool "Bundled, then experimental bundled"
depends on ENABLE_EXPERIMENTAL_BUNDLED_PATCHES
help
Apply the bundled patches, and experimental bundled patches.
config PATCH_LOCAL config PATCH_LOCAL
bool "Local only" bool "Local only"
select PATCH_USE_LOCAL select PATCH_USE_LOCAL
@ -64,6 +70,15 @@ config PATCH_BUNDLED_LOCAL
Apply the patches bundled with crosstool-NG, then apply your local Apply the patches bundled with crosstool-NG, then apply your local
patches. patches.
config PATCH_BUNDLED_EXP_LOCAL
bool "Bundled, then experimental bundled, then local"
select PATCH_USE_LOCAL
depends on ENABLE_EXPERIMENTAL_BUNDLED_PATCHES
help
Apply the patches bundled with crosstool-NG, then apply the
experimental patches bundled with crosstool-NG, then apply
your local patches.
config PATCH_LOCAL_BUNDLED config PATCH_LOCAL_BUNDLED
bool "Local, then bundled" bool "Local, then bundled"
select PATCH_USE_LOCAL select PATCH_USE_LOCAL
@ -73,6 +88,16 @@ config PATCH_LOCAL_BUNDLED
crosstool-NG. Note that the bundled patches cannot be guaranteed crosstool-NG. Note that the bundled patches cannot be guaranteed
to apply on top of your local patches. to apply on top of your local patches.
config PATCH_LOCAL_BUNDLED_EXP
bool "Local, then bundled, then experimental bunlded"
select PATCH_USE_LOCAL
depends on ENABLE_EXPERIMENTAL_BUNDLED_PATCHES
help
Apply your local patches, then apply the patches bundled with
crosstool-NG, then apply the experimental patches bundled with
crosstool-NG. Note that the bundled patches cannot be guaranteed
to apply on top of your local patches.
config PATCH_NONE config PATCH_NONE
bool "None" bool "None"
depends on EXPERIMENTAL depends on EXPERIMENTAL
@ -90,11 +115,14 @@ endchoice
config PATCH_ORDER config PATCH_ORDER
string string
default "bundled" if PATCH_BUNDLED default "bundled" if PATCH_BUNDLED
default "local" if PATCH_LOCAL default "local" if PATCH_LOCAL
default "bundled,local" if PATCH_BUNDLED_LOCAL default "bundled,local" if PATCH_BUNDLED_LOCAL
default "local,bundled" if PATCH_LOCAL_BUNDLED default "local,bundled" if PATCH_LOCAL_BUNDLED
default "none" if PATCH_NONE default "bundled,bundled_exp" if PATCH_BUNDLED_EXP
default "bundled,bundled_exp,local" if PATCH_BUNDLED_EXP_LOCAL
default "local,bundled,bundled_exp" if PATCH_LOCAL_BUNDLED_EXP
default "none" if PATCH_NONE
config PATCH_USE_LOCAL config PATCH_USE_LOCAL
bool bool

View File

@ -1,6 +1,6 @@
# -*- mode: sh; tab-width: 4 -*- # -*- mode: bash; tab-width: 4 -*-
# vi: ts=4:sw=4:sts=4:et # vi: ts=4:sw=4:sts=4:et
# vim: filetype=sh : # vim: filetype=bash
# This file contains some useful common functions # This file contains some useful common functions
# Copyright 2007 Yann E. MORIN # Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package # Licensed under the GPL v2. See COPYING in the root of this package
@ -174,8 +174,9 @@ CT_OnError() {
CT_DoLog ERROR ">> NOTE: You configuration uses non-default patch sets. Please" CT_DoLog ERROR ">> NOTE: You configuration uses non-default patch sets. Please"
CT_DoLog ERROR ">> select 'bundled' as the set of patches applied and attempt" CT_DoLog ERROR ">> select 'bundled' as the set of patches applied and attempt"
CT_DoLog ERROR ">> to reproduce this issue. Issues reported with other patch" CT_DoLog ERROR ">> to reproduce this issue. Issues reported with other patch"
CT_DoLog ERROR ">> set selections (none, local, bundled+local) are going to be" CT_DoLog ERROR ">> set selections (none, local, bundled+local,"
CT_DoLog ERROR ">> closed without explanation." CT_DoLog ERROR ">> bundled+bundled_exp bundled+bundled_exp+local) are going to"
CT_DoLog ERROR ">> be closed without explanation."
CT_DoLog ERROR ">>" CT_DoLog ERROR ">>"
fi fi
CT_DoLog ERROR ">> If you feel this is a bug in crosstool-NG, report it at:" CT_DoLog ERROR ">> If you feel this is a bug in crosstool-NG, report it at:"
@ -214,23 +215,23 @@ set +o hashall
# FIXME: it doesn't look like anyone is overriding stdin/stderr. Do we need # FIXME: it doesn't look like anyone is overriding stdin/stderr. Do we need
# to save/restore them? # to save/restore them?
CT_LogEnable() { CT_LogEnable() {
local clean=no local clean=no
local arg local arg
for arg in "$@"; do eval "$arg"; done for arg in "$@"; do eval "$arg"; done
exec 6>&1 7>&2 8<&0 exec 6>&1 7>&2 8<&0
CT_BUILD_LOG="${CT_TOP_DIR}/build.log" CT_BUILD_LOG="${CT_TOP_DIR}/build.log"
CT_LOG_ENABLED=y CT_LOG_ENABLED=y
if [ "$clean" = "yes" ]; then if [ "$clean" = "yes" ]; then
rm -f "${CT_BUILD_LOG}" rm -f "${CT_BUILD_LOG}"
fi fi
exec >>"${CT_BUILD_LOG}" exec >>"${CT_BUILD_LOG}"
} }
# Restore original stdout, stderr and stdin # Restore original stdout, stderr and stdin
CT_LogDisable() { CT_LogDisable() {
exec >&6 2>&7 <&8 exec >&6 2>&7 <&8
CT_LOG_ENABLED= CT_LOG_ENABLED=
} }
# The different log levels: # The different log levels:
@ -1352,7 +1353,7 @@ CT_DoExtractTarballIfExists() {
# at any one point # at any one point
# Usage: CT_DoSaveState <next_step_name> # Usage: CT_DoSaveState <next_step_name>
CT_DoSaveState() { CT_DoSaveState() {
[ "${CT_DEBUG_CT_SAVE_STEPS}" = "y" ] || return 0 [ "${CT_DEBUG_CT_SAVE_STEPS}" = "y" ] || return 0
local state_name="$1" local state_name="$1"
local state_dir="${CT_STATE_DIR}/${state_name}" local state_dir="${CT_STATE_DIR}/${state_name}"
local v local v
@ -2237,6 +2238,7 @@ CT_DoExtractPatch()
local archive ext local archive ext
local -a patch_dirs local -a patch_dirs
local bundled_patch_dir local bundled_patch_dir
local bundled_exp_patch_dir
local bundled_common_patch_dir local bundled_common_patch_dir
local local_patch_dir local local_patch_dir
local local_common_patch_dir local local_common_patch_dir
@ -2265,9 +2267,9 @@ CT_DoExtractPatch()
# Can use common location only if using non-custom source, only bundled patches # Can use common location only if using non-custom source, only bundled patches
# and no overlays. Otherwise, this source directory is custom-tailored for this # and no overlays. Otherwise, this source directory is custom-tailored for this
# particular configuration and cannot be reused by different configurations. # particular configuration and cannot be reused by different configurations.
if [ "${src_custom}" != "y" -a \ if test "${src_custom}" != "y" -a \
"${patch_order}" = "bundled" -a \ \( "${patch_order}" = 'bundled' -o "${patch_order}" = 'bundled,bundled_exp' \) -a \
! -d "${CT_BUILD_DIR}/overlay/${dir_name}" ]; then ! -d "${CT_BUILD_DIR}/overlay/${dir_name}"; then
src_dir="${CT_COMMON_SRC_DIR}" src_dir="${CT_COMMON_SRC_DIR}"
else else
src_dir="${CT_SRC_DIR}" src_dir="${CT_SRC_DIR}"
@ -2314,16 +2316,20 @@ CT_DoExtractPatch()
CT_DoExecLog ALL touch "${src_dir}/.${basename}.patching" CT_DoExecLog ALL touch "${src_dir}/.${basename}.patching"
bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}" bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}"
bundled_exp_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}/experimental"
bundled_common_patch_dir="${CT_LIB_DIR}/packages/${pkg_name}" bundled_common_patch_dir="${CT_LIB_DIR}/packages/${pkg_name}"
local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}" local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}"
local_common_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_name}" local_common_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_name}"
case "${patch_order}" in case "${patch_order}" in
bundled) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}");; bundled) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}");;
local) patch_dirs=("${local_patch_dir}" "${local_common_patch_dir}");; local) patch_dirs=("${local_patch_dir}" "${local_common_patch_dir}");;
bundled,local) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}" "${local_patch_dir}" "${local_common_patch_dir}");; bundled,local) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}" "${local_patch_dir}" "${local_common_patch_dir}");;
local,bundled) patch_dirs=("${local_patch_dir}" "${local_common_patch_dir}" "${bundled_patch_dir}" "${bundled_common_patch_dir}");; local,bundled) patch_dirs=("${local_patch_dir}" "${local_common_patch_dir}" "${bundled_patch_dir}" "${bundled_common_patch_dir}");;
none) patch_dirs=;; bundled,bundled_exp) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}" "${bundled_exp_patch_dir}");;
bundled,bundled_exp,local) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}" "${bundled_exp_patch_dir}" "${local_patch_dir}" "${local_common_patch_dir}");;
local,bundled,bundled_exp) patch_dirs=("${local_patch_dir}" "${local_common_patch_dir}" "${bundled_patch_dir}" "${bundled_common_patch_dir}" "${bundled_exp_patch_dir}");;
none) patch_dirs=;;
esac esac
CT_Pushd "${src_dir}/${basename}" CT_Pushd "${src_dir}/${basename}"