Date: Thu, 11 Apr 2013 18:38:01 +0100 From: Chris Rees <utisoft@gmail.com> To: Vitaly Magerya <vmagerya@gmail.com> Cc: Matthias Apitz <guru@unixarea.de>, FreeBSD Mailing List <freebsd-ports@freebsd.org> Subject: Re: problems with half installed ports Message-ID: <CADLo839xna3KfOMjQnG1RvJF8ueRNSUu%2BV%2B8%2BmM4P3qg8m5vUA@mail.gmail.com> In-Reply-To: <5166BEB8.7060309@gmail.com> References: <20130411101916.GA3339@tinyCurrent> <51669B48.4050905@gmail.com> <5166BEB8.7060309@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11 Apr 2013 14:48, "Vitaly Magerya" <vmagerya@gmail.com> wrote: > > 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; \ No thanks. Ports should be happy to use files whether they're installed by ports or not. Just don't interrupt installs, and you'll be OK! Stagedir will fix this problem correctly once it's implemented. Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLo839xna3KfOMjQnG1RvJF8ueRNSUu%2BV%2B8%2BmM4P3qg8m5vUA>