Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Apr 2003 12:38:48 +0200 (CEST)
From:      Erwin Lansing <erwin@lansing.dk>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/50669: fix fetch-required wrt :target 
Message-ID:  <200304071038.h37Acl5V083537@lemur.droso.net>
Resent-Message-ID: <200304071040.h37Ae8kl028150@freefall.freebsd.org>

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

>Number:         50669
>Category:       ports
>Synopsis:       fix fetch-required wrt :target
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 07 03:40:08 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Erwin Lansing
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
pil.dk 
>Environment:
System: FreeBSD lemur.droso.net 4.8-STABLE FreeBSD 4.8-STABLE #0: Sat Apr 5 16:37:20 CEST 2003 root@panda.droso.net:/usr/obj/usr/src/sys/PANDA i386


	
>Description:

As discussed in 48473, the fetch-required target does not take dependencies with
:target in account. With the following patch, dependencies without :target are
tested whether they are installed and fetched if not, while dependencies with :target
have a simple test whether the file listed as dependency exists. The error occurs on
bento as bento first pkg_add's dependencies, then it was tested whether it was installed
and the distfile was not fetched. When the actual dependency where the sources, bento
fails as the distfile is not found. The test is rather simplistic, but as most cases
depend on ${NONEXISTENT} (and thereby always fetched) this should not be a problem.

Tested with: x11/9term and print/ft2demos
Requested by: kris

>How-To-Repeat:
	
>Fix:

	

--- required.diff begins here ---
--- bsd.port.mk.orig	Mon Apr  7 11:23:14 2003
+++ bsd.port.mk	Mon Apr  7 12:21:56 2003
@@ -3634,26 +3638,60 @@
 .endif
 
 .if !target(fetch-required)
-fetch-required:
+fetch-required: fetch
 	@${ECHO_MSG} "===> Fetching all required distfiles for ${PKGNAME} and dependencies"
-	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; \
-		tmp=`${MAKE} -V PKGNAME`; \
-		if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
-			${MAKE} fetch; \
-		fi );  \
+.for deptype in EXTRACT PATCH FETCH BUILD RUN
+.if defined(${deptype}_DEPENDS)
+.if !defined(NO_DEPENDS)
+	@for i in ${${deptype}_DEPENDS}; do \
+		prog=`${ECHO_CMD} $$i | ${SED} -e 's/:.*//'`; \
+		dir=`${ECHO_CMD} $$i | ${SED} -e 's/[^:]*://'`; \
+		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
+			dir=`${ECHO_CMD} $$dir | ${SED} -e 's/:.*//'`; \
+			if ${EXPR} "$$prog" : \\/ >/dev/null; then \
+				if [ ! -e "$$prog" ]; then \
+					(cd $$dir; ${MAKE} fetch); \
+				fi; \
+			fi; \
+		else \
+			(cd $$dir; \
+			tmp=`${MAKE} -V PKGNAME`; \
+			if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
+				${MAKE} fetch; \
+			fi );  \
+		fi; \
 	done
 .endif
+.endif
+.endfor
+.endif
 
 .if !target(fetch-required-list)
-fetch-required-list:
-	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; \
-		tmp=`${MAKE} -V PKGNAME`; \
-		if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
-			${MAKE} fetch-list; \
-		fi );  \
+fetch-required-list: fetch-list
+.for deptype in EXTRACT PATCH FETCH BUILD RUN
+.if defined(${deptype}_DEPENDS)
+.if !defined(NO_DEPENDS)
+	@for i in ${${deptype}_DEPENDS}; do \
+		prog=`${ECHO_CMD} $$i | ${SED} -e 's/:.*//'`; \
+		dir=`${ECHO_CMD} $$i | ${SED} -e 's/[^:]*://'`; \
+		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
+			dir=`${ECHO_CMD} $$dir | ${SED} -e 's/:.*//'`; \
+			if ${EXPR} "$$prog" : \\/ >/dev/null; then \
+				if [ ! -e "$$prog" ]; then \
+					(cd $$dir; ${MAKE} fetch-list); \
+				fi; \
+			fi; \
+		else \
+			(cd $$dir; \
+			tmp=`${MAKE} -V PKGNAME`; \
+			if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \
+				${MAKE} fetch-list; \
+			fi );  \
+		fi; \
 	done
+.endif
+.endif
+.endfor
 .endif
 
 .if !target(checksum-recursive)
--- required.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?200304071038.h37Acl5V083537>