summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2016-05-22 13:03:48 +0900
committerBenda Xu <heroxbd@gentoo.org>2016-05-22 13:03:48 +0900
commitda66246c68be060ea7484110fac298ac7fa4363d (patch)
tree9df179ea86b3a473f4695963aedcac37769d0179
parentRevert "prefix.eclass: merged" (diff)
downloadheroxbd-da66246c68be060ea7484110fac298ac7fa4363d.tar.gz
heroxbd-da66246c68be060ea7484110fac298ac7fa4363d.tar.bz2
heroxbd-da66246c68be060ea7484110fac298ac7fa4363d.zip
prefix.eclass: add eprefixify_patch.
-rw-r--r--eclass/prefix.eclass25
1 files changed, 25 insertions, 0 deletions
diff --git a/eclass/prefix.eclass b/eclass/prefix.eclass
index 1f3c4b0..101cce2 100644
--- a/eclass/prefix.eclass
+++ b/eclass/prefix.eclass
@@ -12,6 +12,8 @@
# located somewhere in the filesystem. Prefix ebuilds require
# additional functions and variables which are defined by this eclass.
+inherit eutils
+
# @ECLASS-VARIABLE: EPREFIX
# @DESCRIPTION:
# The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix
@@ -48,5 +50,28 @@ eprefixify() {
return 0
}
+# @FUNCTION: eprefixify_patch
+# @USAGE: <list of patch files to be eprefixified>
+# @DESCRIPTION:
+# copies the patch files to ${T} and eprefixify before applying.
+# dies if no arguments are given, a file does not exist, or changing a
+# file failed.
+eprefixity_patch() {
+ [[ $# -lt 1 ]] && die "at least one argument required"
+
+ local x f
+ for x in "$@" ; do
+ if [[ -e ${x} ]] ; then
+ f=${x##*/}
+ cp "${x}" "${T}" || die "failed to copy patch"
+ eprefixify "${T}"/${f}
+ epatch "${T}"/${f}
+ else
+ die "${x} does not exist"
+ fi
+ done
+
+ return 0
+}
# vim: tw=72: