Created attachment 163673 [details]
The patch makes it possible for certain USES clauses to control (add to) what distfiles are included in distinfo.
This is needed to support more complex USES=nodejs fetch stage that will be made dependent on this bug.
CKSUMFILES is an internal variables, you can't use it directly, you should use DISTFILES or PATCHFILES.
DISTFILES is usually sufficient. But I have 2 sets of distfiles: originally downloaded (DISTFILES1), and generated by fetch (DISTFILES2). distinfo should have DISTFILES1 and DISTFILES2, but MASTER_BACKUP_SITE should only have DISTFILES2. This is why I prefer to keep the distinction between CKSUMFILES and DISTFILES. There should also be BACKUP_FILES variable. Usually they are all the same, but not in my case.
NodeJS downloads things in the process, that's why it calls for a very complex fetch stage with its own ins and outs, all of which are distfiles. The result overall looks like download, with custom process running inside.
All this seems like over-engineering. Would it not be simpler to replicate what npm does instead of trying to coerce it and the ports framework to work together ?
npm first pre-builds locally, then places the result into another, separate hosting location, and then during port build they just download and unpack it.
There are many NodeJS projects, you can't make everybody do this manually. And the way I suggested with USES=nodejs circumvents the problem, and builds it all in a close to normal way. Please note that the fetch is really a fancy fetch, it doesn't compile anything.
This makes it a bit difficult to implement USES=nodejs, but easy to make many ports based on it.