Subject: Re: CVS commit: pkgsrc/mk/fetch
To: None <rillig@netbsd.org>
From: YONETANI Tomokazu <qhwt+nbsd@les.ath.cx>
List: pkgsrc-changes
Date: 01/18/2007 14:46:19
Hi.
This commit
  http://mail-index.netbsd.org/pkgsrc-changes/2007/01/10/0035.html

broke `make fetch' with PKG_RESUME_TRANSFERS=yes, at least on DragonFly;
$fetchdir is later compared against "." at case statement on line 192.
After this commit, the fetch script fails to retrieve the checksum and
the filesize for the matching line from distinfo file, because it tries
to compare file names against absolute path of the files under $DISTDIR.
In this case, the shell function verify_file() always succeeds, because
it returns 0 when neither the checksum nor the filesize could be obtained.

Now in $resume mode, the script first touch'es the file, then it tries
to reget the file only if verify_file() returns non-zero status ---
which never happens.

I came up with a possible solution, which I'm using locally.

Best regards.

Index: mk/fetch/fetch
===================================================================
RCS file: /home/source/netbsd/cvs/pkgsrc/mk/fetch/fetch,v
retrieving revision 1.7
diff -u -r1.7 fetch
--- mk/fetch/fetch	10 Jan 2007 14:31:35 -0000	1.7
+++ mk/fetch/fetch	18 Jan 2007 04:14:29 -0000
@@ -142,9 +142,6 @@
 	*)	break ;;
 	esac
 done
-
-fetchdir=`cd $fetchdir && exec pwd`
-
 if ${TEST} -n "$checksum" -a -z "$distinfo"; then
 	${ECHO} 1>&2 "$self: \`\`-c'' requires \`\`-f distinfo''."
 	exit 1
@@ -176,7 +173,8 @@
 
 ${TEST} -d $fetchdir || ${MKDIR} -p $fetchdir 2>/dev/null
 if ${TEST} ! -w $fetchdir; then
-	${ECHO} 1>&2 "$self: Cannot write to $fetchdir"
+	realfetchdir=`cd $fetchdir && exec pwd`
+	${ECHO} 1>&2 "$self: Cannot write to $realfetchdir"
 	exit 1
 fi