Livecheck regex with version in url path

Ryan Schmidt ryandesign at macports.org
Mon Dec 23 20:34:13 UTC 2019



On Dec 23, 2019, at 12:39, Steven Smith wrote:

> How does one write a live check for ghc, whose version lives in the url path?
> 
> https://downloads.haskell.org/ghc/8.8.1/ghc-8.8.1-src.tar.xz
> 
> I’ve tried stuff like the following, without success:
> 
> livecheck.type      regex                                                       
> livecheck.url       https://downloads.haskell.org/~${name}/${version}           
> livecheck.regex     (\\d+(?:\\.\\d+){1,4})/${name}-\\1-src${extract.suffix} 

You can't; that wouldn't make sense.

Livecheck works this way: MacPorts downloads the URL in livecheck.url, finds all matches for livecheck.regex in the contents of that document, and prints the largest found value (according to vercmp). At the time that MacPorts downloads the URL, it does not yet know what the latest version is, so that value is not available to put into the URL.

So 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.



More information about the macports-dev mailing list