Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2017 19:09:41 +0000 (UTC)
From:      Nikolai Lifanov <lifanov@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r447515 - in head/Mk: . Scripts
Message-ID:  <201708071909.v77J9fXr048218@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lifanov
Date: Mon Aug  7 19:09:41 2017
New Revision: 447515
URL: https://svnweb.freebsd.org/changeset/ports/447515

Log:
  add new stage-qa target: gemdeps
  
  This checks whether rubygem ports have all of their dependencies
  in gemspec satisfied by what's currently installed. Sample output:
  
  ====> Running Q/A tests (stage-qa)
  Error: RubyGem dependency archive-tar-minitar = 0.5.2 is not satisfied.
  *** Error code 1
  
  Stop.
  make: stopped in /usr/home/lifanov/src/svn/freebsd/ports/head/archivers/rubygem-fpm
  
  These ports would be broken at runtime.
  
  Big thanks to:
    swills - discussion
    mat - reviews
    antoine - exp runs
    sunpoet - fixing several dozens of ports :)
  
  PR:		220605
  Reviewed by:	mat, sunpoet
  Approved by:	portmgr (mat)
  Differential Revision:	https://reviews.freebsd.org/D11841

Modified:
  head/Mk/Scripts/qa.sh
  head/Mk/bsd.port.mk

Modified: head/Mk/Scripts/qa.sh
==============================================================================
--- head/Mk/Scripts/qa.sh	Mon Aug  7 18:52:15 2017	(r447514)
+++ head/Mk/Scripts/qa.sh	Mon Aug  7 19:09:41 2017	(r447515)
@@ -830,10 +830,45 @@ no_arch() {
 	return $rc
 }
 
+gemdeps()
+{
+	rc=0
+	if [ "${PKGBASE%%-*}" = "rubygem" ]; then
+		while read -r l; do
+			if [ -n "${l}" ]; then
+				name=${l%% *}
+				vers=${l#* }
+				while read -r v; do
+					if ! while read -r p; do
+						${LOCALBASE}/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')"
+					done | grep -qFx OK; then
+						err RubyGem dependency ${name} ${v} is not satisfied.
+						rc=1
+					fi <<-EOF
+					$(${LOCALBASE}/bin/gem list -e "${name}" \
+						| sed "s|.*(\(.*\))|\1|" \
+						| tr -d ' ' \
+						| tr , '\n')
+					EOF
+				done <<-EOF
+				$(while echo "${vers}" | grep -q '"'; do
+					echo "${vers}" | cut -d '"' -f2
+					vers=$(echo "${vers}"|cut -d '"' -f3-)
+				done)
+				EOF
+			fi
+		done <<-EOF
+		$(grep -a 'add_runtime_dependency' ${STAGEDIR}${PREFIX}/lib/ruby/gems/*/specifications/${PORTNAME}-*.gemspec \
+			| sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \
+			| sort -u)
+		EOF
+	fi
+	return $rc
+}
 
 checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo"
 checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo"
-checks="$checks proxydeps sonames perlcore no_arch"
+checks="$checks proxydeps sonames perlcore no_arch gemdeps"
 
 ret=0
 cd ${STAGEDIR}

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Mon Aug  7 18:52:15 2017	(r447514)
+++ head/Mk/bsd.port.mk	Mon Aug  7 19:09:41 2017	(r447515)
@@ -1532,6 +1532,7 @@ QA_ENV+=		STAGEDIR=${STAGEDIR} \
 				LIB_RUN_DEPENDS='${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}' \
 				UNIFIED_DEPENDS=${_UNIFIED_DEPENDS:C,([^:]*:[^:]*):?.*,\1,:O:u:Q} \
 				PKGBASE=${PKGBASE} \
+				PORTNAME=${PORTNAME} \
 				NO_ARCH=${NO_ARCH} \
 				"NO_ARCH_IGNORE=${NO_ARCH_IGNORE}"
 .if !empty(USES:Mssl)



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