port_upgrade 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
 - data/Manifest.txt +1 -0
 - data/bin/port_upgrade +1 -0
 - data/lib/port_upgrade/cli.rb +31 -2
 - data/lib/port_upgrade/version.rb +72 -0
 - data/lib/port_upgrade.rb +27 -22
 - data/test/test_version.rb +69 -0
 - metadata +5 -4
 - data/test/test_port_upgrade_cli.rb +0 -15
 
    
        data/History.txt
    CHANGED
    
    
    
        data/Manifest.txt
    CHANGED
    
    
    
        data/bin/port_upgrade
    CHANGED
    
    
    
        data/lib/port_upgrade/cli.rb
    CHANGED
    
    | 
         @@ -13,12 +13,41 @@ module PortUpgrade extend OptiFlagSet 
     | 
|
| 
       13 
13 
     | 
    
         
             
                optional_flag "receipts" do
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
                optional_switch_flag "portoutdated" do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  description "Call \"port outdated\" instead of using internal routine for determining out of date ports. Overides outdated flag."
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                optional_switch_flag "checkoutdated" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  description "Compare internal outdated routing with \"port outdated \""
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
                
         
     | 
| 
      
 24 
     | 
    
         
            +
                optional_switch_flag "verbose" do
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       16 
27 
     | 
    
         
             
                and_process!
         
     | 
| 
       17 
28 
     | 
    
         | 
| 
       18 
29 
     | 
    
         
             
              class CLI
         
     | 
| 
       19 
30 
     | 
    
         
             
                def self.execute(stdout, arguments=[])
         
     | 
| 
       20 
     | 
    
         
            -
                   
     | 
| 
       21 
     | 
    
         
            -
                   
     | 
| 
      
 31 
     | 
    
         
            +
                  $verbose = true if PortUpgrade.flags.verbose
         
     | 
| 
      
 32 
     | 
    
         
            +
                  if PortUpgrade.flags.portoutdated
         
     | 
| 
      
 33 
     | 
    
         
            +
                    $stderr.print "Running port outdated..."
         
     | 
| 
      
 34 
     | 
    
         
            +
                    outdated = `port outdated`.find_all{|l| (l =~ /(The following|No installed ports are outdated)/).nil? }.collect{|l| l.split[0]}
         
     | 
| 
      
 35 
     | 
    
         
            +
                    $stderr.puts "done"
         
     | 
| 
      
 36 
     | 
    
         
            +
                    if PortUpgrade.flags.checkoutdated
         
     | 
| 
      
 37 
     | 
    
         
            +
                      mypdb = Ports::PortsDB.new(PortUpgrade.flags.receipts)
         
     | 
| 
      
 38 
     | 
    
         
            +
                      myoutdated = mypdb.outdated
         
     | 
| 
      
 39 
     | 
    
         
            +
                      diff = outdated-myoutdated
         
     | 
| 
      
 40 
     | 
    
         
            +
                      if diff.size > 0
         
     | 
| 
      
 41 
     | 
    
         
            +
                        $stderr.puts "Difference with internal: #{(outdated-myoutdated).join(",")}\n\n"
         
     | 
| 
      
 42 
     | 
    
         
            +
                      else
         
     | 
| 
      
 43 
     | 
    
         
            +
                        $stderr.puts "No Difference"
         
     | 
| 
      
 44 
     | 
    
         
            +
                      end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                    pdb = Ports::PortsDB.new(PortUpgrade.flags.receipts,outdated)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  else
         
     | 
| 
      
 48 
     | 
    
         
            +
                    pdb = Ports::PortsDB.new(PortUpgrade.flags.receipts)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    pdb.set_outdated(PortUpgrade.flags.outdated.split(" ")) if PortUpgrade.flags.outdated
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
       22 
51 
     | 
    
         
             
                  $stderr.puts("Outdated(#{pdb.outdated.size}): #{pdb.outdated.join(' ')}")
         
     | 
| 
       23 
52 
     | 
    
         
             
                  to_remove = pdb.to_remove
         
     | 
| 
       24 
53 
     | 
    
         
             
                  $stderr.puts "#{to_remove.size} ports to remove: #{to_remove.join(',')}"
         
     | 
| 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ports
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Version
         
     | 
| 
      
 3 
     | 
    
         
            +
                include Comparable
         
     | 
| 
      
 4 
     | 
    
         
            +
                attr_reader :parts
         
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(s)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @parts = breakup_version(s)
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def <=>(other)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  cmp = 0
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @parts.each_with_index do |p,i|
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #$stderr.puts "Sizes: #{p.size} #{other.parts[i].size}"
         
     | 
| 
      
 13 
     | 
    
         
            +
                    p.each_with_index do |q,j|
         
     | 
| 
      
 14 
     | 
    
         
            +
                      a = q
         
     | 
| 
      
 15 
     | 
    
         
            +
                      b = other.parts[i][j]
         
     | 
| 
      
 16 
     | 
    
         
            +
                      a = a.to_i if a =~ /^[0-9]+$/
         
     | 
| 
      
 17 
     | 
    
         
            +
                      b = b.to_i if b =~ /^[0-9]+$/
         
     | 
| 
      
 18 
     | 
    
         
            +
                      #$stderr.puts "#{a} <=> #{b}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                      cmp = a <=> b
         
     | 
| 
      
 20 
     | 
    
         
            +
                      break if cmp != 0
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                    break if cmp != 0
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  cmp
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                private
         
     | 
| 
      
 28 
     | 
    
         
            +
                def get_state(c)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  case c
         
     | 
| 
      
 30 
     | 
    
         
            +
                  when /[0-9]/
         
     | 
| 
      
 31 
     | 
    
         
            +
                    state = 'd'
         
     | 
| 
      
 32 
     | 
    
         
            +
                  else
         
     | 
| 
      
 33 
     | 
    
         
            +
                    state = 'o'
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def subparts(s)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  state = get_state(s[0,1])
         
     | 
| 
      
 39 
     | 
    
         
            +
                  #puts "State: #{state}"
         
     | 
| 
      
 40 
     | 
    
         
            +
                  parts = []
         
     | 
| 
      
 41 
     | 
    
         
            +
                  part = ""
         
     | 
| 
      
 42 
     | 
    
         
            +
                  s.each_char do |c|
         
     | 
| 
      
 43 
     | 
    
         
            +
                    newstate = get_state(c)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    case newstate
         
     | 
| 
      
 45 
     | 
    
         
            +
                    when state
         
     | 
| 
      
 46 
     | 
    
         
            +
                      part << c
         
     | 
| 
      
 47 
     | 
    
         
            +
                    else
         
     | 
| 
      
 48 
     | 
    
         
            +
                      parts << part #[part,state]
         
     | 
| 
      
 49 
     | 
    
         
            +
                      part = ""
         
     | 
| 
      
 50 
     | 
    
         
            +
                      part << c
         
     | 
| 
      
 51 
     | 
    
         
            +
                      state = newstate
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  parts << part #[part,state]
         
     | 
| 
      
 55 
     | 
    
         
            +
                  parts
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                def breakup_version(v)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  raise "Bad input to version; not String" unless v.is_a?(String)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  if v =~ /\[[^\]]+\]/
         
     | 
| 
      
 61 
     | 
    
         
            +
                    $stderr.puts "code version: #{v}"
         
     | 
| 
      
 62 
     | 
    
         
            +
                    result = ["0"]
         
     | 
| 
      
 63 
     | 
    
         
            +
                  else
         
     | 
| 
      
 64 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 65 
     | 
    
         
            +
                    v.split(/[-_.]/).each do |part|
         
     | 
| 
      
 66 
     | 
    
         
            +
                      result << subparts(part)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                  result
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/port_upgrade.rb
    CHANGED
    
    | 
         @@ -26,7 +26,7 @@ class String 
     | 
|
| 
       26 
26 
     | 
    
         
             
            end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            module Ports
         
     | 
| 
       29 
     | 
    
         
            -
              VERSION = '0.0. 
     | 
| 
      
 29 
     | 
    
         
            +
              VERSION = '0.0.4'
         
     | 
| 
       30 
30 
     | 
    
         
             
              RECEIPT_PATH = '/opt/local/var/macports/receipts'
         
     | 
| 
       31 
31 
     | 
    
         
             
              MACPORTS_DB='/opt/local/var/macports/sources/rsync.macports.org/release/ports'
         
     | 
| 
       32 
32 
     | 
    
         
             
              CONFIG_FILE = 'port_upgrade.conf'
         
     | 
| 
         @@ -54,21 +54,9 @@ module Ports 
     | 
|
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                def self.cmp_vers(versa,versb)
         
     | 
| 
       57 
     | 
    
         
            -
                   
     | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
       59 
     | 
    
         
            -
                   
     | 
| 
       60 
     | 
    
         
            -
                  b=sb.to_i
         
     | 
| 
       61 
     | 
    
         
            -
                  #a==0 ? asize=0 : asize = Math.log10(a).to_i
         
     | 
| 
       62 
     | 
    
         
            -
                  asize=sa.length
         
     | 
| 
       63 
     | 
    
         
            -
                  #b==0 ? bsize=0 : bsize = Math.log10(b).to_i
         
     | 
| 
       64 
     | 
    
         
            -
                  bsize=sb.length
         
     | 
| 
       65 
     | 
    
         
            -
                  diff = asize-bsize
         
     | 
| 
       66 
     | 
    
         
            -
                  if diff < 0
         
     | 
| 
       67 
     | 
    
         
            -
                    a = a * (10 ** diff.abs)
         
     | 
| 
       68 
     | 
    
         
            -
                  elsif diff > 0
         
     | 
| 
       69 
     | 
    
         
            -
                    b = b * (10 ** diff.abs)
         
     | 
| 
       70 
     | 
    
         
            -
                  end
         
     | 
| 
       71 
     | 
    
         
            -
                  a <=> b
         
     | 
| 
      
 57 
     | 
    
         
            +
                  va = Version.new(versa)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  vb = Version.new(versb)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  return va <=> vb
         
     | 
| 
       72 
60 
     | 
    
         
             
                end
         
     | 
| 
       73 
61 
     | 
    
         
             
              end
         
     | 
| 
       74 
62 
     | 
    
         | 
| 
         @@ -149,12 +137,12 @@ module Ports 
     | 
|
| 
       149 
137 
     | 
    
         
             
                  @pdb.db.execute("create table ports(port text,version text, variant text)")
         
     | 
| 
       150 
138 
     | 
    
         
             
                  @pdb.db.execute("create table deps(port text, dep text)")
         
     | 
| 
       151 
139 
     | 
    
         
             
                  @pdb.db.execute("create unique index uniqdep on deps(port,dep)")
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
      
 140 
     | 
    
         
            +
                  receipt_size = receipt_path.split("/").size
         
     | 
| 
       153 
141 
     | 
    
         
             
                  Find.find(receipt_path) do |filename|
         
     | 
| 
       154 
142 
     | 
    
         
             
                    next unless filename =~ /.bz2$/
         
     | 
| 
       155 
143 
     | 
    
         
             
                    next unless File.stat(filename).file?
         
     | 
| 
       156 
144 
     | 
    
         
             
                    pieces = filename.split("/")
         
     | 
| 
       157 
     | 
    
         
            -
                    next unless pieces.size ==  
     | 
| 
      
 145 
     | 
    
         
            +
                    next unless (pieces.size - receipt_size) == 3
         
     | 
| 
       158 
146 
     | 
    
         
             
                    original_portname = pieces[-3]
         
     | 
| 
       159 
147 
     | 
    
         
             
                    md = /([^+]+)((\+\w+)*)/.match(pieces[-2]) #seperate version from variants
         
     | 
| 
       160 
148 
     | 
    
         
             
                    version = md[1]
         
     | 
| 
         @@ -326,7 +314,15 @@ module Ports 
     | 
|
| 
       326 
314 
     | 
    
         
             
                      if File.exist?(portfile_path)
         
     | 
| 
       327 
315 
     | 
    
         
             
                        curver = Portfile.new(portfile_path).version
         
     | 
| 
       328 
316 
     | 
    
         
             
                        #puts "%-32s%s < %s" %[port,version.split('+').first,curver] if Ports::Utilities.cmp_vers(version.split('+').first,curver) < 0
         
     | 
| 
       329 
     | 
    
         
            -
                         
     | 
| 
      
 317 
     | 
    
         
            +
                        $stderr.puts("#{port}: #{version.split('+').first}, #{curver}") if $verbose
         
     | 
| 
      
 318 
     | 
    
         
            +
                        cmp = Ports::Utilities.cmp_vers(version.split('+').first,curver)
         
     | 
| 
      
 319 
     | 
    
         
            +
                        if cmp.nil?
         
     | 
| 
      
 320 
     | 
    
         
            +
                          $stderr.puts "Unable to compare versions: #{[port]}"
         
     | 
| 
      
 321 
     | 
    
         
            +
                        else
         
     | 
| 
      
 322 
     | 
    
         
            +
                           if cmp < 0
         
     | 
| 
      
 323 
     | 
    
         
            +
                             @outdated << port
         
     | 
| 
      
 324 
     | 
    
         
            +
                           end
         
     | 
| 
      
 325 
     | 
    
         
            +
                         end
         
     | 
| 
       330 
326 
     | 
    
         
             
                      else
         
     | 
| 
       331 
327 
     | 
    
         
             
                        $stderr.puts "Unable to process Portfile (File Not Found) for #{port}"
         
     | 
| 
       332 
328 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -373,7 +369,7 @@ module Ports 
     | 
|
| 
       373 
369 
     | 
    
         
             
                    end
         
     | 
| 
       374 
370 
     | 
    
         
             
                    bi = get_before_install(port)
         
     | 
| 
       375 
371 
     | 
    
         
             
                    dotsh.puts(bi) unless bi.nil?
         
     | 
| 
       376 
     | 
    
         
            -
                    dotsh.puts("port install #{port} #{remvariants[port][variantindex]} || exit -1")
         
     | 
| 
      
 372 
     | 
    
         
            +
                    dotsh.puts("port #{get_force(port)} install #{port} #{remvariants[port][variantindex]} || exit -1")
         
     | 
| 
       377 
373 
     | 
    
         
             
                    ai = get_after_install(port)
         
     | 
| 
       378 
374 
     | 
    
         
             
                    dotsh.puts(ai) unless ai.nil?
         
     | 
| 
       379 
375 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -381,6 +377,15 @@ module Ports 
     | 
|
| 
       381 
377 
     | 
    
         
             
                  true
         
     | 
| 
       382 
378 
     | 
    
         
             
                end
         
     | 
| 
       383 
379 
     | 
    
         | 
| 
      
 380 
     | 
    
         
            +
                def get_force(portname)
         
     | 
| 
      
 381 
     | 
    
         
            +
                  force = get_port_action(portname,:force_install)
         
     | 
| 
      
 382 
     | 
    
         
            +
                  if force
         
     | 
| 
      
 383 
     | 
    
         
            +
                    return "-f"
         
     | 
| 
      
 384 
     | 
    
         
            +
                  else
         
     | 
| 
      
 385 
     | 
    
         
            +
                    return ""
         
     | 
| 
      
 386 
     | 
    
         
            +
                  end
         
     | 
| 
      
 387 
     | 
    
         
            +
                end
         
     | 
| 
      
 388 
     | 
    
         
            +
                
         
     | 
| 
       384 
389 
     | 
    
         
             
                def get_before_uninstall(portname)
         
     | 
| 
       385 
390 
     | 
    
         
             
                  get_port_action(portname,:before_uninstall)
         
     | 
| 
       386 
391 
     | 
    
         
             
                end
         
     | 
| 
         @@ -466,8 +471,8 @@ module Ports 
     | 
|
| 
       466 
471 
     | 
    
         
             
                    when /^revision\s+([^\s]+)/
         
     | 
| 
       467 
472 
     | 
    
         
             
                      rev = $1
         
     | 
| 
       468 
473 
     | 
    
         
             
                      #$stderr.puts "revision found #{rev}"
         
     | 
| 
       469 
     | 
    
         
            -
                    when  
     | 
| 
       470 
     | 
    
         
            -
                      v = $2 if v.nil?
         
     | 
| 
      
 474 
     | 
    
         
            +
                    when /(\w+\.setup\s+\{[^\}]+\}\s+([^\s]+)|^\w+\.setup\s+[^ ]+ (.*))/
         
     | 
| 
      
 475 
     | 
    
         
            +
                      v = $2 || $3 if v.nil?
         
     | 
| 
       471 
476 
     | 
    
         
             
                      break
         
     | 
| 
       472 
477 
     | 
    
         
             
                    when /(\S+)\s+([^$]+)$/
         
     | 
| 
       473 
478 
     | 
    
         
             
                      vars[$1] = $2
         
     | 
| 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), '..', 'lib','port_upgrade','version')
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 3 
     | 
    
         
            +
            include Ports
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class TestVersion < Test::Unit::TestCase
         
     | 
| 
      
 6 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 7 
     | 
    
         
            +
                raw_tests = %q{ImageMagick                    6.4.6-7_0 < 6.4.8-1_0     
         
     | 
| 
      
 8 
     | 
    
         
            +
                binutils                       2.17_0 < 2.19_0           
         
     | 
| 
      
 9 
     | 
    
         
            +
                boost                          1.35.0_2 < 1.37.0_0       
         
     | 
| 
      
 10 
     | 
    
         
            +
                cairo                          1.8.4_0 < 1.8.6_1         
         
     | 
| 
      
 11 
     | 
    
         
            +
                dbus                           1.2.4_2 < 1.2.10_0        
         
     | 
| 
      
 12 
     | 
    
         
            +
                dbus-glib                      0.76_1 < 0.78_0           
         
     | 
| 
      
 13 
     | 
    
         
            +
                fftw-3                         3.2_0 < 3.2_1             
         
     | 
| 
      
 14 
     | 
    
         
            +
                fontconfig                     2.6.0_0 < 2.6.0_1         
         
     | 
| 
      
 15 
     | 
    
         
            +
                git-core                       1.6.0.4_0 < 1.6.1_0       
         
     | 
| 
      
 16 
     | 
    
         
            +
                gtk2                           2.14.4_1 < 2.14.5_0       
         
     | 
| 
      
 17 
     | 
    
         
            +
                iso-codes                      3.2_0 < 3.5_0             
         
     | 
| 
      
 18 
     | 
    
         
            +
                libgpg-error                   1.6_0 < 1.7_0             
         
     | 
| 
      
 19 
     | 
    
         
            +
                libidl                         0.8.11_0 < 0.8.12_0       
         
     | 
| 
      
 20 
     | 
    
         
            +
                libpng                         1.2.33_0 < 1.2.34_0       
         
     | 
| 
      
 21 
     | 
    
         
            +
                libtool                        1.5.26_0 < 2.2.6a_0       
         
     | 
| 
      
 22 
     | 
    
         
            +
                mhash                          0.9.9_0 < 0.9.9.9_0       
         
     | 
| 
      
 23 
     | 
    
         
            +
                pango                          1.22.3_0 < 1.22.4_0       
         
     | 
| 
      
 24 
     | 
    
         
            +
                proj                           4.6.0_0 < 4.6.1_0         
         
     | 
| 
      
 25 
     | 
    
         
            +
                py25-hashlib                   2.5.2_0 < 2.5.4_0         
         
     | 
| 
      
 26 
     | 
    
         
            +
                py25-sqlite3                   2.5.2_0 < 2.5.4_0         
         
     | 
| 
      
 27 
     | 
    
         
            +
                py25-zlib                      2.5.2_0 < 2.5.4_0         
         
     | 
| 
      
 28 
     | 
    
         
            +
                python25                       2.5.2_7 < 2.5.4_0         
         
     | 
| 
      
 29 
     | 
    
         
            +
                subversion                     1.5.4_0 < 1.5.5_0         
         
     | 
| 
      
 30 
     | 
    
         
            +
                subversion-perlbindings        1.5.4_0 < 1.5.5_0         
         
     | 
| 
      
 31 
     | 
    
         
            +
                wireshark                      1.0.4_0 < 1.0.5_0         
         
     | 
| 
      
 32 
     | 
    
         
            +
                xorg-util-macros               1.2.0_0 < 1.2.1_0         
         
     | 
| 
      
 33 
     | 
    
         
            +
                xrender                        0.9.4_1 < 0.9.4_4
         
     | 
| 
      
 34 
     | 
    
         
            +
            }
         
     | 
| 
      
 35 
     | 
    
         
            +
              @tests = raw_tests.collect{|l| parts = l.split(" "); [parts[1],parts[3]] }
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              def test_1
         
     | 
| 
      
 39 
     | 
    
         
            +
                v1 = Version.new("1.2.6_0")
         
     | 
| 
      
 40 
     | 
    
         
            +
                v2 = Version.new("1.2.10_0")
         
     | 
| 
      
 41 
     | 
    
         
            +
                assert_equal(v1 <=> v2, -1)
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              def test_2
         
     | 
| 
      
 45 
     | 
    
         
            +
                v1 = Version.new("1.5.26_0")
         
     | 
| 
      
 46 
     | 
    
         
            +
                v2 = Version.new("2.2.6a_0")
         
     | 
| 
      
 47 
     | 
    
         
            +
                assert_equal(v1 <=> v2, -1)
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              def test_3
         
     | 
| 
      
 51 
     | 
    
         
            +
                v1 = Version.new("2.2.6b_0")
         
     | 
| 
      
 52 
     | 
    
         
            +
                v2 = Version.new("2.2.6a_0")
         
     | 
| 
      
 53 
     | 
    
         
            +
                assert_equal(v1 <=> v2, 1)
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
              
         
     | 
| 
      
 56 
     | 
    
         
            +
              def test_current
         
     | 
| 
      
 57 
     | 
    
         
            +
                @tests.each do |test|
         
     | 
| 
      
 58 
     | 
    
         
            +
                  v1 = Version.new(test[0])
         
     | 
| 
      
 59 
     | 
    
         
            +
                  v2 = Version.new(test[1])
         
     | 
| 
      
 60 
     | 
    
         
            +
                  assert_equal(v1 <=> v2, -1)
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
              
         
     | 
| 
      
 64 
     | 
    
         
            +
              def test_other_class
         
     | 
| 
      
 65 
     | 
    
         
            +
                assert_raise RuntimeError do
         
     | 
| 
      
 66 
     | 
    
         
            +
                  v = Version.new(["2"])
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: port_upgrade
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tony Doan
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-01-02 00:00:00 -08:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -80,6 +80,7 @@ files: 
     | 
|
| 
       80 
80 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       81 
81 
     | 
    
         
             
            - lib/port_upgrade.rb
         
     | 
| 
       82 
82 
     | 
    
         
             
            - lib/port_upgrade/cli.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - lib/port_upgrade/version.rb
         
     | 
| 
       83 
84 
     | 
    
         
             
            - bin/port_upgrade
         
     | 
| 
       84 
85 
     | 
    
         
             
            - etc/port_upgrade.conf.sample
         
     | 
| 
       85 
86 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
         @@ -88,7 +89,7 @@ post_install_message: |+ 
     | 
|
| 
       88 
89 
     | 
    
         | 
| 
       89 
90 
     | 
    
         | 
| 
       90 
91 
     | 
    
         
             
              A sample config file can be found in:
         
     | 
| 
       91 
     | 
    
         
            -
              /opt/local/lib/ruby/gems/1.8/gems/port_upgrade-0.0. 
     | 
| 
      
 92 
     | 
    
         
            +
              /opt/local/lib/ruby/gems/1.8/gems/port_upgrade-0.0.4/etc
         
     | 
| 
       92 
93 
     | 
    
         
             
              To install copy it to ~/.port_upgrade.conf
         
     | 
| 
       93 
94 
     | 
    
         | 
| 
       94 
95 
     | 
    
         | 
| 
         @@ -117,4 +118,4 @@ signing_key: 
     | 
|
| 
       117 
118 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       118 
119 
     | 
    
         
             
            summary: Summary
         
     | 
| 
       119 
120 
     | 
    
         
             
            test_files: 
         
     | 
| 
       120 
     | 
    
         
            -
            - test/ 
     | 
| 
      
 121 
     | 
    
         
            +
            - test/test_version.rb
         
     | 
| 
         @@ -1,15 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.join(File.dirname(__FILE__), "test_helper.rb")
         
     | 
| 
       2 
     | 
    
         
            -
            require 'port_upgrade/cli'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            class TestPortUpgradeCli < Test::Unit::TestCase
         
     | 
| 
       5 
     | 
    
         
            -
              def setup
         
     | 
| 
       6 
     | 
    
         
            -
                @stdout_io = StringIO.new
         
     | 
| 
       7 
     | 
    
         
            -
                PortUpgrade::CLI.execute(@stdout_io, [])
         
     | 
| 
       8 
     | 
    
         
            -
                @stdout_io.rewind
         
     | 
| 
       9 
     | 
    
         
            -
                @stdout = @stdout_io.read
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
              
         
     | 
| 
       12 
     | 
    
         
            -
              def test_not_print_default_output
         
     | 
| 
       13 
     | 
    
         
            -
                assert_no_match(/To update this executable/, @stdout)
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
            end
         
     |