Livecheck regex with version in url path

David Gilman davidgilman1 at gmail.com
Mon Dec 23 22:00:10 UTC 2019


The downloads.haskell.org server is misconfigured. It's always
gzipping its response content, ignoring the Accept-Encoding headers.
Even if you set Accept-Encoding: identity the server sends a
compressed response.

Try it out for yourself: macports runs the equivalent of this:

curl -H "Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
https://downloads.haskell.org/~ghc/

Note the warning about writing binary data to the terminal.

Tell the curl client to expect compressed responses:

curl --compressed -H "Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
https://downloads.haskell.org/~ghc/

you get some nice HTML.

The macports curl fetch command will need to be extended to allow for
this kind of buggy server.

On Mon, Dec 23, 2019 at 4:01 PM Steven Smith <steve.t.smith at gmail.com> wrote:
>
> For example, this livecheck produces the following error:
>
> livecheck.type      regex
> livecheck.url       https://downloads.haskell.org/~${name}
> livecheck.regex     (\\d+(?:\\.\\d+){1,3})
>
> DEBUG: Executing org.macports.livecheck (ghc)
> DEBUG: Port (livecheck) version is 8.8.1
> DEBUG: Fetching https://downloads.haskell.org/~ghc
> DEBUG: Using CURL options "--append-http-header" "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
> DEBUG: The regex is "(\d+(?:\.\d+){1,3})"
> Error: cannot check if ghc was updated (regex didn't match)
>
> Using a Kleene star ‘*’ regex pattern instead of ‘{1,3}’ generates an infinite loop upon doing a livecheck.
>
>
> > On Dec 23, 2019, at 15:36, Steven Smith <steve.t.smith at gmail.com> wrote:
> >
> >
> >> you need to find a URL that doesn't contain the version number for MacPorts to download. For ghc, https://downloads.haskell.org/~ghc/ looks like a reasonable URL to use. Of course you'll have to change the regex to match directories rather than files.
> >
> > Would you or someone please provide a one-liner on how to do that? The stuff I’ve tried hasn’t worked.
>


-- 
David Gilman
:DG<


More information about the macports-dev mailing list