HomeFreeBSD

Fix fetch-list when running as a user.

Description

Fix fetch-list when running as a user.

The fetch-list target is used to generate a shell script that will more
or less replicates what do-fetch does. It allows one to do most things
as a regular user, and generate that script to run, say, on another
machine, if the one where you build things does not have access to the
internet, or has much slower access.

It was failing when DISTDIR was not writable by the current user, and
the port had a distribution file with a path in it. (Not using
DIST_SUBDIR, something else, like lang/rust does.) It was failing
because it was trying to create that subdirectory unconditionally,
instead of only creating the subdirectory if actually had to. This also
fixes the bug that the generated script did not have the appropriate
mkdirs for those directories.

PR: 239293
Submitted by: tobik (earlier version)
Reported by: Ruslan Garipov
Differential Revision: https://reviews.freebsd.org/D21112

Details