Bug 12548

Summary: New 'fecth-recursive(-list)' targets in ports
Product: Ports & Packages Reporter: k <k>
Component: Individual Port(s)Assignee: Satoshi Asami <asami>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description k 1999-07-07 15:20:01 UTC
	Sometimes I would like to be able to fetch the distfiles 
	for a port AND all its dependencies before actually building.

	I have written a new target for the bsd.port.mk file which fetch
	all distfiles for the port and for all direct and indirect 
	dependencies. 

	This is usefull if you only have a modem connection to Internet 
	or for a mobile computer.
	eg.
		connect to Internet
		cd $(PORT)
		make fetch-recursive
		disconnect
		make all install

	In the target fetch-recursive I use 
	${MAKE} -k fetch
	to do the fetching. -k is used since I want the fetch to 
	continue even if there are some problems with one of the distfiles.
	eg.
	fetch for $(PORTS)/java/java-doc
		You have to fetch the documentation from
		    http://java.sun.com/products/jdk/1.1/docs.html

		Put jdk118-doc.tar.gz in in /usr/ports/distfiles/ and run make again.

		All this hassle is because of the license and export restrictions
		as described in
		    http://java.sun.com/feedback/faq/downloading.html

		*** Error code 1
	
	The user then only has to fetch the problematic ones manually.

	The targets 'fetch-recursive(-list)' should also be added to the
	bsd.port.subdir.mk file.

Fix: 

Add the following to $(PORTS)/Mk/bsd.port.mk


# fetch-recursive		- Retrieves ${DISTFILES} (and ${PATCHFILES} if defined),
#						  for port and dependencies, into ${DISTDIR} as necessary.
# fetch-recursive-list	- Show list of files that would be 
#						  retrieved by fetch-recursive
fetch-recursive:
	@${ECHO_MSG} "===> Fetching all distfiles for ${PKGNAME} and dependencies"
	@setvar dirs "`${MAKE} all-depends-recursive-list`";\
		setvar dirs "${.CURDIR} $$dirs";\
		for dir in $$dirs; do\
			cd $$dir && ${MAKE} -k fetch;\
		done

fetch-recursive-list:
	@setvar dirs "`${MAKE} all-depends-recursive-list`";\
		setvar dirs "${.CURDIR} $$dirs";\
		for dir in $$dirs; do\
			cd $$dir && ${MAKE} fetch-list;\
		done


# Internal targets used by fetch-recursive(-list)
all-depends-list:
	@setvar builddirs "`${MAKE} build-depends-list`";\
		setvar rundirs "`${MAKE} run-depends-list`";\
		setvar dirs "`${ECHO} $$builddirs $$rundirs`";\
		${ECHO} $$dirs

all-depends-recursive-list:
	@setvar dirs "";\
		setvar _dirs "`${MAKE} all-depends-list`";\
		while [ "$$_dirs" ]; do\
			setvar __dirs "$$_dirs";\
			setvar _dirs "";\
			for dir in $$__dirs; do\
				if ! (echo $$dirs | grep $$dir)>/dev/null; then\
					setvar dirs "$$dirs $$dir";\
					setvar _dirs "$$_dirs `cd $$dir && ${MAKE} all-depends-list`";\
				fi;\
			done;\
		done;\
		${ECHO} $$dirs
Comment 1 Michael Haro freebsd_committer freebsd_triage 1999-07-11 07:16:11 UTC
Responsible Changed
From-To: freebsd-ports->asami

Satoshi maintains bsd.port.mk 
Comment 2 Satoshi Asami freebsd_committer freebsd_triage 2000-09-09 14:55:19 UTC
State Changed
From-To: open->closed

Implemented!