On Apr 22, 2015, at 2:22 PM, Lawrence Velázquez <[email protected]> wrote:

> On Apr 22, 2015, at 5:01 PM, MacPorts <[email protected]> wrote:
> 
>> Page "PortfileRecipes" was changed by [email protected]
>> 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} {
>> +    puts "Yosemite or newer"
>> +} elseif {[vercmp ${check.version} ${os.version}] = 0} {
>> +    puts "Mavricks"
>> +}
>> +} elseif {[vercmp ${check.version} ${os.version}] = -1} {
>> +    puts "Mountain Lion or older"
>> +}
>> +}}}
>> 
>> == Fetching from a URL that uses GET parameters == #fetchwithgetparams
>> 
>> -------8<------8<------8<------8<------8<------8<------8<------8<--------
> 
> Ehh. This is technically correct, but (to my knowledge) practically no ports 
> do this. Simply checking against os.major is much more common and is 
> sufficient for most purposes. I also find it easier to understand.
> 
>    if {${os.major} < 10} {
>        # do something on systems older than Snow Leopard
>    }

Thank you for the feedback. I failed to find a table of darwin version, os x 
version and os x name for a comment I wanted to leave on the docker port 
submission ticket [1].

Regarding this wiki edit the version table was my interest, perhaps there is a 
better place to document versions.

I was hesitant to add ${os.major} without explaining what it meant in relation 
to the table.
Perhaps changing the example to use os.major with a short comment like:
# os.major is the left most dot separated number of the darwin version.

You are a much better writer then I so feel free to move, edit or delete my 
work here.

[1] https://trac.macports.org/ticket/43260#comment:13


Regards,
Bradley Giesbrecht (pixilla)

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
macports-dev mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to