summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentnl@gentoo.org>2017-01-24 12:18:16 +1300
committerKent Fredric <kentnl@gentoo.org>2017-04-22 09:30:59 +1200
commit41659bb9fd06af3429c1d81c80135c47908b57fd (patch)
tree04d0c8de04542c901640100f7b40a6e9e6cc48ef
parentperl-functions.eclass: add perl_get_raw_vendorlib (diff)
downloadgentoo-41659bb9fd06af3429c1d81c80135c47908b57fd.tar.gz
gentoo-41659bb9fd06af3429c1d81c80135c47908b57fd.tar.bz2
gentoo-41659bb9fd06af3429c1d81c80135c47908b57fd.zip
perl-functions.eclass: add perl_get_vendorlib
-rw-r--r--eclass/perl-functions.eclass21
1 files changed, 20 insertions, 1 deletions
diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass
index 5073215e0e72..6d2fa2eed69c 100644
--- a/eclass/perl-functions.eclass
+++ b/eclass/perl-functions.eclass
@@ -447,4 +447,23 @@ perl_get_raw_vendorlib() {
-e'exists $Config{$ARGV[0]} || die qq{No such Config key "$ARGV[0]"};
print $Config{$ARGV[0]};
exit 0' -- "installvendorlib" || die "Can't extract installvendorlib from Perl Configuration"
-} \ No newline at end of file
+}
+
+# @FUNCTION: perl_get_vendorlib
+# @USAGE: perl_get_vendorlib
+# @DESCRIPTION:
+#
+# Convenience helper for returning Perls' vendor install root
+# without EPREFIXing.
+perl_get_vendorlib() {
+ debug-print-function $FUNCNAME "$@"
+
+ [[ $# -lt 1 ]] || die "${FUNCNAME}: Too many parameters ($#)"
+
+ # Requires perl 5.14 for /r attribute of s///
+ # Just in case somebody out there is stuck in a time warp: upgrade perl first
+ perl -M5.014 -MConfig \
+ -e'exists $Config{$ARGV[0]} || die qq{No such Config key "$ARGV[0]"};
+ print $Config{$ARGV[0]} =~ s{\A\Q$ARGV[1]\E}{}r;
+ exit 0' -- "installvendorlib" "$EPREFIX" || die "Can't extract installvendorlib from Perl Configuration"
+}