Date: Mon, 07 Mar 2005 22:27:36 +0300 From: Sergey Matveychuk <sem@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/78554: [patch] bsd.port.mk: allow install port with the same version in different PREFIX Message-ID: <E1D8NtA-000JXC-Q1@stable-5.sem-home.ciam.ru> Resent-Message-ID: <200503071930.j27JU3RB006233@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 78554 >Category: ports >Synopsis: [patch] bsd.port.mk: allow install port with the same version in different PREFIX >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Mar 07 19:30:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Sergey Matveychuk >Release: FreeBSD 5.3-RELEASE-p4 i386 >Organization: >Environment: System: FreeBSD stable-5.sem-home.ciam.ru 5.3-RELEASE-p4 FreeBSD 5.3-RELEASE-p4 #13: Fri Jan 14 04:39:21 MSK 2005 root@stable-5.sem-home.ciam.ru:/usr/obj/usr/src/sys/CURRENT i386 >Description: Now days we can install port with different PREFIX only if PKGNAME differ. But it really discouraged. Two ports with different PREFIX can't have conflicts (ideally). The reason for it is simple: package meta info saves in PKG_DBDIR/PKGNAME. This patch solves it. Packages are another thing. I think most packages will not work is they installed with other PREFIX (pkg_add -p) than it was compiled. So I did not touch pkg_install tools. But they can be changed similarly. >How-To-Repeat: Do it in any port: make install make PREFIX=/some_place install >Fix: --- bsd.port.mk.diff begins here --- Index: bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.510 diff -u -r1.510 bsd.port.mk --- bsd.port.mk 28 Feb 2005 21:09:04 -0000 1.510 +++ bsd.port.mk 7 Mar 2005 18:52:07 -0000 @@ -879,13 +879,16 @@ # PKG_DBDIR - Where package installation is recorded; this directory # must not contain anything else. # Default: /var/db/pkg +# DBNAME - Directory name in ${PKG_DBDIR} where package metadata stored. +# Default: ${PKGNAME} if user use default PREFIX, +# ${PKGNAME}:${PREFIX:S/\//_/g} otherwise. # PORT_DBDIR - Where port configuration options are recorded. # Default: /var/db/ports # NO_PKG_REGISTER # - Don't register a port installation as a package. # FORCE_PKG_REGISTER # - If set, it will overwrite any existing package -# registration information in ${PKG_DBDIR}/${PKGNAME}. +# registration information in ${PKG_DBDIR}/${DBNAME}. # NO_DEPENDS - Don't verify build of dependencies. # NO_CHECKSUM - Don't verify the checksum. Typically used when # when you noticed the distfile you just fetched has @@ -1202,6 +1205,11 @@ .if defined(USE_X_PREFIX) USE_XLIB= yes .endif +.if defined(PREFIX) +DBNAME= ${PKGNAME}:${PREFIX:S/\//_/g} +.else +DBNAME= ${PKGNAME} +.endif .if defined(USE_X_PREFIX) PREFIX?= ${X11BASE} .elif defined(USE_LINUX_PREFIX) @@ -3467,8 +3475,8 @@ fi; \ done; \ fi; \ - if [ -d ${PKG_DBDIR}/${PKGNAME} -o -n "$${found_package}" ]; then \ - if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \ + if [ -d ${PKG_DBDIR}/${DBNAME} -o -n "$${found_package}" ]; then \ + if [ -d ${PKG_DBDIR}/${DBNAME} ]; then \ ${ECHO_CMD} "===> ${PKGNAME} is already installed"; \ else \ ${ECHO_CMD} "===> An older version of ${PKGORIGIN} is already installed ($${found_package})"; \ @@ -4909,28 +4917,28 @@ @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi @${RM} -f /tmp/${PKGNAME}-required-by .if defined(FORCE_PKG_REGISTER) - @if [ -e ${PKG_DBDIR}/${PKGNAME}/+REQUIRED_BY ]; then \ - ${CP} ${PKG_DBDIR}/${PKGNAME}/+REQUIRED_BY /tmp/${PKGNAME}-required-by; \ + @if [ -e ${PKG_DBDIR}/${DBNAME}/+REQUIRED_BY ]; then \ + ${CP} ${PKG_DBDIR}/${DBNAME}/+REQUIRED_BY /tmp/${PKGNAME}-required-by; \ fi - @${RM} -rf ${PKG_DBDIR}/${PKGNAME} + @${RM} -rf ${PKG_DBDIR}/${DBNAME} .endif - @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ + @if [ ! -d ${PKG_DBDIR}/${DBNAME} ]; then \ ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ - ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \ - ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ - ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \ - ${ECHO_CMD} ${COMMENT:Q} > ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ + ${MKDIR} ${PKG_DBDIR}/${DBNAME}; \ + ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${DBNAME}/+CONTENTS; \ + ${CP} ${DESCR} ${PKG_DBDIR}/${DBNAME}/+DESC; \ + ${ECHO_CMD} ${COMMENT:Q} > ${PKG_DBDIR}/${DBNAME}/+COMMENT; \ if [ -f ${PKGINSTALL} ]; then \ - ${CP} ${PKGINSTALL} ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \ + ${CP} ${PKGINSTALL} ${PKG_DBDIR}/${DBNAME}/+INSTALL; \ fi; \ if [ -f ${PKGDEINSTALL} ]; then \ - ${CP} ${PKGDEINSTALL} ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \ + ${CP} ${PKGDEINSTALL} ${PKG_DBDIR}/${DBNAME}/+DEINSTALL; \ fi; \ if [ -f ${PKGREQ} ]; then \ - ${CP} ${PKGREQ} ${PKG_DBDIR}/${PKGNAME}/+REQUIRE; \ + ${CP} ${PKGREQ} ${PKG_DBDIR}/${DBNAME}/+REQUIRE; \ fi; \ if [ -f ${PKGMESSAGE} ]; then \ - ${CP} ${PKGMESSAGE} ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \ + ${CP} ${PKGMESSAGE} ${PKG_DBDIR}/${DBNAME}/+DISPLAY; \ 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 \ @@ -4943,11 +4951,11 @@ fi .if !defined(NO_MTREE) @if [ -f ${MTREE_FILE} ]; then \ - ${CP} ${MTREE_FILE} ${PKG_DBDIR}/${PKGNAME}/+MTREE_DIRS; \ + ${CP} ${MTREE_FILE} ${PKG_DBDIR}/${DBNAME}/+MTREE_DIRS; \ fi .endif @if [ -e /tmp/${PKGNAME}-required-by ]; then \ - ${CAT} /tmp/${PKGNAME}-required-by >> ${PKG_DBDIR}/${PKGNAME}/+REQUIRED_BY; \ + ${CAT} /tmp/${PKGNAME}-required-by >> ${PKG_DBDIR}/${DBNAME}/+REQUIRED_BY; \ ${RM} -f /tmp/${PKGNAME}-required-by; \ fi .else --- bsd.port.mk.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1D8NtA-000JXC-Q1>