Bug 89809 - [patch] Ports INDEX cannot be moved out of ports tree
Summary: [patch] Ports INDEX cannot be moved out of ports tree
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-01 18:40 UTC by Peter Jeremy
Modified: 2006-01-28 02:14 UTC (History)
0 users

See Also:


Attachments
file.diff (4.67 KB, patch)
2005-12-01 18:40 UTC, Peter Jeremy
no flags Details | Diff
file.diff (530 bytes, patch)
2005-12-01 18:40 UTC, Peter Jeremy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy 2005-12-01 18:40:02 UTC
	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

Fix: The following may work.  I'm waiting for 'make index' to complete.
How-To-Repeat: 	Code inspection in ports/Makefile and ports/Mk/bsd.ports.mk
Comment 1 Erwin Lansing freebsd_committer freebsd_triage 2005-12-01 18:57:43 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Infrastructure change to portmgr.
Comment 2 Peter Jeremy 2005-12-04 00:04:07 UTC
The patch supplied in the PR was incomplete and fails in the case
where INDEXDIR is not set.  The following patch replaces the
previously supplied patch for Mk/bsd.port.subdir.mk:

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	3 Dec 2005 19:57:46 -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
@@ -265,6 +265,7 @@
 .endif
 COMMENTFILE?=	${.CURDIR}/pkg/COMMENT
 DESCR?=		${.CURDIR}/pkg/DESCR
+INDEXDIR?=	${PORTSDIR}
 .if ${OSVERSION} >= 600000
 INDEXFILE?=	INDEX-6
 .elif ${OSVERSION} >= 500036
@@ -333,7 +334,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 +432,4 @@
 	      if (i in disp) \
 	        printf("%s:\t%s\n", names[i], $$i); \
 	    print(""); \
-	  }' ${PORTSDIR}/${INDEXFILE}
+	  }' ${INDEXDIR}/${INDEXFILE}

-- 
Peter Jeremy
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2006-01-12 04:12:24 UTC
State Changed
From-To: open->feedback

Here is a patch that combines changes from this PR as well as ports/89363 
and ports/91086.  Since I do not have the proxy problem, the submitters of 
those latter two PRs need to test to see if I have properly combined the 
fixes.  The current one seems to DTRT with respect to fetching otherwise. 
I have not yet tested searching or readmes. 

Note: this patch is against the files as currently running on 5-exp (and 
also devel/portmk), so there may be some drift. 

--- Makefile.5-exp	Wed Jan 11 20:46:40 2006 
+++ Makefile	Wed Jan 11 21:23:34 2006 
@@ -67,14 +67,19 @@ 
.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} 
+fetchindex: ${INDEXDIR}/{INDEXFILE}.bz2 
+	@bunzip2 < ${INDEXDIR}/${INDEXFILE}.bz2 > ${INDEXDIR}/${INDEXFILE} 
+	@chmod a+r ${INDEXDIR}/${INDEXFILE} 
+ 
+${INDEXDIR}/{INDEXFILE}.bz2: .PHONY 
+	@${FETCHINDEX} -o ${INDEXDIR}/${INDEXFILE}.bz2 ${MASTER_SITE_INDEX}${INDEXFILE}.bz2 

MASTER_SITE_INDEX?=	http://www.FreeBSD.org/ports/ 
-FETCHINDEX?=	fetch -am 
+SETENV?=	/usr/bin/env 
+FETCHINDEX?=	${SETENV} ${FETCH_ENV} fetch -am 
INDEX_JOBS?=	2 

.if !defined(INDEX_VERBOSE) 
@@ -85,7 +90,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 +124,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%snPath:t%snInfo:t%snMaint:t%snIndex:t%snB-deps:t%snR-deps:t%snE-deps:t%snP-deps:t%snF-deps:t%snWWW:t%snn", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${.CURDIR}/${INDEXFILE} 
+print-index:	${INDEXDIR}/${INDEXFILE} 
+	@awk -F| '{ printf("Port:t%snPath:t%snInfo:t%snMaint:t%snIndex:t%snB-deps:t%snR-deps:t%snE-deps:t%snP-deps:t%snF-deps:t%snWWW:t%snn", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${INDEXDIR}/${INDEXFILE} 

CVS?= cvs 
SUP?= cvsup 
--- Mk/bsd.port.mk.5-exp	Wed Jan 11 20:50:57 2006 
+++ Mk/bsd.port.mk	Wed Jan 11 20:58:30 2006 
@@ -1224,6 +1224,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 
@@ -4905,11 +4906,11 @@ 
# The following two targets require an up-to-date INDEX in ${PORTSDIR} 

_PRETTY_PRINT_DEPENDS_LIST= 
-	if [ ! -r ${PORTSDIR}/${INDEXFILE} ] ; then  
+	if [ ! -r ${INDEXDIR}/${INDEXFILE} ] ; then  
${ECHO_CMD} "${.TARGET} requires an INDEX file (${INDEXFILE}). Please run make index or make fetchindex.";  
else  
${ECHO_CMD} -n 'This port requires package(s) "' ;  
-		${ECHO_CMD} -n `${AWK} -F| '$$1 ~ /^${PKGNAME}/ {print $$8;}' ${PORTSDIR}/${INDEXFILE}` ;  
+		${ECHO_CMD} -n `${AWK} -F| '$$1 ~ /^${PKGNAME}/ {print $$8;}' ${INDEXDIR}/${INDEXFILE}` ;  
${ECHO_CMD} '" to ${.TARGET:C/pretty-print-(.*)-depends-list/1/}.';  
fi; 
--- Mk/bsd.port.subdir.mk.5-exp	Wed Jan 11 20:50:50 2006 
+++ Mk/bsd.port.subdir.mk	Wed Jan 11 21:05:42 2006 
@@ -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 
@@ -265,6 +265,7 @@ 
.endif 
COMMENTFILE?=	${.CURDIR}/pkg/COMMENT 
DESCR?=		${.CURDIR}/pkg/DESCR 
+INDEXDIR?=	${PORTSDIR} 
.if ${OSVERSION} >= 500036 
INDEXFILE?=	INDEX-${OSVERSION:C/([0-9]).*/1/} 
.else 
@@ -333,7 +334,7 @@ 

_PORTSEARCH=	 
here=${.CURDIR};  
-	if [ ! -r ${PORTSDIR}/${INDEXFILE} ] ; then  
+	if [ ! -r ${INDEXDIR}/${INDEXFILE} ] ; then  
echo "The ${.TARGET} target requires ${INDEXFILE}. Please run make index or make fetchindex.";  
else  
cd ${PORTSDIR};  
@@ -437,7 +438,7 @@ 
if (i in disp)  
printf("%s:t%sn", names[i], $$i);  
print("");  
-	  }' ${PORTSDIR}/${INDEXFILE} ; fi 
+	  }' ${INDEXDIR}/${INDEXFILE} 

search: 
@${_PORTSEARCH}
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2006-01-21 19:59:22 UTC
State Changed
From-To: feedback->analyzed

The combined patch based on this PR and 89363 and 91086 has now been accepted 
for a test build on the cluster.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2006-01-28 02:14:36 UTC
State Changed
From-To: analyzed->closed

Committed, thanks.