public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: dilfridge@gentoo.org
To: gentoo-dev@lists.gentoo.org
Cc: "Andreas K. Hüttel" <dilfridge@gentoo.org>
Subject: [gentoo-dev] [PATCH 3/3] perl-module.eclass: Add EAPI=8 support
Date: Sat, 19 Jun 2021 13:01:52 +0200	[thread overview]
Message-ID: <20210619110152.54307-3-dilfridge@gentoo.org> (raw)
In-Reply-To: <20210619110152.54307-1-dilfridge@gentoo.org>

From: Andreas K. Hüttel <dilfridge@gentoo.org>

New features: DIST_WIKI and DIST_MAKE
File permissions are fixed on installation

Bug: https://bugs.gentoo.org/733020
Bug: https://bugs.gentoo.org/554346
Bug: https://bugs.gentoo.org/261375
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
 eclass/perl-module.eclass | 89 +++++++++++++++++++++++++++++++++------
 1 file changed, 76 insertions(+), 13 deletions(-)

diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
index 3f7e4100db07..6285e9363156 100644
--- a/eclass/perl-module.eclass
+++ b/eclass/perl-module.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Seemant Kulleen <seemant@gentoo.org>
 # Andreas K. Hüttel <dilfridge@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: eclass for installing Perl module distributions
 # @DESCRIPTION:
 # The perl-module eclass is designed to allow easier installation of Perl
@@ -27,6 +27,10 @@ case ${EAPI:-0} in
 		inherit multiprocessing perl-functions
 		PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
 		;;
+	8)
+		inherit multiprocessing perl-functions readme.gentoo-r1
+		PERL_EXPF="src_prepare src_configure src_compile src_test src_install"
+		;;
 	*)
 		die "EAPI=${EAPI} is not supported by perl-module.eclass"
 		;;
@@ -99,7 +103,7 @@ case ${EAPI:-0} in
 
 		EXPORT_FUNCTIONS ${PERL_EXPF}
 		;;
-	7)
+	*)
 		[[ ${CATEGORY} == perl-core ]] && \
 			PERL_EXPF+=" pkg_postinst pkg_postrm"
 
@@ -126,9 +130,6 @@ case ${EAPI:-0} in
 
 		EXPORT_FUNCTIONS ${PERL_EXPF}
 		;;
-	*)
-		die "EAPI=${EAPI:-0} is not supported by perl-module.eclass"
-		;;
 esac
 
 LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
@@ -180,6 +181,25 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
 # a use-flag examples, if not you'll have to add the useflag in your ebuild.
 # Examples are installed only if the useflag examples exists and is activated.
 
+# @ECLASS-VARIABLE: DIST_WIKI
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# (EAPI=8 and later) This variable can be set to contain space-separated keywords
+# corresponding to article sections in a maintenance notes wiki article. If a
+# keyword is set, an ebuild phase can output a message and a link to the wiki.
+# Current keywords as of EAPI=8 are:
+# * features: Notes about additional dependencies for optional features
+# * tests:    Notes about additional dependencies and preparations needed for testing
+
+# @ECLASS-VARIABLE: DIST_MAKE
+# @DESCRIPTION:
+# (EAPI=8 and later) This Bash array contains parameters to the make call
+# from ExtUtils::MakeMaker. Replaces mymake in EAPI=7 and earlier.
+# Defaults to ( OPTIMIZE="${CFLAGS}" )
+if [[ $(declare -p DIST_MAKE 2>&-) != "declare -a DIST_MAKE="* ]]; then
+	DIST_MAKE=( OPTIMIZE="${CFLAGS}" )
+fi
+
 
 if [[ ${EAPI:-0} == 5 ]]; then
 	if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
@@ -343,11 +363,18 @@ perl-module_src_compile() {
 	debug-print-function $FUNCNAME "$@"
 	perl_set_version
 
-	if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
-		local mymake_local=(${mymake})
-	else
-		local mymake_local=("${mymake[@]}")
-	fi
+	case ${EAPI} in
+		5|6|7)
+			if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
+				local mymake_local=(${mymake})
+			else
+				local mymake_local=("${mymake[@]}")
+			fi
+			;;
+		*)
+			local mymake_local=("${DIST_MAKE[@]}")
+			;;
+	esac
 
 	if [[ -f Build ]] ; then
 		./Build build \
@@ -396,7 +423,7 @@ perl-module_src_test() {
 	local my_test_control
 	local my_test_verbose
 
-	if [[ ${EAPI:-0} == 5 ]] ; then
+	if [[ ${EAPI} == 5 ]] ; then
 		my_test_control=${SRC_TEST}
 		my_test_verbose=${TEST_VERBOSE:-0}
 		if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then
@@ -434,6 +461,18 @@ perl-module_src_test() {
 		fi
 	fi
 
+	case ${EAPI} in
+		5|6|7)
+			;;
+		*)
+			if has 'tests' ${DIST_WIKI} ; then
+				ewarn "This package may require additional dependencies and/or preparation steps for"
+				ewarn "comprehensive testing. For details, see:"
+				ewarn "$(perl_get_wikiurl_tests)"
+			fi
+			;;
+	esac
+
 	perl_set_version
 	if [[ -f Build ]] ; then
 		./Build test verbose=${my_test_verbose} || die "test failed"
@@ -473,9 +512,17 @@ perl-module_src_install() {
 			|| die "emake ${myinst_local[@]} ${mytargets} failed"
 	fi
 
+	case ${EAPI} in
+		5|6|7)
+			;;
+		*)
+			perl_fix_permissions
+			;;
+	esac
+
 	perl_delete_module_manpages
 	perl_delete_localpod
-	if [[ ${EAPI:-0} == 5 ]] ; then
+	if [[ ${EAPI} == 5 ]] ; then
 		perl_delete_packlist
 	else
 		perl_fix_packlist
@@ -487,13 +534,29 @@ perl-module_src_install() {
 		[[ -s ${f} ]] && dodoc ${f}
 	done
 
-	if [[ ${EAPI:-0} != 5 ]] ; then
+	if [[ ${EAPI} != 5 ]] ; then
 		if in_iuse examples && use examples ; then
                         [[ ${#DIST_EXAMPLES[@]} -eq 0 ]] || perl_doexamples "${DIST_EXAMPLES[@]}"
 		fi
 	fi
 
 	perl_link_duallife_scripts
+
+	case ${EAPI} in
+		5|6|7)
+			;;
+		*)
+			if has 'features' ${DIST_WIKI} ; then
+				DISABLE_AUTOFORMATTING=yes
+				DOC_CONTENTS="This package may require additional dependencies and/or preparation steps for\n"
+				DOC_CONTENTS+="some optional features. For details, see\n"
+				DOC_CONTENTS+="$(perl_get_wikiurl_features)"
+				einfo
+				readme.gentoo_create_doc
+				readme.gentoo_print_elog
+			fi
+			;;
+	esac
 }
 
 # @FUNCTION: perl-module_pkg_postinst
-- 
2.31.1



  parent reply	other threads:[~2021-06-19 11:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 11:01 [gentoo-dev] [PATCH 1/3] readme.gentoo-r1.eclass: works just fine with EAPI=8 dilfridge
2021-06-19 11:01 ` [gentoo-dev] [PATCH 2/3] perl-functions.eclass: Add new helpers for EAPI=8 dilfridge
2021-06-19 11:05   ` Michał Górny
2021-06-19 11:01 ` dilfridge [this message]
2021-06-19 14:58 ` [gentoo-dev] [PATCH 1/3] readme.gentoo-r1.eclass: works just fine with EAPI=8 Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210619110152.54307-3-dilfridge@gentoo.org \
    --to=dilfridge@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox