From 8b23026d6cbd909069046dbe76a85c919a053da0 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Thu, 16 May 2013 15:17:13 +0900 Subject: [PATCH] add PACKAGE_PATCH_STRIP to support optional strip number of patch --- plugins/python-build/bin/python-build | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index d867ea93..5a60c95b 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -140,10 +140,17 @@ install_package_using() { apply_patches() { local package_name="$1" local patches_path="${PYTHON_BUILD_ROOT}/share/python-build/patches/${DEFINITION_PATH##*/}" + + # Support PYTHON_PATCH_STRIP, etc. + local package_var_name="$(capitalize "${package_name%%-*}")" + local PACKAGE_PATCH_STRIP="${package_var_name}_PATCH_STRIP" + for patch in "${patches_path}/${package_name}/"*; do if [ -f "$patch" ]; then - echo "Applying ${patch##*/} to ${package_name}..." >&2 - patch -p0 < "$patch" + { + echo "Applying ${patch##*/} to ${package_name}..." + patch "-p${!PACKAGE_PATCH_STRIP:-0}" < "$patch" + } >&4 2>&1 fi done }