diff mbox

[1/3] Add main EXPERIMENTAL_PATCHES setting

Message ID 1406423095-18198-2-git-send-email-bryanhundven@gmail.com
State Superseded
Headers show

Commit Message

Bryan Hundven July 27, 2014, 1:04 a.m. UTC
This change adds support for experimental patches to be introduced to
crosstool-ng. The patches enabled by this option are to be located here:

    patches/experimental/<package>/<version>/XXXX-NAME.patch

Where, XXXX is the patch number to be applied in order, like:
    0001-some_patch_one.patch
    0002-some_patch_two.patch
    9999-some_patch_to_be_applied_last.patch

In the first patch series, all patches in the EXPERIMENTAL_PATCHES
option will be applied all at once, or none at all.

In a later [RFC] patch, I plan on adding finer tuned patch
enable/disable options based on the name of the patch and where it is
located in the patches/experimental sub-tree. So the name of the patch
should use underscores between words in the patch name.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
---
 config/global/ct-behave.in | 10 ++++++++++
 scripts/functions          | 16 ++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

Comments

Yann E. MORIN July 27, 2014, 11:23 p.m. UTC | #1
Bryan, All,

On 2014-07-26 18:04 -0700, Bryan Hundven spake thusly:
> This change adds support for experimental patches to be introduced to
> crosstool-ng. The patches enabled by this option are to be located here:
> 
>     patches/experimental/<package>/<version>/XXXX-NAME.patch
> 
> Where, XXXX is the patch number to be applied in order, like:
>     0001-some_patch_one.patch
>     0002-some_patch_two.patch
>     9999-some_patch_to_be_applied_last.patch
> 
> In the first patch series, all patches in the EXPERIMENTAL_PATCHES
> option will be applied all at once, or none at all.
> 
> In a later [RFC] patch, I plan on adding finer tuned patch
> enable/disable options based on the name of the patch and where it is
> located in the patches/experimental sub-tree. So the name of the patch
> should use underscores between words in the patch name.
> 
> Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>

Applied, thanks!

I slightly tweaked the prompt, nothing important.

Regards,
Yann E. MORIN.

> ---
>  config/global/ct-behave.in | 10 ++++++++++
>  scripts/functions          | 16 ++++++++++++----
>  2 files changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/config/global/ct-behave.in b/config/global/ct-behave.in
> index ba723cf..9f3354f 100644
> --- a/config/global/ct-behave.in
> +++ b/config/global/ct-behave.in
> @@ -29,6 +29,16 @@ config EXPERIMENTAL
>          - non-existant, in which case you could also try hacking it in and send me
>            the result
>  
> +config EXPERIMENTAL_PATCHES
> +    bool
> +    depends on EXPERIMENTAL
> +    prompt "Enable patches marked as EXPERIMENTAL_PATCHES"
> +    help
> +        ***WARNING*** This is not supported by crosstool-ng! ***WARNING***
> +
> +        If you set this to Y, then you will be able to enable experimental
> +        patches that are not supported by crosstool-ng.
> +
>  config ALLOW_BUILD_AS_ROOT
>      bool
>      prompt "Allow building as root user (READ HELP!)"
> diff --git a/scripts/functions b/scripts/functions
> index b15601a..2e4d4fa 100644
> --- a/scripts/functions
> +++ b/scripts/functions
> @@ -1034,6 +1034,8 @@ CT_Patch() {
>      local -a patch_dirs
>      local bundled_patch_dir
>      local local_patch_dir
> +    local bundled_exp_patch_dir
> +    local local_exp_patch_dir
>  
>      if [ "${nochdir}" = "nochdir" ]; then
>          shift
> @@ -1072,11 +1074,17 @@ CT_Patch() {
>      bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}"
>      local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}"
>  
> +    # Check for experimental patches, if enabled.
> +    if [ "${CT_EXPERIMENTAL_PATCHES}" = "y" ]; then
> +        bundled_exp_patch_dir="${CT_LIB_DIR}/patches/experimental/${pkgname}/${version}"
> +        local_exp_patch_dir="${CT_LOCAL_PATCH_DIR}/experimental/${pkgname}/${version}"
> +    fi
> +
>      case "${CT_PATCH_ORDER}" in
> -        bundled)        patch_dirs=("${bundled_patch_dir}");;
> -        local)          patch_dirs=("${local_patch_dir}");;
> -        bundled,local)  patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");;
> -        local,bundled)  patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}");;
> +        bundled)        patch_dirs=("${bundled_patch_dir}" "${bundled_exp_patch_dir}");;
> +        local)          patch_dirs=("${local_patch_dir}" "${local_exp_patch_dir}");;
> +        bundled,local)  patch_dirs=("${bundled_patch_dir}" "${bundled_exp_patch_dir}" "${local_patch_dir}" "${local_exp_patch_dir}");;
> +        local,bundled)  patch_dirs=("${local_patch_dir}" "${local_exp_patch_dir}" "${bundled_patch_dir}" "${bundled_exp_patch_dir}");;
>          none)           patch_dirs=;;
>      esac
>  
> -- 
> 2.0.1
>
diff mbox

Patch

diff --git a/config/global/ct-behave.in b/config/global/ct-behave.in
index ba723cf..9f3354f 100644
--- a/config/global/ct-behave.in
+++ b/config/global/ct-behave.in
@@ -29,6 +29,16 @@  config EXPERIMENTAL
         - non-existant, in which case you could also try hacking it in and send me
           the result
 
+config EXPERIMENTAL_PATCHES
+    bool
+    depends on EXPERIMENTAL
+    prompt "Enable patches marked as EXPERIMENTAL_PATCHES"
+    help
+        ***WARNING*** This is not supported by crosstool-ng! ***WARNING***
+
+        If you set this to Y, then you will be able to enable experimental
+        patches that are not supported by crosstool-ng.
+
 config ALLOW_BUILD_AS_ROOT
     bool
     prompt "Allow building as root user (READ HELP!)"
diff --git a/scripts/functions b/scripts/functions
index b15601a..2e4d4fa 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1034,6 +1034,8 @@  CT_Patch() {
     local -a patch_dirs
     local bundled_patch_dir
     local local_patch_dir
+    local bundled_exp_patch_dir
+    local local_exp_patch_dir
 
     if [ "${nochdir}" = "nochdir" ]; then
         shift
@@ -1072,11 +1074,17 @@  CT_Patch() {
     bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}"
     local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}"
 
+    # Check for experimental patches, if enabled.
+    if [ "${CT_EXPERIMENTAL_PATCHES}" = "y" ]; then
+        bundled_exp_patch_dir="${CT_LIB_DIR}/patches/experimental/${pkgname}/${version}"
+        local_exp_patch_dir="${CT_LOCAL_PATCH_DIR}/experimental/${pkgname}/${version}"
+    fi
+
     case "${CT_PATCH_ORDER}" in
-        bundled)        patch_dirs=("${bundled_patch_dir}");;
-        local)          patch_dirs=("${local_patch_dir}");;
-        bundled,local)  patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");;
-        local,bundled)  patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}");;
+        bundled)        patch_dirs=("${bundled_patch_dir}" "${bundled_exp_patch_dir}");;
+        local)          patch_dirs=("${local_patch_dir}" "${local_exp_patch_dir}");;
+        bundled,local)  patch_dirs=("${bundled_patch_dir}" "${bundled_exp_patch_dir}" "${local_patch_dir}" "${local_exp_patch_dir}");;
+        local,bundled)  patch_dirs=("${local_patch_dir}" "${local_exp_patch_dir}" "${bundled_patch_dir}" "${bundled_exp_patch_dir}");;
         none)           patch_dirs=;;
     esac