#
# set +o errexit -o noglob -o nounset is assumed.
#
pkg_configure_patch() {
local _pcp_group_name="${1}" _pcp_pkg_name="${2}" _pcp_restart_at="${3}" \
_pcp_patch_cwd="" _pcp_patch_dir="${MIDIPIX_BUILD_PWD}/patches" \
_pcp_patch_fname="" _pcp_patches_done="" _pcp_pkg_name_full="" \
_pcp_strip_count=0;
_pcp_pkg_name_full="${_pcp_pkg_name}${PKG_VERSION:+-${PKG_VERSION}}";
if [ "${PKG_FNAME:+1}" = 1 ]\
&& [ "${PKG_URLS_GIT:+1}" = 1 ];
then
_pcp_patch_cwd="${PKG_BASE_DIR}";
_pcp_strip_count=0;
else
_pcp_patch_cwd="${PKG_BASE_DIR}/${PKG_SUBDIR}";
_pcp_strip_count=1;
fi;
set +o noglob;
for _pcp_patch_fname in \
"${_pcp_patch_dir}/${PKG_NAME}/"*.patch \
"${_pcp_patch_dir}/${_pcp_pkg_name_full}.local.patch" \
"${_pcp_patch_dir}/${_pcp_pkg_name_full}.local@${BUILD_HNAME}.patch" \
${PKG_PATCHES_EXTRA:-};
do
if [ -r "${_pcp_patch_fname}" ]\
&& ! rtl_lmatch \$_pcp_patches_done "${_pcp_patch_fname}";
then
if ! patch -b -d "${_pcp_patch_cwd}" "-p${_pcp_strip_count}" < "${_pcp_patch_fname}"; then
set -o noglob; return 1;
else
rtl_lconcat \$_pcp_patches_done "${_pcp_patch_fname}";
fi;
fi;
done;
set -o noglob;
return 0;
};
# vim:filetype=sh