From d7ee16cb2872812cf61ad51469c748df17553c37 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Wed, 6 Jun 2018 00:50:36 -0700 Subject: [PATCH] Make patch order overridable by individual packages Signed-off-by: Alexey Neyman --- config/global/extract.in | 18 +++++-------- maintainer/kconfig-versions.template | 40 ++++++++++++++++++++++++++++ scripts/functions | 11 +++++--- 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/config/global/extract.in b/config/global/extract.in index 58f7b956..ba7f5f4c 100644 --- a/config/global/extract.in +++ b/config/global/extract.in @@ -40,19 +40,16 @@ config ONLY_EXTRACT Useful to look at the code before doing the build itself. choice - prompt "Patches origin" - bool + bool "Patches origin" default PATCH_BUNDLED config PATCH_BUNDLED - bool - prompt "Bundled only" + bool "Bundled only" help Only apply patches bundled with crosstool-NG. config PATCH_LOCAL - bool - prompt "Local only (EXPERIMENTAL)" + bool "Local only" select PATCH_USE_LOCAL depends on EXPERIMENTAL help @@ -61,16 +58,14 @@ config PATCH_LOCAL copy them into your local directory if needed. config PATCH_BUNDLED_LOCAL - bool - prompt "Bundled, then local" + bool "Bundled, then local" select PATCH_USE_LOCAL help Apply the patches bundled with crosstool-NG, then apply your local patches. config PATCH_LOCAL_BUNDLED - bool - prompt "Local, then bundled" + bool "Local, then bundled" select PATCH_USE_LOCAL depends on EXPERIMENTAL help @@ -79,8 +74,7 @@ config PATCH_LOCAL_BUNDLED to apply on top of your local patches. config PATCH_NONE - bool - prompt "None" + bool "None" depends on EXPERIMENTAL help Don't use any patch at all. diff --git a/maintainer/kconfig-versions.template b/maintainer/kconfig-versions.template index d5d4cc83..3db512e2 100644 --- a/maintainer/kconfig-versions.template +++ b/maintainer/kconfig-versions.template @@ -1,3 +1,5 @@ +#!// This file is not automatically generated, but we want this banner to +#!// appear in the files produced from it. # # DO NOT EDIT! This file is automatically generated. # @@ -167,6 +169,44 @@ endif endchoice +if EXPERIMENTAL +choice + bool "@@pkg_label@@ patches origin" + default @@fork|@@_PATCH_GLOBAL + +config @@fork|@@_PATCH_GLOBAL + bool "Per global policy" + +config @@fork|@@_PATCH_BUNDLED + bool "Bundled only" + +config @@fork|@@_PATCH_LOCAL + bool "Local only" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_BUNDLED_LOCAL + bool "Bundled, then local" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_LOCAL_BUNDLED + bool "Local, then bundled" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_NONE + bool "None" + +endchoice +endif + +config @@fork|@@_PATCH_ORDER + string + default "bundled" if @@fork|@@_PATCH_BUNDLED + default "local" if @@fork|@@_PATCH_LOCAL + default "bundled,local" if @@fork|@@_PATCH_BUNDLED_LOCAL + default "local,bundled" if @@fork|@@_PATCH_LOCAL_BUNDLED + default "none" if @@fork|@@_PATCH_NONE + default "global" + #!// Below, we explicitly select all milestones to which a given version #!// compares greater-or-equal. We don't select just the latest applicable #!// (and letting milestones chain-select each other, with FOO_6_or_later diff --git a/scripts/functions b/scripts/functions index 81f96d9b..2267a957 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1898,7 +1898,7 @@ CT_PackageRun() for v in basename pkg_name version pkg_dir \ src_release mirrors archive_filename archive_dirname archive_formats signature_format \ src_devel devel_vcs devel_url devel_branch devel_revision devel_subdir devel_bootstrap \ - src_custom custom_location; do + src_custom custom_location patch_order; do eval "local ${v}=\${CT_${use}_${v^^}}" done @@ -2056,6 +2056,11 @@ CT_DoExtractPatch() local local_patch_dir local overlay + # Inherit global value if requested + if [ "${patch_order}" = "global" ]; then + patch_order="${CT_PATCH_ORDER}" + fi + # If using overlay, prepare it first - we need to determine where to unpack # this component. if [ "${CT_TARGET_USE_OVERLAY}" = "y" -a ! -d "${CT_BUILD_DIR}/overlay" ]; then @@ -2072,7 +2077,7 @@ CT_DoExtractPatch() # and no overlays. Otherwise, this source directory is custom-tailored for this # particular configuration and cannot be reused by different configurations. if [ "${src_custom}" != "y" -a \ - "${CT_PATCH_ORDER}" = "bundled" -a \ + "${patch_order}" = "bundled" -a \ ! -d "${CT_BUILD_DIR}/overlay/${dir_name}" ]; then src_dir="${CT_COMMON_SRC_DIR}" else @@ -2121,7 +2126,7 @@ CT_DoExtractPatch() bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}" local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}" - case "${CT_PATCH_ORDER}" in + case "${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}");;