Earlier I wrote:
> Anyway, the problem you're describing allows for another fix. If ports/A
> depends of file-B, port system could check not only that file-B exists,
> but if there is also a package that installed it (via 'pkg which'), and
> if not, install ports/B. This will of course slow down ports operations
> somewhat.

Here's a patch to that effect.

(Only tested with PKGNG; should work with old pkg tools, but some
tweaking may be required).

Matthias, can you try to reproduce the situation you described, and see
if it will be resolved after applying this patch?
diff -ruN Mk.orig/bsd.commands.mk Mk/bsd.commands.mk
--- Mk.orig/bsd.commands.mk     2013-03-19 11:27:52.000000000 +0200
+++ Mk/bsd.commands.mk  2013-04-11 14:15:49.000000000 +0300
@@ -128,6 +128,7 @@
 PKG_CREATE?=           ${PKG_BIN} create
 PKG_ADD?=              ${PKG_BIN} add
 PKG_QUERY?=            ${PKG_BIN} query
+PKG_WHICH?=            ${PKG_BIN} which
 .else
 .if exists(${LOCALBASE}/sbin/pkg_info)
 PKG_CMD?=      ${LOCALBASE}/sbin/pkg_create
@@ -135,12 +136,14 @@
 PKG_DELETE?=   ${LOCALBASE}/sbin/pkg_delete
 PKG_INFO?=     ${LOCALBASE}/sbin/pkg_info
 PKG_VERSION?=  ${LOCALBASE}/sbin/pkg_version
+PKG_WHICH?=    ${LOCALBASE}/sbin/pkg_info -W
 .else
 PKG_CMD?=      /usr/sbin/pkg_create
 PKG_ADD?=      /usr/sbin/pkg_add
 PKG_DELETE?=   /usr/sbin/pkg_delete
 PKG_INFO?=     /usr/sbin/pkg_info
 PKG_VERSION?=  /usr/sbin/pkg_version
+PKG_WHICH?=    /usr/sbin/pkg_info -W
 .endif
 .endif
 
diff -ruN Mk.orig/bsd.port.mk Mk/bsd.port.mk
--- Mk.orig/bsd.port.mk 2013-03-30 07:31:29.000000000 +0200
+++ Mk/bsd.port.mk      2013-04-11 16:35:42.000000000 +0300
@@ -5063,6 +5063,9 @@
                                        if [ ${_DEPEND_ALWAYS} = 1 ]; then \
                                                ${ECHO_MSG} "       (but 
building it anyway)"; \
                                                notfound=1; \
+                                       elif ! ${PKG_WHICH} "$$prog" 
>/dev/null; then \
+                                               ${ECHO_MSG} "       (but not 
installed by any package)"; \
+                                               notfound=1; \
                                        else \
                                                notfound=0; \
                                        fi; \
@@ -5104,6 +5107,9 @@
                                if [ ${_DEPEND_ALWAYS} = 1 ]; then \
                                        ${ECHO_MSG} "       (but building it 
anyway)"; \
                                        notfound=1; \
+                               elif ! ${PKG_WHICH} `${WHICH} "$$prog"` 
>/dev/null; then \
+                                       ${ECHO_MSG} "       (but not installed 
by any package)"; \
+                                       notfound=1; \
                                else \
                                        notfound=0; \
                                fi; \
@@ -5141,11 +5147,19 @@
                        dir=$${dir%%:*}; \
                fi; \
                ${ECHO_MSG} -n "===>   ${PKGNAME} depends on shared library: 
$$lib"; \
-               if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e 
"${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \
+               libs=`${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e 
"${PKGCOMPATDIR}"`; \
+               if ${ECHO_CMD} "$$libs" | ${GREP} -qwE -e "-l$$pattern"; then \
                        ${ECHO_MSG} " - found"; \
                        if [ ${_DEPEND_ALWAYS} = 1 ]; then \
                                ${ECHO_MSG} "       (but building it anyway)"; \
                                notfound=1; \
+                       elif ${ECHO_CMD} "$$libs" | ${GREP} -wE -e 
"-l$$pattern" | ${SED} 's/.*=> //' | \
+                               while read lib; do \
+                                       if ${PKG_WHICH} "$$lib" >/dev/null; 
then return 1; fi; \
+                               done; \
+                       then \
+                               ${ECHO_MSG} "       (but not installed by any 
package)"; \
+                               notfound=1; \
                        else \
                                notfound=0; \
                        fi; \
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to