#61050: Add `port vercmp` command

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

#61050: Add `port vercmp` command

macports-4
#61050: Add `port vercmp` command
-------------------------+--------------------
 Reporter:  ryandesign   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  base         |    Version:  2.6.99
 Keywords:               |       Port:
-------------------------+--------------------
 Portfile authors need to know in which situations they need to increase a
 port's `epoch`. To do that, they need to be able to run the MacPorts
 `vercmp` procedure and see what it prints for the port's old version and
 the new one, but MacPorts doesn't expose a way to do that. I have a script
 I often use to do this:

 https://github.com/ryandesign/macports-user-
 ryandesign/blob/master/scripts/vercmp

 I propose that we should add a `port vercmp` command to integrate this
 functionality. Proposed usage example:

 {{{
 $ port vercmp 1.0-rc1 1.0
 MacPorts considers 1.0-rc1 to be greater than 1.0.
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/61050>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: #61050: Add `port vercmp` command

macports-4
#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 ryandesign):

 Or if it is too difficult or weird for the `port` command to process its
 arguments in a way that is not names of ports, then we could ship a `port-
 vercmp` script.

--
Ticket URL: <https://trac.macports.org/ticket/61050#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: #61050: Add `port vercmp` command

macports-4
In reply to this post by macports-4
#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:               |
--------------------------+--------------------
Changes (by kurthindenburg):

 * cc: kurthindenburg (added)


Comment:

 I added https://github.com/macports/macports-base/pull/229

--
Ticket URL: <https://trac.macports.org/ticket/61050#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: #61050: Add `port vercmp` command

macports-4
In reply to this post by macports-4
#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
Reply | Threaded
Open this post in threaded view
|

Re: #61050: Add `port vercmp` command

macports-4
In reply to this post by macports-4
#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 kurthindenburg):

 IMHO the real benefit is that we could add a section to the guide for
 epoch saying if 'port vercmp old new' is less then you need to add epoch 1
 to the portfile.

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