diff options
author | mat <mat@FreeBSD.org> | 2016-10-29 10:10:33 +0000 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2016-10-29 10:10:33 +0000 |
commit | c9d6228727a52d6eb471cdca2b9d4b7cf3ccaa79 (patch) | |
tree | 785d8a302fb9f761151844d9701c194ebc14c38d | |
parent | 2534dcae9401a97fe13103fd6c5ada5a75e88837 (diff) | |
download | FreeBSD-ports-c9d6228727a52d6eb471cdca2b9d4b7cf3ccaa79.zip FreeBSD-ports-c9d6228727a52d6eb471cdca2b9d4b7cf3ccaa79.tar.gz |
Add a Perl CORE QA check.
This will use Module::CoreList to tell you if a dependency you added can
be removed, or only conditionally added.
Approved by: bapt
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D7832
-rw-r--r-- | Mk/Scripts/qa.sh | 50 | ||||
-rw-r--r-- | Mk/bsd.port.mk | 1 |
2 files changed, 50 insertions, 1 deletions
diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index 7d8cb3f..3edd5c5 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -12,6 +12,10 @@ fi LF=$(printf '\nX') LF=${LF%X} +notice() { + echo "Notice: $@" >&2 +} + warn() { echo "Warning: $@" >&2 } @@ -703,9 +707,53 @@ sonames() { EOT } +perlcore() { + local portname version module gotsome + [ -x "${LOCALBASE}/bin/corelist" ] || return 0 + for dep in ${UNIFIED_DEPENDS}; do + portname=$(expr "${dep}" : ".*/p5-\(.*\)") + if [ -n "${portname}" ]; then + gotsome=1 + module=$(echo ${portname}|sed -e 's/-/::/g') + version=$(expr "${dep}" : ".*>=*\([^:<]*\)") + + while read l; do + case "${l}" in + *was\ not\ in\ CORE*) + # This never was with Perl + # CORE, so nothing to do here + ;; + *and\ removed*) + # This was in Perl CORE but has + # been removed since. + warn "${dep##*:} was in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if it should be conditionally added depending on PERL_LEVEL" + ;; + *deprecated*in*) + # This is in Perl CORE but is + # deprecated. + warn "${dep##*:} is in Perl CORE but deprecated. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL" + ;; + *was\ first\ released*) + # This is in Perl CORE and is + # maybe not needed. + warn "${dep##*:} is present in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL" + ;; + *) + err "This line is not handled: \"${l}\"" + esac + done <<-EOT + $(${LOCALBASE}/bin/corelist "${module}"|tail -1) + EOT + fi + done + if [ -n "${gotsome}" ] && ! pkg info -e devel/p5-Module-CoreList; then + notice "You have some Perl modules as dependencies but you do not have devel/p5-Module-CoreList installed, the perlcore QA check gets better results when using it, especially with older Perl versions." + fi +} + checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" -checks="$checks proxydeps sonames" +checks="$checks proxydeps sonames perlcore" ret=0 cd ${STAGEDIR} diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index ae88477..25e2225 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1492,6 +1492,7 @@ QA_ENV+= STAGEDIR=${STAGEDIR} \ LDCONFIG_DIR="${LDCONFIG_DIR}" \ PKGORIGIN=${PKGORIGIN} \ LIB_RUN_DEPENDS='${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}' \ + UNIFIED_DEPENDS=${_UNIFIED_DEPENDS:C,([^:]*:[^:]*):?.*,\1,:O:u:Q} \ PKGBASE=${PKGBASE} .if !empty(USES:Mssl) QA_ENV+= USESSSL=yes |