From owner-svn-ports-all@FreeBSD.ORG Mon Feb 9 17:16:45 2015 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63170A6C; Mon, 9 Feb 2015 17:16:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EEAFF2A; Mon, 9 Feb 2015 17:16:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t19HGjpY051379; Mon, 9 Feb 2015 17:16:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t19HGiQm051376; Mon, 9 Feb 2015 17:16:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201502091716.t19HGiQm051376@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 9 Feb 2015 17:16:44 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r378742 - in head/Mk: . Scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 17:16:45 -0000 Author: bapt Date: Mon Feb 9 17:16:43 2015 New Revision: 378742 URL: https://svnweb.freebsd.org/changeset/ports/378742 QAT: https://qat.redports.org/buildarchive/r378742/ Log: Rework dependency registration Change the way the dependencies are registred so that now it follows the same mechanism as when the *_DEPENDS making the dependency registration system ready to allow multiple packages from the same origin such as flavours and subpackages Also allowing to install twice the same port one built with python33 and the other built with python27 for example. PR: 19702 With help of: antoine Exp-run: portmgr (antoine) Added: head/Mk/Scripts/actual-package-depends.sh (contents, props changed) head/Mk/Scripts/find-lib.sh (contents, props changed) Modified: head/Mk/bsd.port.mk Added: head/Mk/Scripts/actual-package-depends.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Mk/Scripts/actual-package-depends.sh Mon Feb 9 17:16:43 2015 (r378742) @@ -0,0 +1,72 @@ +#!/bin/sh +# MAINTAINER: portmgr@FeeeBSD.org +# $FreeBSD$ + +if [ -z "${PKG_BIN}" ]; then + echo "PKG_BIN required in environment." >&2 + exit 1 +fi + +resolv_symlink() { + local file tgt + file=${1} + if [ ! -L ${file} ] ; then + echo ${file} + return + fi + + tgt=`readlink ${file}` + case $tgt in + /*) + echo $tgt + return + ;; + esac + + file=${file%/*}/${tgt} + absolute_path ${file} +} + +absolute_path() { + local file myifs target + file=$1 + + myifs=${IFS} + IFS='/' + set -- ${file} + IFS=${myifs} + for el; do + case $el in + .) continue ;; + '') continue ;; + ..) target=${target%/*} ;; + *) target="${target}/${el}" ;; + esac + done + echo ${target} +} + +find_dep() { + pattern=$1 + case ${pattern} in + *\>*|*\<*|*=*) + ${PKG_BIN} info -Eg "${pattern}" 2>/dev/null + return + ;; + /*) + searchfile=$pattern + ;; + *) + searchfile=$(/usr/bin/which ${pattern} 2>/dev/null) + ;; + esac + if [ -n "${searchfile}" ]; then + echo $(resolv_symlink ${searchfile}) >&2 + ${PKG_BIN} which -q ${searchfile} || ${PKG_BIN} which -q "$(resolv_symlink ${searchfile} 2>/dev/null)" || + echo "actual-package-depends: dependency on ${searchfile} not registered (normal if it belongs to base)" >&2 + fi +} + +for lookup; do + ${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep ${lookup})" || : +done Added: head/Mk/Scripts/find-lib.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Mk/Scripts/find-lib.sh Mon Feb 9 17:16:43 2015 (r378742) @@ -0,0 +1,62 @@ +#!/bin/sh +# MAINTAINER: portmgr@FreeBSD.org +# $FreeBSD$ + +if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then + echo "LIB_DIRS, LOCALBASE required in environment." >&2 + exit 1 +fi + +if [ $# -ne 1 ]; then + echo "$0: no argument provided." >&2 +fi + +lib=$1 +dirs="${LIB_DIRS} `cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`" + +resolv_symlink() { + local file tgt + file=${1} + if [ ! -L ${file} ] ; then + echo ${file} + return + fi + + tgt=`readlink ${file}` + case $tgt in + /*) + echo $tgt + return + ;; + esac + + file=${file%/*}/${tgt} + absolute_path ${file} +} + +absolute_path() { + local file myifs target + file=$1 + + myifs=${IFS} + IFS='/' + set -- ${file} + IFS=${myifs} + for el; do + case $el in + .) continue ;; + '') continue ;; + ..) target=${target%/*} ;; + *) target="${target}/${el}" ;; + esac + done + echo ${target} +} + +for libdir in ${dirs} ; do + test -f ${libdir}/${lib} || continue + libfile=`resolv_symlink ${libdir}/${lib}` + [ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue + echo $libfile + break +done Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Mon Feb 9 16:28:10 2015 (r378741) +++ head/Mk/bsd.port.mk Mon Feb 9 17:16:43 2015 (r378742) @@ -1766,9 +1766,12 @@ RUN_DEPENDS+= ${LINUX_BASE_PORT} PKG_IGNORE_DEPENDS?= 'this_port_does_not_exist' _GL_gbm_LIB_DEPENDS= libgbm.so:${PORTSDIR}/graphics/gbm -_GL_glesv2_LIB_DEPENDS= libGLESv2.so:${PORTSDIR}/graphics/libglesv2 -_GL_egl_LIB_DEPENDS= libEGL.so:${PORTSDIR}/graphics/libEGL -_GL_gl_LIB_DEPENDS= libGL.so:${PORTSDIR}/graphics/libGL +_GL_glesv2_BUILD_DEPENDS= libglesv2>0:${PORTSDIR}/graphics/libglesv2 +_GL_glesv2_RUN_DEPENDS= libglesv2>0:${PORTSDIR}/graphics/libglesv2 +_GL_egl_BUILD_DEPENDS= libEGL>0:${PORTSDIR}/graphics/libEGL +_GL_egl_RUN_DEPENDS= libEGL>0:${PORTSDIR}/graphics/libEGL +_GL_gl_BUILD_DEPENDS= libGL>0:${PORTSDIR}/graphics/libGL +_GL_gl_RUN_DEPENDS= libGL>0:${PORTSDIR}/graphics/libGL _GL_gl_USE_XORG= glproto dri2proto _GL_glew_LIB_DEPENDS= libGLEW.so:${PORTSDIR}/graphics/glew _GL_glu_LIB_DEPENDS= libGLU.so:${PORTSDIR}/graphics/libGLU @@ -4473,18 +4476,8 @@ lib-depends: target="${DEPENDS_TARGET}"; \ depends_args="${DEPENDS_ARGS}"; \ ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $${lib}" ; \ - found=0 ; \ - dirs="${LIB_DIRS} `${CAT} ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || : `" ; \ - for libdir in $$dirs; do \ - test -f $${libdir}/$${lib} || continue; \ - if [ -x /usr/bin/file ]; then \ - _LIB_FILE=`realpath $${libdir}/$${lib}`; \ - [ `file -b -L --mime-type $${_LIB_FILE}` = "application/x-sharedlib" ] || continue ; \ - fi ; \ - found=1 ; \ - ${ECHO_MSG} -n " - found ($${_LIB_FILE})"; \ - done ; \ - if [ $${found} -eq 0 ]; then \ + libfile=`${SETENV} LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}` ; \ + if [ -z "$${libfile}" ]; then \ ${ECHO_MSG} " - not found"; \ ${ECHO_MSG} "===> Verifying for $$lib in $$dir"; \ if [ ! -d "$$dir" ] ; then \ @@ -4493,7 +4486,7 @@ lib-depends: ${_INSTALL_DEPENDS} \ fi ; \ else \ - ${ECHO_MSG}; \ + ${ECHO_MSG} " - found ($${libfile})"; \ fi ; \ done .endif @@ -4801,9 +4794,11 @@ PACKAGE-DEPENDS-LIST?= \ done ACTUAL-PACKAGE-DEPENDS?= \ - if [ "${_LIB_RUN_DEPENDS}" != " " ]; then \ - ${PKG_QUERY} "\"%n\": {origin: %o, version: \"%v\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} 2>/dev/null || : ; \ - fi + depfiles="" ; \ + for lib in ${LIB_DEPENDS:C/\:.*//}; do \ + depfiles="$$depfiles `${SETENV} LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}`" ; \ + done ; \ + ${SETENV} PKG_BIN="${PKG_BIN}" ${SH} ${SCRIPTSDIR}/actual-package-depends.sh $${depfiles} ${RUN_DEPENDS:C/(.*)\:.*/"\1"/} create-manifest: @${MKDIR} ${METADIR}; \