[MacPorts] PortfileRecipes modified

MacPorts Wiki noreply at macports.org
Mon Jan 27 12:48:57 UTC 2025


Page "PortfileRecipes" was changed by ryandesign
Diff URL: <https://trac.macports.org/wiki/PortfileRecipes?action=diff&version=119>
Revision 119
Comment: Add another solution for unversioned distfiles using a GET parameter
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 118)
+++ PortfileRecipes (version: 119)
@@ -320,15 +320,27 @@
 See also the next entry on [#unversioned-distfiles unversioned distfiles].
 
 == Unversioned distfiles == #unversioned-distfiles
-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}.
-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.
-To avoid this, you must change `dist_subdir`.
+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}.
+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.
+To avoid this, one easy solution is to change `dist_subdir`.
 By default, `dist_subdir` is ${name}; change it so that it includes a subdirectory named for the version:
 {{{
 dist_subdir   ${name}/${version}
 }}}
-
-Ideally, however, convince the developers to put the version number in their distfile names.
+This works well for ports that have a single distfile or have many distfiles if all distfiles are updated with each version.
+
+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:
+{{{
+master_sites        https://example.com/downloads/
+distname            ${name}
+}}}
+you can change it to:
+{{{
+master_sites        https://example.com/downloads/${name}${extract.suffix}?dummy=
+}}}
+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.
+
+Ideally, instead of such workarounds, convince the developers to put the version number in their distfile names.
 Any time a distfile is released to their download area, they should consider it to be immutable.
 
 See also the previous entry on [#stealth-updates stealth updates].
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/PortfileRecipes>
MacPorts <https://www.macports.org/>
Ports system for macOS

This is an automated message. Someone added your email address to be
notified of changes on 'PortfileRecipes' page.
If it was not you, please report to admin at macports.org.


More information about the macports-changes mailing list