diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-30 17:57:36 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-30 17:57:36 +0000 |
commit | c9e7699c2e98eb9622a6dfca2be1442aeb51dfd3 (patch) | |
tree | 2d192278bfb9a69eaad58e46cd88f8490e90d25b | |
parent | add6e5d11d9057d027365237adcada0767fb2017 (diff) | |
download | puppet-c9e7699c2e98eb9622a6dfca2be1442aeb51dfd3.tar.gz puppet-c9e7699c2e98eb9622a6dfca2be1442aeb51dfd3.tar.xz puppet-c9e7699c2e98eb9622a6dfca2be1442aeb51dfd3.zip |
Fixing #462. The package sort order was always resulting in the lowest-version package being first, rather than highest, so I inverted the sort order.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2125 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/util/package.rb | 3 | ||||
-rwxr-xr-x | test/util/package.rb | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | test/util/pidlock.rb | 0 |
3 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/util/package.rb b/lib/puppet/util/package.rb index 00e04f64a..da07bdae4 100644 --- a/lib/puppet/util/package.rb +++ b/lib/puppet/util/package.rb @@ -2,6 +2,9 @@ require 'puppet' module Puppet::Util::Package def versioncmp(version_a, version_b) + # Invert the sort order, so higher versions always end up first. + version_a, version_b = version_b, version_a + vre = /[-.]|\d+|[^-.\d]+/ ax = version_a.scan(vre) bx = version_b.scan(vre) diff --git a/test/util/package.rb b/test/util/package.rb index 73b069f84..22bc4c4e4 100755 --- a/test/util/package.rb +++ b/test/util/package.rb @@ -20,7 +20,7 @@ class TestPuppetUtilPackage < Test::Unit::TestCase versioncmp(a,b) } end - assert_equal(["0002", "1", "1.06", "1.1-3", "1.1-4", "1.1-5", "1.1.6", "1.1.a", "1.1a", "1.2", "1.5", "2.3", "2.3.0", "2.3.1", "2.3a.1", "2.4", "2.4", "2.4b", "2.40.2", "3.0", "3.1"], newary) + assert_equal(["3.1", "3.0", "2.40.2", "2.4b", "2.4", "2.4", "2.3a.1", "2.3.1", "2.3.0", "2.3", "1.5", "1.2", "1.1a", "1.1.a", "1.1.6", "1.1-5", "1.1-4", "1.1-3", "1.06", "1", "0002"], newary, "versions did not sort correctly") end end diff --git a/test/util/pidlock.rb b/test/util/pidlock.rb index 671668d01..671668d01 100644..100755 --- a/test/util/pidlock.rb +++ b/test/util/pidlock.rb |