Subject: fetch-list and no local writable distfiles
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 05/04/2005 09:28:20
I used "make fetch-list" to create the shell script to use on another
system.

But it failed in different places because didn't have write access on
system running "make fetch-list". It doesn't seem like it needs to mkdir
if just creating a shell script which will make the directory later.

Please comment on the following:

Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1627
diff -b -u -r1.1627 bsd.pkg.mk
--- mk/bsd.pkg.mk	4 May 2005 06:42:43 -0000	1.1627
+++ mk/bsd.pkg.mk	4 May 2005 16:22:15 -0000
@@ -3677,12 +3677,9 @@
 	@${ECHO} '#'
 	@location=`${PWD_CMD} | ${AWK} -F / '{ print $$(NF-1) "/" $$NF }'`; \
 		${ECHO} '# Need additional files for ${PKGNAME} ('$$location')...'
-	@${ECHO} '#'
-	@${MKDIR} ${_DISTDIR}
 .    for fetchfile in ${_ALLFILES}
 .      if defined(_FETCH_MESSAGE)
-	@(cd ${_DISTDIR};						\
-	if [ ! -f ${fetchfile:T} ]; then				\
+	if [ ! -f ${_DISTDIR}/${fetchfile:T} ]; then			\
 		${ECHO};						\
 		filesize=`${AWK} '					\
 			/^Size/ && $$2 == "(${fetchfile})" { print $$4 } \
@@ -3690,10 +3687,9 @@
 		${ECHO} '# Prompt user to get ${fetchfile} ('$${filesize-???}' bytes) manually:'; \
 		${ECHO} '#';						\
 		${ECHO} ${_FETCH_MESSAGE:Q};				\
-	fi)
+	fi
 .      elif defined(DYNAMIC_MASTER_SITES)
-	@(cd ${_DISTDIR};						\
-	if [ ! -f ${fetchfile:T} ]; then				\
+	if [ ! -f ${_DISTDIR}/${fetchfile:T} ]; then			\
 		${ECHO};						\
 		filesize=`${AWK} '					\
 			/^Size/ && $$2 == "(${fetchfile})" { print $$4 } \
@@ -3710,13 +3706,12 @@
 		${ECHO} 'cd ${_DISTDIR} && [ -f ${fetchfile} -o -f ${fetchfile:T} ] ||'; \
 		${ECHO}	'for site in $$sites; do';			\
 		${ECHO} '	${FETCH_CMD} ${FETCH_BEFORE_ARGS} "$${site}${fetchfile:T}" ${FETCH_AFTER_ARGS} && break ||'; \
-		${ECHO} '	${ECHO} ${fetchfile} not fetched';	\
+		${ECHO} '	${ECHO} ${fetchfile:T} not fetched';	\
 		${ECHO}	done;						\
 		${ECHO} ')';						\
-	fi)
+	fi
 .      else
-	@(cd ${_DISTDIR};						\
-	if [ ! -f ${fetchfile:T} ]; then				\
+	if [ ! -f ${_DISTDIR}/${fetchfile:T} ]; then			\
 		${ECHO};						\
 		filesize=`${AWK} '					\
 			/^Size/ && $$2 == "(${fetchfile})" { print $$4 } \
@@ -3729,13 +3724,14 @@
 		${ECHO} 'cd ${_DISTDIR} && [ -f ${fetchfile} -o -f ${fetchfile:T} ] ||'; \
 		${ECHO}	'for site in $$sites; do';			\
 		${ECHO} '	${FETCH_CMD} ${FETCH_BEFORE_ARGS} "$${site}${fetchfile:T}" ${FETCH_AFTER_ARGS} && break ||'; \
-		${ECHO} '	${ECHO} ${fetchfile} not fetched';	\
+		${ECHO} '	${ECHO} ${fetchfile:T} not fetched';	\
 		${ECHO}	done;						\
-	fi)
+	fi
 .      endif # defined(_FETCH_MESSAGE) || defined(DYNAMIC_MASTER_SITES)
 .    endfor
 .  endif # !empty(_ALLFILES)
 .endif # !target(fetch-list-one-pkg)
+#todo: maybe  should not say "not fetched" until has tried all sites

 # Checksumming utilities


Jeremy C. Reed