[88828] users/ryandesign/scripts/vercmp

ryandesign at macports.org ryandesign at macports.org
Thu Jan 12 18:25:44 PST 2012


Revision: 88828
          http://trac.macports.org/changeset/88828
Author:   ryandesign at macports.org
Date:     2012-01-12 18:25:44 -0800 (Thu, 12 Jan 2012)
Log Message:
-----------
vercmp: script to run vercmp proc to compare two version numbers

Added Paths:
-----------
    users/ryandesign/scripts/vercmp

Added: users/ryandesign/scripts/vercmp
===================================================================
--- users/ryandesign/scripts/vercmp	                        (rev 0)
+++ users/ryandesign/scripts/vercmp	2012-01-13 02:25:44 UTC (rev 88828)
@@ -0,0 +1,27 @@
+#!/usr/bin/tclsh
+
+# Runs vercmp with the two version numbers provided to see which is newer.
+
+set prefix /opt/local
+
+source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+package require macports 1.0
+mportinit
+
+if {${argc} != 2} {
+    ui_error "usage: [file tail ${argv0}] version1 version2"
+    exit 1
+}
+
+set version1 [lindex ${argv} 0]
+set version2 [lindex ${argv} 1]
+
+set cmp [vercmp ${version1} ${version2}]
+
+if {${cmp} < 0} {
+    ui_msg "MacPorts considers ${version1} to be less than ${version2}."
+} elseif {${cmp} > 0} {
+    ui_msg "MacPorts considers ${version1} to be greater than ${version2}."
+} else {
+    ui_msg "MacPorts considers ${version1} to be equal to ${version2}."
+}


Property changes on: users/ryandesign/scripts/vercmp
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120112/1d2175f5/attachment.html>


More information about the macports-changes mailing list