[MacPorts] #61050: Add `port vercmp` command

MacPorts noreply at macports.org
Fri Feb 26 11:35:59 UTC 2021


#61050: Add `port vercmp` command
--------------------------+--------------------
  Reporter:  ryandesign   |      Owner:  (none)
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:  2.6.99
Resolution:               |   Keywords:
      Port:               |
--------------------------+--------------------

Comment (by jmroot):

 I think this definitely falls under the category of developer tools, and
 isn't really appropriate as a port command. Exposing internal helper
 functions as actions isn't a road I think we should go down (what's next,
 `port shellescape` and `port percentescape`?)

 The contrib script version takes about 30 seconds to write:
 {{{#!tcl
 #!/usr/bin/env port-tclsh

 package require Pextlib

 set ver1 [lindex $argv 0]
 set ver2 [lindex $argv 1]
 set result [vercmp $ver1 $ver2]
 puts "vercmp $ver1 $ver2 = $result"
 if {$result > 0} {
     set relation "greater than"
 } elseif {$result < 0} {
     set relation "less than"
 } else {
     set relation "equal to"
 }
 puts "$ver1 is considered to be $relation $ver2"
 }}}

 And TBH it isn't hard to write `puts [vercmp 1.10 1.2]` in a Porfile and
 run port info.

-- 
Ticket URL: <https://trac.macports.org/ticket/61050#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list