Changes between Version 118 and Version 119 of PortfileRecipes


Ignore:
Timestamp:
Jan 27, 2025, 12:48:57 PM (3 weeks ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

Add another solution for unversioned distfiles using a GET parameter

Legend:

Unmodified
Added
Removed
Modified
  • PortfileRecipes

    v118 v119  
    321321
    322322== Unversioned distfiles == #unversioned-distfiles
    323 Although they would be wise not to do this, some software developers may distribute their distfile with a filename that does not contain the version number (e.g. example.tar.gz); such a port will have its `distname` specified as ${name} rather than its default ${name}-${version}.
    324 But when updating the port to a new version, the old version's distfile will get in the way, since it has the same name, and users who had a previous version of the port installed will experience a checksum mismatch.
    325 To avoid this, you must change `dist_subdir`.
     323Although they would be wise not to do this, some software developers may distribute their distfile with a filename (e.g. example.tar.gz) that does not contain the version number; such a port might have its `distname` specified as ${name} rather than the default ${name}-${version}.
     324But when updating the port to a new version, the old version's distfile will get in the way, since it has the same name, and users who had a previous version's distfile downloaded (or those who receive it from our mirror servers) will experience a checksum mismatch.
     325To avoid this, one easy solution is to change `dist_subdir`.
    326326By default, `dist_subdir` is ${name}; change it so that it includes a subdirectory named for the version:
    327327{{{
    328328dist_subdir   ${name}/${version}
    329329}}}
    330 
    331 Ideally, however, convince the developers to put the version number in their distfile names.
     330This works well for ports that have a single distfile or have many distfiles if all distfiles are updated with each version.
     331
     332Another solution is to keep the default `dist_subdir` but use a `master_sites` URL with a [#fetchwithgetparams dummy GET parameter] to invent a new versioned distfile name. For example if a port named example has its distfile available at https://example.com/downloads/example.tar.gz and you have a Portfile that says:
     333{{{
     334master_sites        https://example.com/downloads/
     335distname            ${name}
     336}}}
     337you can change it to:
     338{{{
     339master_sites        https://example.com/downloads/${name}${extract.suffix}?dummy=
     340}}}
     341leaving `distname` at its default value which includes the `version`. MacPorts will construct the URL e.g. https://example.com/downloads/example.tar.gz?dummy=/example-1.2.3.tar.gz and will save the file to disk as example-1.2.3.tar.gz. Most web servers won't care and will just ignore the dummy parameter.
     342
     343Ideally, instead of such workarounds, convince the developers to put the version number in their distfile names.
    332344Any time a distfile is released to their download area, they should consider it to be immutable.
    333345