summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2015-04-03 17:58:19 +0300
committerBlackNoxis <steven.darklight@gmail.com>2015-04-03 17:58:19 +0300
commit4ac606d81cabc453048a467a48ac1e47d4ea465e (patch)
treeb3ea46e6cbec1cfb0249c8c86247e3acd9d7f058
parentae84cd5a880c78b91246cd982df544338d92ab2a (diff)
[eclass/sab-patches.eclass] upgrade the eclass
-rw-r--r--eclass/sab-patches.eclass34
1 files changed, 29 insertions, 5 deletions
diff --git a/eclass/sab-patches.eclass b/eclass/sab-patches.eclass
index 8511256e..40e89911 100644
--- a/eclass/sab-patches.eclass
+++ b/eclass/sab-patches.eclass
@@ -9,10 +9,13 @@
# SÅ‚awomir Nizio <slawomir.nizio@sabayon.org>
# @BLURB: eclass that makes it easier to apply patches from multiple packages
# @DESCRIPTION:
-# Adds a patch or patches to SRC_URI and makes it easy to apply them,
+# Makes it easy to apply patches stored in a remote location
# with the intention to make the task easier for Sabayon split ebuilds.
# (Plain patches kept in a VCS are very nice, but in the case of split
# ebuilds, duplicating the patches is not effective.)
+# Patches are not added to SRC_URI by default, because it makes ebuilds
+# use "SRC_URI+=..." which makes them more diverged from the original
+# one than necessary.
# The eclass does not define any phase function.
# @ECLASS-VARIABLE: SAB_PATCHES_SRC
@@ -31,10 +34,16 @@ if [[ ${#SAB_PATCHES_SRC[@]} -eq 0 ]]; then
die "SAB_PATCHES_SRC is not set"
fi
-for _sab_patch in "${SAB_PATCHES_SRC[@]}"; do
- SRC_URI=${_sab_patch}
-done
-unset _sab_patch
+# @FUNCTION: sab-patches_update_SRC_URI
+# @DESCRIPTION:
+# Appends patches entries to SRC_URI. If it is not done, an error will
+# occur later on.
+sab-patches_update_SRC_URI() {
+ local p
+ for p in "${SAB_PATCHES_SRC[@]}"; do
+ SRC_URI+=${SRC_URI:+ }${p}
+ done
+}
# @FUNCTION: sab-patches_apply_all
# @DESCRIPTION:
@@ -75,6 +84,21 @@ sab-patches_apply() {
done
}
+# @FUNCTION: sab-patches_unpack
+# @DESCRIPTION:
+# Unpack every file provided in SAB_PATCHES_SRC.
+sab-patches_unpack() {
+ local p
+ pushd "${WORKDIR}" > /dev/null || die
+
+ for p in "${SAB_PATCHES_SRC[@]}"; do
+ local name=${p##*/}
+ unpack "${name}"
+ done
+
+ popd > /dev/null || die
+}
+
# @FUNCTION: _sab-patches_apply_nonskipped
# @INTERNAL
# @DESCRIPTION: