Roland Illig wrote:
david.sainty%dtsp.co.nz@localhost schrieb:The MASTER site may need this appended, but f.n.o (for example, but any other mirror too) should retain the file without the appended string. So, whatever the fix it needs to be linked to individual download URLs.You're right. Next try, which is a bit ugly: If a MASTER_SITE contains %s, it is replaced by the filename, otherwise the filename is appended to it. It loses the property that concat(MASTER_SITE, filename) is the complete URL of the distfile.
That looks totally usable to me.I'd add a sed expression before the %s match replacing "%%" with "%", and probably a "g" option on both, so they match multiple "%s" if present. I guess then I'd consider changing the case match to look for just "%" instead of "%s". All that is to allow for the possibility of adding more %? sequences in the future without risking new breakage.
A quick grep over Pkgsrc shows that there are a small number of packages that use %, because it is already the escape character for hex encoding characters (E.g. %7E in x11/kterm). I guess that could be to our advantage, so long as we only ever use non-hex symbols following the %. Nonetheless, it would be sensible to add a comment in the new code that 0-9a-fA-F are off limits, and why.