* [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function
@ 2014-08-18 17:56 99% ` Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Add the eapply patch applying function.
---
bin/eapi.sh | 4 ++++
bin/phase-helpers.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/bin/eapi.sh b/bin/eapi.sh
index 978a410..8ffffbb 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -72,6 +72,10 @@ ___eapi_has_einstalldocs() {
[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
}
+___eapi_has_eapply() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
___eapi_has_master_repositories() {
[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
}
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6ccf4f4..6bd8a12 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -875,6 +875,58 @@ if ___eapi_has_einstalldocs; then
}
fi
+if ___eapi_has_eapply; then
+ eapply() {
+ _eapply_patch() {
+ started_applying=1
+ ebegin "Applying ${1#${top_dir}/}"
+ # -p1 as a sane default
+ # -f to avoid interactivity
+ # -s to silence progress output
+ patch -p1 -f -s "${patch_options[@]}" < "${1}"
+ if ! eend ${?}; then
+ __helpers_die "patch -p1 ${patch_options[*]} failed with ${1}"
+ failed=1
+ fi
+ }
+
+ local f patch_options=() failed started_applying options_terminated
+ for f; do
+ local top_dir=${f%/*}
+
+ if [[ ${f} == -* && -z ${options_terminated} ]]; then
+ if [[ -n ${started_applying} ]]; then
+ die "eapply: options need to be specified before files"
+ fi
+ if [[ ${f} == -- ]]; then
+ options_terminated=1
+ else
+ patch_options+=( ${f} )
+ fi
+ elif [[ -d ${f} ]]; then
+ local prev_shopt=$(shopt -p nullglob)
+ shopt -s nullglob
+ local files=( "${f}"/*.{patch,diff} )
+ ${prev_shopt}
+
+ [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}"
+
+ local f2
+ for f2 in "${files[@]}"; do
+ _eapply_patch "${f2}"
+ done
+ else
+ _eapply_patch "${f}"
+ fi
+
+ # in case of nonfatal
+ [[ -n ${failed} ]] && return 1
+ done
+
+ return 0
+ }
+fi
+
if ___eapi_has_master_repositories; then
master_repositories() {
local output repository=$1 retval
--
2.0.4
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
2014-08-18 17:56 99% ` [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox