From owner-p4-projects@FreeBSD.ORG Mon Jul 17 13:12:46 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E489016A4DD; Mon, 17 Jul 2006 13:12:45 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88AE916A4DE for ; Mon, 17 Jul 2006 13:12:45 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2C5143D4C for ; Mon, 17 Jul 2006 13:12:44 +0000 (GMT) (envelope-from gabor@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6HDCiPO094590 for ; Mon, 17 Jul 2006 13:12:44 GMT (envelope-from gabor@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6HDCiJx094587 for perforce@freebsd.org; Mon, 17 Jul 2006 13:12:44 GMT (envelope-from gabor@FreeBSD.org) Date: Mon, 17 Jul 2006 13:12:44 GMT Message-Id: <200607171312.k6HDCiJx094587@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@FreeBSD.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Cc: Subject: PERFORCE change 101759 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jul 2006 13:12:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=101759 Change 101759 by gabor@gabor_spitfire on 2006/07/17 13:12:19 Fix all pkg_ commands to be chrooted by defining the PKG_ variables appropriately. This change also makes the code simpler and shorter. Affected files ... .. //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#30 edit Differences ... ==== //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#30 (text+ko) ==== @@ -2231,18 +2231,33 @@ .if ${OSVERSION} < 491101 && ${PKGORIGIN} != "sysutils/pkg_install" EXTRACT_DEPENDS+= ${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/sysutils/pkg_install .endif +.if !defined(DESTDIR) PKG_CMD?= ${LOCALBASE_REL}/sbin/pkg_create PKG_ADD?= ${LOCALBASE_REL}/sbin/pkg_add PKG_DELETE?= ${LOCALBASE_REL}/sbin/pkg_delete PKG_INFO?= ${LOCALBASE_REL}/sbin/pkg_info PKG_VERSION?= ${LOCALBASE_REL}/sbin/pkg_version .else +PKG_CMD?= ${LOCALBASE_REL}/sbin/pkg_create +PKG_ADD?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_add +PKG_DELETE?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_delete +PKG_INFO?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_info +.endif +.else +.if !defined(DESTDIR) 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 +.else +PKG_CMD?= /usr/sbin/pkg_create +PKG_ADD?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_add +PKG_DELETE?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_delete +PKG_INFO?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_info +PKG_VERSION?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_version .endif +.endif # Does the pkg_create tool support conflict checking? # XXX Slow? @@ -3542,7 +3557,6 @@ .if !target(check-conflicts) check-conflicts: .if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS) -.if !defined(DESTDIR) @found=`${PKG_INFO} -I ${CONFLICTS:C/.+/'&'/} 2>/dev/null | ${AWK} '{print $$1}'`; \ conflicts_with=; \ for entry in $${found}; do \ @@ -3565,30 +3579,6 @@ ${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \ exit 1; \ fi -.else - @found=`${CHROOT} ${DESTDIR} ${PKG_INFO} -I ${CONFLICTS:C/.+/'&'/} 2>/dev/null | ${AWK} '{print $$1}'`; \ - conflicts_with=; \ - for entry in $${found}; do \ - if ${CHROOT} ${DESTDIR} ${PKG_INFO} -e $${entry} ; then \ - prfx=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -p "$${entry}" 2> /dev/null | ${SED} -ne '1s/^@cwd //p'`; \ - orgn=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -o "$${entry}" 2> /dev/null`; \ - if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \ - conflicts_with="$${conflicts_with} $${entry}"; \ - fi; \ - fi; \ - done; \ - if [ -n "$${conflicts_with}" ]; then \ - ${ECHO_MSG}; \ - ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s) in ${DESTDIR}: "; \ - for entry in $${conflicts_with}; do \ - ${ECHO_MSG} " $${entry}"; \ - done; \ - ${ECHO_MSG}; \ - ${ECHO_MSG} " They install files into the same place."; \ - ${ECHO_MSG} " Please remove them first with pkg_delete(1) from ${DESTDIR}."; \ - exit 1; \ - fi -.endif .endif # CONFLICTS .endif @@ -3709,7 +3699,10 @@ check-already-installed: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) .if !defined(DESTDIR) - @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed"; \ + @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed" +.else + @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed in ${DESTDIR}" +.endif ${MKDIR} ${PKG_DBDIR}; \ already_installed=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ if [ -n "$${already_installed}" ]; then \ @@ -3724,23 +3717,6 @@ fi; \ done; \ fi -.else - @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed in ${DESTDIR}"; \ - ${MKDIR} ${PKG_DBDIR}; \ - already_installed=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -O ${PKGORIGIN}`; \ - if [ -n "$${already_installed}" ]; then \ - for p in $${already_installed}; do \ - prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ - if [ "x${PREFIX}" = "x$${prfx}" ]; then \ - df=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -f $${p} 2> /dev/null | ${GREP} -v "^@" | ${COMM} -12 - ${TMPPLIST}`; \ - if [ -n "$${df}" ]; then \ - found_package=$${p}; \ - break; \ - fi; \ - fi; \ - done; \ - fi -.endif @if [ -d ${PKG_DBDIR}/${PKGNAME} -o -n "$${found_package}" ]; then \ if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \ ${ECHO_CMD} "===> ${PKGNAME} is already installed"; \ @@ -4218,6 +4194,9 @@ .else .if !defined(DESTDIR) @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" +.else + @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" +.endif @found_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ for p in $${found_names}; do \ check_name=`${ECHO_CMD} $${p} | ${SED} -e 's/-[^-]*$$//'`; \ @@ -4235,28 +4214,8 @@ ${ECHO_MSG} "===> ${PKGBASE} not installed, skipping"; \ fi @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} -.else - @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" - @found_names=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -O ${PKGORIGIN}`; \ - for p in $${found_names}; do \ - check_name=`${ECHO_CMD} $${p} | ${SED} -e 's/-[^-]*$$//'`; \ - if [ "$${check_name}" = "${PKGBASE}" ]; then \ - prfx=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ - if [ "x${PREFIX}" = "x$${prfx}" ]; then \ - ${ECHO_MSG} "===> Deinstalling $${p}"; \ - ${CHROOT} ${DESTDIR} ${PKG_DELETE} -f $${p}; \ - else \ - ${ECHO_MSG} "===> $${p} has a different PREFIX: $${prfx}, skipping"; \ - fi; \ - fi; \ - done; \ - if [ -z "$${found_names}" ]; then \ - ${ECHO_MSG} "===> ${PKGBASE} not installed in ${DESTDIR}, skipping"; \ - fi - @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif .endif -.endif # Deinstall-all # @@ -4272,6 +4231,9 @@ .else .if !defined(DESTDIR) @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" +.else + @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" +.endif @deinstall_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ if [ -n "$${deinstall_names}" ]; then \ for d in $${deinstall_names}; do \ @@ -4280,22 +4242,10 @@ done; \ else \ ${ECHO_MSG} "===> ${PKGORIGIN} not installed, skipping"; \ - fi -.else - @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" - @deinstall_names=`${CHROOT} ${DESTDIR} ${PKG_INFO} -q -O ${PKGORIGIN}`; \ - if [ -n "$${deinstall_names}" ]; then \ - for d in $${deinstall_names}; do \ - ${ECHO_MSG} "===> Deinstalling $${d} from ${DESTDIR}"; \ - ${CHROOT} ${DESTDIR} ${PKG_DELETE} -f $${d}; \ - done; \ - else \ - ${ECHO_MSG} "===> ${PKGORIGIN} not installed in ${DESTDIR}, skipping"; \ - fi + fi; \ + ${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif - @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif -.endif # Cleaning up @@ -4680,6 +4630,8 @@ _DEPEND_ALWAYS= 0 .endif +### FIXME: that pkg_add should be fixed for DESTDIR + _INSTALL_DEPENDS= \ if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \ subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \ @@ -5535,9 +5487,8 @@ fi; \ if [ -f ${PKGMESSAGE} ]; then \ ${CP} ${PKGMESSAGE} ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \ - fi -.if !defined(DESTDIR) - @for dep in `${PKG_INFO} -qf ${PKGNAME} | ${GREP} -w ^@pkgdep | ${AWK} '{print $$2}' | ${SORT} -u`; do \ + fi; \ + for dep in `${PKG_INFO} -qf ${PKGNAME} | ${GREP} -w ^@pkgdep | ${AWK} '{print $$2}' | ${SORT} -u`; do \ if [ -d ${PKG_DBDIR}/$$dep -a -z `${ECHO_CMD} $$dep | ${GREP} -E ${PKG_IGNORE_DEPENDS}` ]; then \ if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \ >/dev/null 2>&1; then \ @@ -5545,16 +5496,6 @@ fi; \ fi; \ done -.else - @for dep in `${CHROOT} ${DESTDIR} ${PKG_INFO} -qf ${PKGNAME} | ${GREP} -w ^@pkgdep | ${AWK} '{print $$2}' | ${SORT} -u`; do \ - if [ -d ${PKG_DBDIR}/$$dep -a -z `${ECHO_CMD} $$dep | ${GREP} -E ${PKG_IGNORE_DEPENDS}` ]; then \ - if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \ - >/dev/null 2>&1; then \ - ${ECHO_CMD} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \ - fi; \ - fi; \ - done -.endif .endif .if !defined(NO_MTREE) @if [ -f ${MTREE_FILE} ]; then \