Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Oct 2016 10:10:33 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r424899 - in head/Mk: . Scripts
Message-ID:  <201610291010.u9TAAXAW028570@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Sat Oct 29 10:10:33 2016
New Revision: 424899
URL: https://svnweb.freebsd.org/changeset/ports/424899

Log:
  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

Modified:
  head/Mk/Scripts/qa.sh   (contents, props changed)
  head/Mk/bsd.port.mk   (contents, props changed)

Modified: head/Mk/Scripts/qa.sh
==============================================================================
--- head/Mk/Scripts/qa.sh	Sat Oct 29 09:30:14 2016	(r424898)
+++ head/Mk/Scripts/qa.sh	Sat Oct 29 10:10:33 2016	(r424899)
@@ -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}

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Sat Oct 29 09:30:14 2016	(r424898)
+++ head/Mk/bsd.port.mk	Sat Oct 29 10:10:33 2016	(r424899)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610291010.u9TAAXAW028570>