Tuesday, January 05, 2021

[go.port.mk / portgen] Teach everyone how to handle Go's unique escaping

Hi,

This teaches portgen and go.port.mk how to handle module URLs that
contain uppercase characters.

Go has chosen to translate module names like
'github.com/poolpOrg/filter-rspamd' to
'github.com/ploop!org/filter-rspamd'.

They had reasons:

> To avoid ambiguity when serving from case-insensitive file systems,
> the $module and $version elements are case-encoded by replacing
> every uppercase letter with an exclamation mark followed by the
> corresponding lower-case letter. This allows modules example.com/M
> and example.com/m to both be stored on disk, since the former is
> encoded as example.com/!m.

Because of the need for escaping, a port like that looks like the one
below would not work:
MODGO_MODNAME = github.com/poolpOrg/filter-rspamd
MODGO_VERSION = v0.1.7

Same goes for `portgen go github.com/poolpOrg/filter-rspamd` - this
errors because it can't find the distfile.

The make magic is from espie@ / naddy@ - I am not clever enough to come
up with such voodoo myself! :D

I have tested a handful of existing MODGO_ ports with this diff, as well
as existing and new ports that were built with 'portgen go'.

OK?

Cheers,
Aaron

No comments:

Post a Comment