Ticket #13031: macports-portsort.patch

File macports-portsort.patch, 883 bytes (added by afb@…, 17 years ago)

macports-portsort.patch

  • src/port/port.tcl

     
    337337}
    338338
    339339
     340# Sort two ports in NVR (name@version_revision) order
    340341proc portlist_compare { a b } {
    341342    array set a_ $a
    342343    array set b_ $b
    343     return [string compare $a_(name) $b_(name)]
     344    set namecmp [string compare $a_(name) $b_(name)]
     345    if {$namecmp != 0} {
     346        return $namecmp
     347    }
     348    set avr_ [split $a_(version) "_"]
     349    set bvr_ [split $b_(version) "_"]
     350    set vercmp [rpm-vercomp [lindex $avr_ 0] [lindex $bvr_ 0]]
     351    if {$vercmp != 0} {
     352        return $vercmp
     353    }
     354    set ar_ [lindex $avr_ 1]
     355    set br_ [lindex $bvr_ 1]
     356    if {$ar_ < $br_} {
     357        return -1
     358    } elseif {$ar_ > $br_} {
     359        return 1
     360    } else {
     361        return 0
     362    }
    344363}
    345364
    346365