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`. |
| 323 | Although 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}. |
| 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's distfile downloaded (or those who receive it from our mirror servers) will experience a checksum mismatch. |
| 325 | To avoid this, one easy solution is to change `dist_subdir`. |
330 | | |
331 | | Ideally, however, convince the developers to put the version number in their distfile names. |
| 330 | This works well for ports that have a single distfile or have many distfiles if all distfiles are updated with each version. |
| 331 | |
| 332 | Another 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 | {{{ |
| 334 | master_sites https://example.com/downloads/ |
| 335 | distname ${name} |
| 336 | }}} |
| 337 | you can change it to: |
| 338 | {{{ |
| 339 | master_sites https://example.com/downloads/${name}${extract.suffix}?dummy= |
| 340 | }}} |
| 341 | leaving `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 | |
| 343 | Ideally, instead of such workarounds, convince the developers to put the version number in their distfile names. |