problems with half installed ports
Hi, Sometimes, while compiling all my ports, I encounter the following problem: Say, we are installing ports/A which depends on ports/B; the Makefile detects the dependency and goes to install ports/B; if now during the final installation process, some files are already delivered to /usr/local, some files not, the system goes down (by intention because it's time to go out), before the installation of ports/B is fully done and registered to /var/db/pkg, next time when you restart installing ports/A it often sees, because the file referenced in the Makefile was allready installed (while others not), it thinks that ports/B was installed fine and proceeds with ports/A which later (or even in some other area) gives an error due to missing files of ports/B; I think, the only solution is that the dependency is not only based on some (random) file of B, but on the fact if B was *fully* installed and registered in /var/db/pkg; comments? Thanks matthias -- Matthias Apitz | /\ ASCII Ribbon Campaign: www.asciiribbon.org E-mail: g...@unixarea.de | \ / - No HTML/RTF in E-mail WWW: http://www.unixarea.de/ | X - No proprietary attachments phone: +49-170-4527211 | / \ - Respect for open standards ___ 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
Re: problems with half installed ports
On 11 April 2013 11:19, Matthias Apitz g...@unixarea.de wrote: Hi, Sometimes, while compiling all my ports, I encounter the following problem: Say, we are installing ports/A which depends on ports/B; the Makefile detects the dependency and goes to install ports/B; if now during the final installation process, some files are already delivered to /usr/local, some files not, the system goes down (by intention because it's time to go out), before the installation of ports/B is fully done and registered to /var/db/pkg, next time when you restart installing ports/A it often sees, because the file referenced in the Makefile was allready installed (while others not), it thinks that ports/B was installed fine and proceeds with ports/A which later (or even in some other area) gives an error due to missing files of ports/B; I think, the only solution is that the dependency is not only based on some (random) file of B, but on the fact if B was *fully* installed and registered in /var/db/pkg; comments? Installing a port isn't atomic by definition; the larger ones have loads of files that need installed. If I read your description carefully, your solution is to simply avoid interrupting during the installation phase. Chris ___ 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
Re: problems with half installed ports
On Thu, 11 Apr 2013 11:36:54 +0100 Chris Rees articulated: Installing a port isn't atomic by definition; the larger ones have loads of files that need installed. If I read your description carefully, your solution is to simply avoid interrupting during the installation phase. Unless you happen to suffer from a catastrophic power failure and don't have a functional UPS installed. In that case, you will probably have to do a forcible uninstall of all of the affected ports and start over. pkg_delete -dfv port works for me. -- Jerry ♔ Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __ ___ 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
Re: problems with half installed ports
Matthias Apitz wrote: Say, we are installing ports/A which depends on ports/B; the Makefile detects the dependency and goes to install ports/B; if now during the final installation process, some files are already delivered to /usr/local, some files not, the system goes down (by intention because it's time to go out), before the installation of ports/B is fully done and registered to /var/db/pkg, next time when you restart installing ports/A it often sees, because the file referenced in the Makefile was allready installed (while others not), it thinks that ports/B was installed fine and proceeds with ports/A which later (or even in some other area) gives an error due to missing files of ports/B; I think, the only solution is that the dependency is not only based on some (random) file of B, but on the fact if B was *fully* installed and registered in /var/db/pkg; There is a case where this will break: if multiple ports install the same file, and you don't care which of them installed it, then you need to depend on the file, not on a specific port. For example, both www/node and www/node-devel install the same binary, and dependent ports will work with either of them. Now, it's true that using files as a proxy for interchangeable ports isn't ideal, and we could do better... 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. ___ 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
Re: problems with half installed ports
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.0 +0200 +++ Mk/bsd.commands.mk 2013-04-11 14:15:49.0 +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.0 +0200 +++ Mk/bsd.port.mk 2013-04-11 16:35:42.0 +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
Re: problems with half installed ports
On 11 Apr 2013 14:48, Vitaly Magerya vmage...@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.0 +0200 +++ Mk/bsd.commands.mk 2013-04-11 14:15:49.0 +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.0 +0200 +++ Mk/bsd.port.mk 2013-04-11 16:35:42.0 +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 ___ 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