[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Wed May 13 23:33:42 PDT 2009


Changed page "PortfileRecipes" by ryandesign at macports.org from 70.114.129.90*
Page URL: <http://trac.macports.org/wiki/PortfileRecipes>
Diff URL: <http://trac.macports.org/wiki/PortfileRecipes?action=diff&version=2>
Revision 2
Comment: add branch and major version section

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 1)
+++ PortfileRecipes (version: 2)
@@ -1,4 +1,20 @@
 = Portfile Recipes =
+
+== Branch and major versions == #branch
+
+Often times, when a port's version is x.y.z, you want to be able to refer to just the x.y part, for a download URL or for other reasons. The de facto standard way to do this is
+{{{
+set branch              [join [lrange [split ${version} .] 0 1] .]
+}}}
+This splits the version string into an array, takes the first two elements of the array, and glues them back together again.
+This example is from [browser:trunk/dports/devel/glib2 glib2].
+
+If you need to refer just to the x part (the major version) you can similarly do:
+{{{
+set major               [lindex [split ${version} .] 0]
+}}}
+This splits the version string into an array and returns just the first element.
+This example is from [browser:trunk/dports/lang/php5 php5].
 
 == Using glob results in "Cannot stat: <list of files>" == #glob
 glob returns a list which is not handled by some commands (eg, xinstall); instead, wrap the command in an eval.  Instead of

-------8<------8<------8<------8<------8<------8<------8<------8<--------

* The IP shown here might not mean anything if the user or the server is
behind a proxy.

--
MacPorts <http://www.macports.org/>
Ports system for Mac OS

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


More information about the macports-changes mailing list