Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Dec 2005 05:29:25 +1100 (EST)
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/89809: Ports INDEX cannot be moved out of ports tree
Message-ID:  <200512011829.jB1ITP2J023238@server.vk2pj.dyndns.org>
Resent-Message-ID: <200512011840.jB1Ie2XJ059746@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         89809
>Category:       ports
>Synopsis:       Ports INDEX cannot be moved out of ports tree
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 01 18:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Peter Jeremy
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
n/a
>Environment:
System: FreeBSD server.vk2pj.dyndns.org 7.0-CURRENT FreeBSD 7.0-CURRENT #13: Mon Nov 14 19:37:17 EST 2005 root@server.vk2pj.dyndns.org:/var/obj/k7/usr/src/sys/server i386

>Description:
	As well as the ports sources, the ports tree (/usr/ports) stores the
	following files, most of which can be moved:
	- INDEX-*  This is hard-wired in the Makefile infrastructure
	- Compilation/work directories - overridable with WRKDIRPREFIX
	- distfiles - overridable with DISTDIR
	- packages - overridable with PACKAGES
	- portupgrade's INDEX*.db - overridable with PORTS_DBDIR

	The INDEX file can be renamed by setting INDEXFILE but it is always
	prepended with ${.CURDIR} or ${PORTSDIR}.  This means you can change
	it's name but you can't move it out of the ports tree.  Symlinks
	won't work because 'make index' begins with
		rm -f ${.CURDIR}/${INDEXFILE}
	(though 'make INDEX' avoids this).

	For consistency it would be nice if the INDEX also has an over-
	ridable directory path (eg INDEXDIRcvs).  Note that portupgrade
	already allows the INDEX pathname to be overridden with PORTS_INDEX

>How-To-Repeat:
	Code inspection in ports/Makefile and ports/Mk/bsd.ports.mk

>Fix:
	The following may work.  I'm waiting for 'make index' to complete.

Index: Makefile
===================================================================
RCS file: /usr/ncvs/ports/Makefile,v
retrieving revision 1.91
diff -u -r1.91 Makefile
--- Makefile	8 Nov 2005 13:32:54 -0000	1.91
+++ Makefile	1 Dec 2005 18:21:38 -0000
@@ -67,11 +67,11 @@
 .include <bsd.port.subdir.mk>
 
 index:
-	@rm -f ${.CURDIR}/${INDEXFILE}
-	@cd ${.CURDIR} && make ${.CURDIR}/${INDEXFILE}
+	@rm -f ${INDEXDIR}/${INDEXFILE}
+	@cd ${.CURDIR} && make ${INDEXDIR}/${INDEXFILE}
 
 fetchindex:
-	@cd ${.CURDIR} && ${FETCHINDEX} ${MASTER_SITE_INDEX}/${INDEXFILE}.bz2 && bunzip2 -f ${INDEXFILE}.bz2 && chmod a+r ${INDEXFILE}
+	@cd ${INDEXDIR} && ${FETCHINDEX} ${MASTER_SITE_INDEX}/${INDEXFILE}.bz2 && bunzip2 -f ${INDEXFILE}.bz2 && chmod a+r ${INDEXFILE}
 
 MASTER_SITE_INDEX?=	http://www.FreeBSD.org/ports/
 FETCHINDEX?=	fetch -am
@@ -85,7 +85,7 @@
 INDEX_ECHO_1ST=		echo
 .endif
 
-${.CURDIR}/${INDEXFILE}:
+${INDEXDIR}/${INDEXFILE}:
 	@${INDEX_ECHO_1ST} "Generating ${INDEXFILE} - please wait.."; \
 	if [ "${INDEX_PRISTINE}" != "" ]; then \
 		export LOCALBASE=/nonexistentlocal; \
@@ -119,18 +119,18 @@
 	cat $${tmpdir}/${INDEXFILE}.desc.* | perl ${.CURDIR}/Tools/make_index | \
 		sed -e 's/  */ /g' -e 's/|  */|/g' -e 's/  *|/|/g' -e 's./..g' | \
 		sort -t '|' +1 -2 | \
-		sed -e 's../.g' > ${.CURDIR}/${INDEXFILE}.tmp; \
+		sed -e 's../.g' > ${INDEXDIR}/${INDEXFILE}.tmp; \
 	if [ "${INDEX_PRISTINE}" != "" ]; then \
 		sed -e "s,$${LOCALBASE},/usr/local," -e "s,$${X11BASE},/usr/X11R6," \
-			${.CURDIR}/${INDEXFILE}.tmp > ${.CURDIR}/${INDEXFILE}; \
+			${INDEXDIR}/${INDEXFILE}.tmp > ${INDEXDIR}/${INDEXFILE}; \
 	else \
-		mv ${.CURDIR}/${INDEXFILE}.tmp ${.CURDIR}/${INDEXFILE}; \
+		mv ${INDEXDIR}/${INDEXFILE}.tmp ${INDEXDIR}/${INDEXFILE}; \
 	fi; \
 	rm -rf $${tmpdir}; \
 	echo " Done."
 
-print-index:	${.CURDIR}/${INDEXFILE}
-	@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nE-deps:\t%s\nP-deps:\t%s\nF-deps:\t%s\nWWW:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${.CURDIR}/${INDEXFILE}
+print-index:	${INDEXDIR}/${INDEXFILE}
+	@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nE-deps:\t%s\nP-deps:\t%s\nF-deps:\t%s\nWWW:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${INDEXDIR}/${INDEXFILE}
 
 CVS?= cvs
 SUP?= cvsup
Index: Mk/bsd.port.mk
===================================================================
RCS file: /usr/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.518
diff -u -r1.518 bsd.port.mk
--- Mk/bsd.port.mk	8 Nov 2005 09:02:51 -0000	1.518
+++ Mk/bsd.port.mk	1 Dec 2005 18:22:55 -0000
@@ -1204,6 +1204,7 @@
 LINUXBASE?=		${DESTDIR}/compat/linux
 DISTDIR?=		${PORTSDIR}/distfiles
 _DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
+INDEXDIR?=		${PORTSDIR}
 .if ${OSVERSION} >= 500036
 INDEXFILE?=		INDEX-${OSVERSION:C/([0-9]).*/\1/}
 .else
@@ -4790,7 +4791,7 @@
 	defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
 	defined(LIB_DEPENDS) || defined(DEPENDS)
 	@${ECHO_CMD} -n 'This port requires package(s) "'
-	@${ECHO_CMD} -n `${GREP} '^${PKGNAME}|' ${PORTSDIR}/${INDEXFILE} | ${AWK} -F\| '{print $$8;}'`
+	@${ECHO_CMD} -n `${GREP} '^${PKGNAME}|' ${INDEXDIR}/${INDEXFILE} | ${AWK} -F\| '{print $$8;}'`
 	@${ECHO_CMD} '" to build.'
 .endif
 .endif
@@ -4799,7 +4800,7 @@
 pretty-print-run-depends-list:
 .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
 	@${ECHO_CMD} -n 'This port requires package(s) "'
-	@${ECHO_CMD} -n `${GREP} '^${PKGNAME}|' ${PORTSDIR}/${INDEXFILE} | ${AWK} -F\| '{print $$9;}'`
+	@${ECHO_CMD} -n `${GREP} '^${PKGNAME}|' ${INDEXDIR}/${INDEXFILE} | ${AWK} -F\| '{print $$9;}'`
 	@${ECHO_CMD} '" to run.'
 .endif
 .endif
Index: Mk/bsd.port.subdir.mk
===================================================================
RCS file: /usr/ncvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.61
diff -u -r1.61 bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk	8 Nov 2005 09:02:51 -0000	1.61
+++ Mk/bsd.port.subdir.mk	1 Dec 2005 18:22:56 -0000
@@ -240,7 +240,7 @@
 .if defined(PORTSTOP)
 readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
 	@${ECHO_MSG} "===>   Creating README.html for all ports"
-	@perl ${PORTSDIR}/Tools/make_readmes < ${PORTSDIR}/${INDEXFILE}
+	@perl ${PORTSDIR}/Tools/make_readmes < ${INDEXDIR}/${INDEXFILE}
 .else
 readmes: readme
 .endif
@@ -333,7 +333,7 @@
 PORTSEARCH_XKEYLIM?=0
 PORTSEARCH_IGNORECASE?=1
 
-search: ${PORTSDIR}/${INDEXFILE}
+search: ${INDEXDIR}/${INDEXFILE}
 	@here=${.CURDIR}; \
 	cd ${PORTSDIR}; \
 	if [ -z "$$key"   -a -z "$$xkey"   -a \
@@ -431,4 +431,4 @@
 	      if (i in disp) \
 	        printf("%s:\t%s\n", names[i], $$i); \
 	    print(""); \
-	  }' ${PORTSDIR}/${INDEXFILE}
+	  }' ${INDEXDIR}/${INDEXFILE}

Index: ports.7
===================================================================
RCS file: /usr/ncvs/src/share/man/man7/ports.7,v
retrieving revision 1.52
diff -u -r1.52 ports.7
--- ports.7	20 Jul 2005 22:22:53 -0000	1.52
+++ ports.7	1 Dec 2005 18:28:40 -0000
@@ -359,6 +359,10 @@
 Useful if
 .Va PORTSDIR
 is read-only (perhaps mounted from a CD-ROM).
+.It Va INDEXDIR
+Where to create or locate the ports INDEX file.
+It is normally set to
+.Va PORTSDIR .
 .It Va DISTDIR
 Where to find/put distfiles, normally
 .Pa distfiles/
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512011829.jB1ITP2J023238>