Ticket Change Details
Overview

Artifact ID: dc1581b36e95ae2da7d4b376c66955048ce2dff1
Ticket: 00bc6a8fb5e894a7480d154af8e14ea8d269560a
use [package vcompare] instead of dictionary sort for package versions
User & Date: anonymous on 2015-04-13 02:54:10
Changes

  1. foundin changed to: "trunk"
  2. icomment:
    teapot-client uses [lsort -dictionary] to determine the newest package
    version, which is incorrect (case in point: tdbc).
    
    The following patch fixes this AND inclides a workaround for vectcl
    http://teapot.rkeene.org/entity/name/vectcl/index.html which doesn't
    conform to [package vcompare].  The latter should surely be fixed:  ActiveState's teapot knows it only as "0.1".
    
    
    Index: client/lib/teapotclient0.1/teapotclient.tcl
    ==================================================================
    --- client/lib/teapotclient0.1/teapotclient.tcl
    +++ client/lib/teapotclient0.1/teapotclient.tcl
    @@ -340,17 +340,29 @@
     
                            lappend pkginfo($pkg) [list $ver $arch]
                    }
     
                    foreach pkg [array names pkginfo] {
    -                       set pkginfo($pkg) [lsort -decreasing -dictionary $pkginfo($pkg)]
    +                       set pkginfo($pkg) [lsort -decreasing -command ::teapotclient::vcompare $pkginfo($pkg)]
                    }
     
                    return [array get pkginfo]
            }
     
            proc setcachedir {dir} {
                    set ::teapotclient::pkgcachedir $dir
            }
    +
    +       proc vcompare {a b} {
    +               try {
    +                       package vcompare $a $b
    +               } on error {} {
    +                       try {
    +                               package vcompare [lindex $a 0] [lindex $b 0]
    +                       } on error {} {
    +                               string compare -nocase $a $b
    +                       }
    +               }
    +       }
     }
     
     package provide teapotclient 0.1
    
    Index: client/teapot-client.tcl
    ==================================================================
    --- client/teapot-client.tcl
    +++ client/teapot-client.tcl
    @@ -88,15 +88,15 @@
                                    set extinfoitemvers [lindex $extinfoitem 0]
                                    if {[lsearch -exact $extvers $extinfoitemvers] == -1} {
                                            lappend extvers $extinfoitemvers
                                    }
                            }
    -                       set extvers [lsort -decreasing -dictionary $extvers]
    +                       set extvers [lsort -decreasing -command ::teapotclient::vcompare $extvers]
     
                            puts "  $ext [lindex $extvers 0]"
                    }
            }
            default {
                    print_help
                    exit 1
            }
     }
    
  3. login: "anonymous"
  4. mimetype: "text/x-fossil-plain"
  5. private_contact changed to: "cb02a4a25e8da92f2790bc307bf01ef24ce6053e"
  6. severity changed to: "Severe"
  7. status changed to: "Open"
  8. title changed to:
    use [package vcompare] instead of dictionary sort for package versions
    
  9. type changed to: "Code_Defect"