tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Buildlink dependences (was: libcroco and xz)



When the "libcroco and xz" topic was being discussed on pkgsrc-users I look
in to the issue and came up with an alternative to Joerg's solution.

A lot of the discussion talked about indirect dependences, so thats what I
did, I created a new type of dependence - indirect - any thing in the
buildlink tree other than full dependences that is not builtin.

This allows to things to be done:

1) Fix the original problem, any (non-buildin) library the program
   requires must be a full or indirect dependence.

2) Because of the above fact it an error if a program requires a
   (non-buildin) library that is not listed as full or indirect
   dependence.  Meaning the check-shlibs can now pickup cases it
   currently doesn't.

The first attachment does the work of implementing the indirect
dependences idea, the second is the fix and improvement id
check-shlibs-elf.awk.

Comments?

-- 
Steven
Index: mk/bsd.pkg.mk
===================================================================
--- mk.orig/bsd.pkg.mk
+++ mk/bsd.pkg.mk
@@ -418,6 +418,7 @@ ${FAKEHOMEDIR}:
 .if defined(ABI_DEPENDS) || defined(BUILD_ABI_DEPENDS)
 .  if !empty(USE_ABI_DEPENDS:M[yY][eE][sS])
 DEPENDS+=              ${ABI_DEPENDS}
+INDIRECT_DEPENDS+=     ${INDIRECT_ABI_DEPENDS}
 BUILD_DEPENDS+=                ${BUILD_ABI_DEPENDS}
 .  else
 _BUILD_DEFS+=          USE_ABI_DEPENDS
Index: mk/buildlink3/bsd.buildlink3.mk
===================================================================
--- mk.orig/buildlink3/bsd.buildlink3.mk
+++ mk/buildlink3/bsd.buildlink3.mk
@@ -164,41 +164,44 @@ _SYS_VARS.bl3+=           ${v}.${p}
 .  endfor
 .endfor
 
-# By default, every package receives a full dependency.
-.for _pkg_ in ${_BLNK_PACKAGES}
-BUILDLINK_DEPMETHOD.${_pkg_}?= full
-.endfor
-
 # _BLNK_DEPENDS contains all of the elements of _BLNK_PACKAGES for which
-# we must add a dependency.  We add a dependency if we aren't using the
-# built-in version of the package, and the package was either explicitly
-# requested as a dependency (_BUILDLINK_DEPENDS) or is a build dependency
-# somewhere in the chain.
+# we must have a dependency and we aren't using the built-in version of
+# the package.  If the package was explicitly requested as a dependency
+# (_BUILDLINK_DEPENDS) then the package receives a full dependency,
+# otherwise it is a indirect dependency (i.e. a dependency of a dependency).
 #
 _BLNK_DEPENDS= # empty
 .for _pkg_ in ${_BLNK_PACKAGES}
 USE_BUILTIN.${_pkg_}?= no
 .  if empty(_BLNK_DEPENDS:M${_pkg_}) && !defined(IGNORE_PKG.${_pkg_}) && \
-      !empty(USE_BUILTIN.${_pkg_}:M[nN][oO]) && \
-      (!empty(_BUILDLINK_DEPENDS:M${_pkg_}) || \
-       !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild))
+      !empty(USE_BUILTIN.${_pkg_}:M[nN][oO])
+.    if !empty(_BUILDLINK_DEPENDS:M${_pkg_})
+BUILDLINK_DEPMETHOD.${_pkg_}?= full
+.    else
+BUILDLINK_DEPMETHOD.${_pkg_}?= indirect
+.    endif
 _BLNK_DEPENDS+=        ${_pkg_}
 .  endif
 .endfor
 
 # Add the proper dependency on each package pulled in by buildlink3.mk
-# files.  BUILDLINK_DEPMETHOD.<pkg> contains a list of either "full" or
-# "build", and if any of that list is "full" then we use a full dependency
-# on <pkg>, otherwise we use a build dependency on <pkg>.
+# files.  BUILDLINK_DEPMETHOD.<pkg> contains a list of either "full",
+# "indirect" or "build", and a full, indirect or build dependency is
+# used on <pkg> based on its value.
 #
 _BLNK_ADD_TO.DEPENDS=          # empty
 _BLNK_ADD_TO.BUILD_DEPENDS=    # empty
+_BLNK_ADD_TO.INDIRECT_DEPENDS= # empty
 _BLNK_ADD_TO.ABI_DEPENDS=      # empty
+_BLNK_ADD_TO.INDIRECT_ABI_DEPENDS=     # empty
 _BLNK_ADD_TO.BUILD_ABI_DEPENDS=        # empty
 .for _pkg_ in ${_BLNK_DEPENDS}
 .  if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
 _BLNK_DEPMETHOD.${_pkg_}=      _BLNK_ADD_TO.DEPENDS
 _BLNK_ABIMETHOD.${_pkg_}=      _BLNK_ADD_TO.ABI_DEPENDS
+.  elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mindirect)
+_BLNK_DEPMETHOD.${_pkg_}=      _BLNK_ADD_TO.INDIRECT_DEPENDS
+_BLNK_ABIMETHOD.${_pkg_}=      _BLNK_ADD_TO.INDIRECT_ABI_DEPENDS
 .  elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
 _BLNK_DEPMETHOD.${_pkg_}=      _BLNK_ADD_TO.BUILD_DEPENDS
 _BLNK_ABIMETHOD.${_pkg_}=      _BLNK_ADD_TO.BUILD_ABI_DEPENDS
@@ -220,7 +223,8 @@ ${_BLNK_ABIMETHOD.${_pkg_}}+=       ${_abi_}:$
 .    endfor
 .  endif
 .endfor
-.for _depmethod_ in DEPENDS BUILD_DEPENDS ABI_DEPENDS BUILD_ABI_DEPENDS
+.for _depmethod_ in DEPENDS INDIRECT_DEPENDS BUILD_DEPENDS ABI_DEPENDS \
+                       INDIRECT_ABI_DEPENDS BUILD_ABI_DEPENDS
 .  if !empty(_BLNK_ADD_TO.${_depmethod_})
 ${_depmethod_}+=       ${_BLNK_ADD_TO.${_depmethod_}}
 .  endif
Index: mk/pkgformat/pkg/depends.mk
===================================================================
--- mk.orig/pkgformat/pkg/depends.mk
+++ mk/pkgformat/pkg/depends.mk
@@ -35,6 +35,7 @@ _REDUCE_DEPENDS_CMD=  ${PKGSRC_SETENV} CA
 _pkgformat-show-depends: .PHONY
        @case ${VARNAME:Q}"" in                                         \
        BUILD_DEPENDS)  ${_REDUCE_DEPENDS_CMD} ${BUILD_DEPENDS:Q} ;;    \
+       INDIRECT_DEPENDS) ${_REDUCE_DEPENDS_CMD} ${INDIRECT_DEPENDS:Q} ;; \
        DEPENDS|*)      ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} ;;          \
        esac
 
@@ -44,13 +45,14 @@ _LIST_DEPENDS_CMD=  \
                ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \
                        " "${BOOTSTRAP_DEPENDS:Q} \
                        " "${BUILD_DEPENDS:Q} \
-                       " "${DEPENDS:Q}
+                       " "${DEPENDS:Q} \
+                       " "${INDIRECT_DEPENDS:Q}
 
 _LIST_DEPENDS_CMD.bootstrap=   \
        ${PKGSRC_SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \
                PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \
                ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \
-                       " "${BOOTSTRAP_DEPENDS:Q} " " " "
+                       " "${BOOTSTRAP_DEPENDS:Q} " " " " " "
 
 _RESOLVE_DEPENDS_CMD=  \
        ${PKGSRC_SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} PKG_INFO=${PKG_INFO:Q} \
@@ -58,7 +60,8 @@ _RESOLVE_DEPENDS_CMD= \
                ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/resolve-dependencies \
                        " "${BOOTSTRAP_DEPENDS:Q} \
                        " "${BUILD_DEPENDS:Q} \
-                       " "${DEPENDS:Q}
+                       " "${DEPENDS:Q} \
+                       " "${INDIRECT_DEPENDS:Q}
 
 # _DEPENDS_INSTALL_CMD checks whether the package $pattern is installed,
 #      and installs it if necessary.
@@ -123,6 +126,7 @@ _pkgformat-install-dependencies: .PHONY
        ${CAT} ${_DEPENDS_FILE} |                                       \
        while read type pattern dir; do                                 \
                ${TEST} "$$type" != "bootstrap" || continue;            \
+               ${TEST} "$$type" != "indirect" || continue;             \
                ${_DEPENDS_INSTALL_CMD} 0<&3;                           \
        done
 
Index: mk/pkgformat/pkg/list-dependencies
===================================================================
--- mk.orig/pkgformat/pkg/list-dependencies
+++ mk/pkgformat/pkg/list-dependencies
@@ -57,11 +57,12 @@ print_entries() {
        done
 }
 
-if [ $# != 3 ]; then
-       echo "usage: list-dependencies bootstrap_depends build_depends depends" 
1>&2
+if [ $# != 4 ]; then
+       echo "usage: list-dependencies bootstrap_depends build_depends depends 
indirect_depends" 1>&2
        exit 1
 fi
 
 print_entries bootstrap "$1"
 print_entries build "$2"
 print_entries full "$3"
+print_entries indirect "$4"
Index: mk/check/check-shlibs-elf.awk
===================================================================
--- mk.orig/check/check-shlibs-elf.awk
+++ mk/check/check-shlibs-elf.awk
@@ -79,20 +79,15 @@ function check_pkg(DSO, pkg, found) {
        close(cmd)
        if (pkg == "")
                return 0
-       found=0
        while ((getline < depends_file) > 0) {
                if ($3 == pkg) {
-                       found=1
-                       if ($1 != "full")
+                       if ($1 != "full" && $1 != "indirect")
                                continue
                        close(depends_file)
                        return 0
                }
        }
-       if (found)
-               print DSO ": " pkg " is not a runtime dependency"
-       # Not yet:
-       # print DSO ": " pkg " is not a dependency"
+       print DSO ": " pkg " is not a dependency"
        close(depends_file)
 }
 


Home | Main Index | Thread Index | Old Index