[MacPorts] PortfileRecipes modified
Bradley Giesbrecht
pixilla at macports.org
Wed Apr 22 18:42:24 PDT 2015
On Apr 22, 2015, at 4:59 PM, Joshua Root <jmr at macports.org> wrote:
> Couple more points:
Thank you for your insights.
> On 2015-4-23 07:22 , Lawrence Velázquez wrote:
>> On Apr 22, 2015, at 5:01 PM, MacPorts <noreply at macports.org> wrote:
>>
>>> Page "PortfileRecipes" was changed by pixilla at macports.org
>>> Diff URL: <https://trac.macports.org/wiki/PortfileRecipes?action=diff&version=84>
>>> Revision 84
>>> Changes:
>>> -------8<------8<------8<------8<------8<------8<------8<------8<--------
>>> Index: PortfileRecipes
>>> =========================================================================
>>> --- PortfileRecipes (version: 83)
>>> +++ PortfileRecipes (version: 84)
>>> @@ -18,6 +18,31 @@
>>> }}}
>>> These split the version string into an array and return the desired element.
>>> These examples are based on [browser:trunk/dports/lang/php5 php5].
>>> +
>>> +== Compare versions == #vercmp
>>> +
>>> +||||||= Mac OS X Version Info =||
>>> +||= Darwin =||= OS X =||= Name =||
>>> +|| 7.0 || 10.3 || Panther ||
>>> +|| 8.0 || 10.4 || Tiger ||
>>> +|| 9.0 || 10.5 || Leopard ||
>>> +|| 10.0 || 10.6 || Snow Leopard ||
>>> +|| 11.0.0 || 10.7 || Lion ||
>>> +|| 12.0.0 || 10.8 || Mountain Lion ||
>>> +|| 13.0.0 || 10.9 || Mavericks ||
>>> +|| 14.0.0 || 10.10 || Yosemite ||
>>> +
>>> +{{{
>>> +set check.version 13.0.0
>>> +if {[vercmp ${check.version} ${os.version}] = 1} {
>
> I'm not sure vercmp always returns one of [1,0,-1];
The portfile man only mentions these three returns:
man portfile | less +/vercmp
> we generally check
> the result the same way you do for strcmp, with < 0 or > 0 or == 0.
> Speaking of which, a single equals sign is not correct here.
Thanks, I incorrectly assumed "=" since tcl doesn't use it for assignment, I should have tested.
>>> + puts "Yosemite or newer"
>>> +} elseif {[vercmp ${check.version} ${os.version}] = 0} {
>>> + puts "Mavricks"
> ^ typo
>
>>> +}
>>> +} elseif {[vercmp ${check.version} ${os.version}] = -1} {
>>> + puts "Mountain Lion or older"
>>> +}
>>> +}}}
>
> - Josh
Regards,
Bradley Giesbrecht (pixilla)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20150422/529802f8/attachment-0001.sig>
More information about the macports-dev
mailing list