mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
eclass/perl-module: Sync with gentoo
It's from gentoo commit 5ab802dd4f48f6275de1d260ca9eb4d9276536ad.
This commit is contained in:
parent
4288237327
commit
9af7bde497
@ -1,4 +1,4 @@
|
||||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: perl-module.eclass
|
||||
@ -7,7 +7,8 @@
|
||||
# @AUTHOR:
|
||||
# Seemant Kulleen <seemant@gentoo.org>
|
||||
# Andreas K. Hüttel <dilfridge@gentoo.org>
|
||||
# @SUPPORTED_EAPIS: 5 6 7
|
||||
# @SUPPORTED_EAPIS: 5 6 7 8
|
||||
# @PROVIDES: perl-functions
|
||||
# @BLURB: eclass for installing Perl module distributions
|
||||
# @DESCRIPTION:
|
||||
# The perl-module eclass is designed to allow easier installation of Perl
|
||||
@ -27,6 +28,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"
|
||||
;;
|
||||
@ -39,7 +44,9 @@ esac
|
||||
# dev-lang/perl is automatically added by the eclass. It defaults to yes.
|
||||
# Set to no to disable, set to noslotop to add a perl dependency without
|
||||
# slot operator (EAPI=6). All packages installing into the vendor_perl
|
||||
# path must use yes here.
|
||||
# path must use yes here. (EAPI=8 and later) Also adds a test useflag,
|
||||
# a use-conditional build time dependency on virtual/perl-Test-Simple, and
|
||||
# the required RESTRICT setting.
|
||||
|
||||
case ${EAPI:-0} in
|
||||
5)
|
||||
@ -127,7 +134,34 @@ case ${EAPI:-0} in
|
||||
EXPORT_FUNCTIONS ${PERL_EXPF}
|
||||
;;
|
||||
*)
|
||||
die "EAPI=${EAPI:-0} is not supported by perl-module.eclass"
|
||||
[[ ${CATEGORY} == perl-core ]] && \
|
||||
PERL_EXPF+=" pkg_postinst pkg_postrm"
|
||||
|
||||
case "${GENTOO_DEPEND_ON_PERL:-yes}" in
|
||||
yes|noslotop)
|
||||
DEPEND="dev-lang/perl"
|
||||
BDEPEND="dev-lang/perl
|
||||
test? ( virtual/perl-Test-Simple )"
|
||||
IUSE="test"
|
||||
RESTRICT="!test? ( test )"
|
||||
;;&
|
||||
yes)
|
||||
RDEPEND="dev-lang/perl:="
|
||||
;;
|
||||
noslotop)
|
||||
RDEPEND="dev-lang/perl"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${GENTOO_DEPEND_ON_PERL_SUBSLOT:-yes}" != "yes" ]]; then
|
||||
die "GENTOO_DEPEND_ON_PERL_SUBSLOT=no is banned in EAPI=6 and later."
|
||||
fi
|
||||
|
||||
if [[ "${PERL_EXPORT_PHASE_FUNCTIONS}" ]]; then
|
||||
die "PERL_EXPORT_PHASE_FUNCTIONS is banned in EAPI=6 and later."
|
||||
fi
|
||||
|
||||
EXPORT_FUNCTIONS ${PERL_EXPF}
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -172,6 +206,7 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
|
||||
# Named MODULE_SECTION in EAPI=5.
|
||||
|
||||
# @ECLASS-VARIABLE: DIST_EXAMPLES
|
||||
# @PRE_INHERIT
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# (EAPI=6 and later) This Bash array allows passing a list of example files to be installed
|
||||
@ -179,6 +214,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
|
||||
@ -275,19 +329,38 @@ perl-module_src_configure() {
|
||||
fi
|
||||
|
||||
if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL ]] ; then
|
||||
if grep -q '\(use\|require\)\s*Module::Build::Tiny' Build.PL ; then
|
||||
einfo "Using Module::Build::Tiny"
|
||||
if [[ ${DEPEND} != *dev-perl/Module-Build-Tiny* && ${PN} != Module-Build-Tiny ]]; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build::Tiny but doesn't depend on it."
|
||||
die " Add dev-perl/Module-Build-Tiny to DEPEND!"
|
||||
fi
|
||||
else
|
||||
einfo "Using Module::Build"
|
||||
if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${DEPEND} != *dev-perl/Module-Build* && ${PN} != Module-Build ]] ; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
|
||||
die " Add dev-perl/Module-Build to DEPEND!"
|
||||
fi
|
||||
fi
|
||||
case ${EAPI:-0} in
|
||||
5|6)
|
||||
if grep -q '\(use\|require\)\s*Module::Build::Tiny' Build.PL ; then
|
||||
einfo "Using Module::Build::Tiny"
|
||||
if [[ ${DEPEND} != *dev-perl/Module-Build-Tiny* && ${PN} != Module-Build-Tiny ]]; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build::Tiny but doesn't depend on it."
|
||||
die " Add dev-perl/Module-Build-Tiny to DEPEND!"
|
||||
fi
|
||||
else
|
||||
einfo "Using Module::Build"
|
||||
if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${DEPEND} != *dev-perl/Module-Build* && ${PN} != Module-Build ]] ; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
|
||||
die " Add dev-perl/Module-Build to DEPEND!"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if grep -q '\(use\|require\)\s*Module::Build::Tiny' Build.PL ; then
|
||||
einfo "Using Module::Build::Tiny"
|
||||
if [[ ${BDEPEND} != *dev-perl/Module-Build-Tiny* && ${PN} != Module-Build-Tiny ]]; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build::Tiny but doesn't depend on it."
|
||||
eerror " Add dev-perl/Module-Build-Tiny to BDEPEND!"
|
||||
fi
|
||||
else
|
||||
einfo "Using Module::Build"
|
||||
if [[ ${BDEPEND} != *virtual/perl-Module-Build* && ${BDEPEND} != *dev-perl/Module-Build* && ${PN} != Module-Build ]] ; then
|
||||
eerror "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
|
||||
eerror " Add dev-perl/Module-Build to BDEPEND!"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
set -- \
|
||||
--installdirs=vendor \
|
||||
--libdoc= \
|
||||
@ -323,11 +396,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 \
|
||||
@ -358,6 +438,7 @@ perl-module_src_compile() {
|
||||
# network : do not try to disable network tests
|
||||
|
||||
# @ECLASS-VARIABLE: DIST_TEST_OVERRIDE
|
||||
# @USER_VARIABLE
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# (EAPI=6 and later) Variable that controls if tests are run in the test phase
|
||||
@ -375,7 +456,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
|
||||
@ -413,6 +494,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"
|
||||
@ -452,9 +545,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
|
||||
@ -466,13 +567,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
|
||||
|
Loading…
Reference in New Issue
Block a user