Blame subr/pkg_configure_patch.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
pkg_configure_patch() {
Lucio Andrés Illanes Albornoz 2c5ce2
	local	_patch_cwd="" _patch_dir="${MIDIPIX_BUILD_PWD}/patches" _patch_fname=""\
Lucio Andrés Illanes Albornoz 30b734
		_patches_done="" _pkg_name_full="${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}"\
Lucio Andrés Illanes Albornoz 30b734
		_strip_count=0;
Lucio Andrés Illanes Albornoz 2c5ce2
Lucio Andrés Illanes Albornoz 84398b
	if [ -n "${PKG_FNAME:-}" ]\
Lucio Andrés Illanes Albornoz 84398b
	&& [ -n "${PKG_URLS_GIT:-}" ]; then
Lucio Andrés Illanes Albornoz 30b734
		_patch_cwd="${PKG_BASE_DIR}"; _strip_count=0;
Lucio Andrés Illanes Albornoz 2c5ce2
	else
Lucio Andrés Illanes Albornoz 30b734
		_patch_cwd="${PKG_BASE_DIR}/${PKG_SUBDIR}"; _strip_count=1;
Lucio Andrés Illanes Albornoz 2c5ce2
	fi;
Lucio Andrés Illanes Albornoz 2b85d0
	set +o noglob;
Lucio Andrés Illanes Albornoz 2b85d0
	for _patch_fname in \
Lucio Andrés Illanes Albornoz 2b85d0
			"${_patch_dir}/${_pkg_name}/"*.patch				\
Lucio Andrés Illanes Albornoz 2b85d0
			"${_patch_dir}/${_pkg_name_full}.local.patch"			\
Lucio Andrés Illanes Albornoz 2b85d0
			"${_patch_dir}/${_pkg_name_full}.local@${BUILD_HNAME}.patch"	\
Lucio Andrés Illanes Albornoz e1d469
			${PKG_PATCHES_EXTRA:-}; do
Lucio Andrés Illanes Albornoz (arab, vxp) 0ddc1e
		if [ -r "${_patch_fname}" ]\
Lucio Andrés Illanes Albornoz c6d6e0
		&& ! rtl_lmatch "${_patches_done}" "${_patch_fname}"; then
Lucio Andrés Illanes Albornoz 30b734
			if ! patch -b -d "${_patch_cwd}" "-p${_strip_count}" < "${_patch_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
				set -o noglob; return 1;
Lucio Andrés Illanes Albornoz bf9edf
			else
Lucio Andrés Illanes Albornoz bf9edf
				_patches_done="$(rtl_lconcat "${_patches_done}" "${_patch_fname}")";
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 0ddc1e
	done; set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh