port_upgrade 0.0.2 → 0.0.3
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 +7 -0
 - data/Manifest.txt +1 -1
 - data/Rakefile +12 -7
 - data/etc/port_upgrade.conf.sample +11 -0
 - data/lib/port_upgrade/cli.rb +1 -1
 - data/lib/port_upgrade.rb +22 -8
 - metadata +10 -9
 - data/PostInstall.txt +0 -5
 
    
        data/History.txt
    CHANGED
    
    | 
         @@ -1,3 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == 0.0.3 2008-12-23
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Bug Fix Release:
         
     | 
| 
      
 4 
     | 
    
         
            +
              * Include sample port_upgrade.conf
         
     | 
| 
      
 5 
     | 
    
         
            +
              * BUG #23330- Fix issue with ports categorized in one place but have their Portfile in another
         
     | 
| 
      
 6 
     | 
    
         
            +
              * BUG #23362 - Fix receipt parsing issue with binary runtime dependencies 
         
     | 
| 
      
 7 
     | 
    
         
            +
              * Outdated output now includes a count
         
     | 
| 
       1 
8 
     | 
    
         
             
            == 0.0.2 2008-12-23
         
     | 
| 
       2 
9 
     | 
    
         | 
| 
       3 
10 
     | 
    
         
             
            * Second rubyforge release:
         
     | 
    
        data/Manifest.txt
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,13 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
         
     | 
| 
       2 
2 
     | 
    
         
             
            require File.dirname(__FILE__) + '/lib/port_upgrade.rb'
         
     | 
| 
      
 3 
     | 
    
         
            +
            GEM_HOME = File.join(RbConfig::CONFIG["libdir"],RbConfig::CONFIG["RUBY_INSTALL_NAME"],"gems")
         
     | 
| 
      
 4 
     | 
    
         
            +
            GEM_DIR = File.join(GEM_HOME,RbConfig::CONFIG["ruby_version"],"gems")
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            # Generate all the Rake tasks
         
     | 
| 
       5 
     | 
    
         
            -
            # Run 'rake -T' to see list of generated tasks (from gem root directory)
         
     | 
| 
       6 
6 
     | 
    
         
             
            $hoe = Hoe.new('port_upgrade',Ports::VERSION) do |p|
         
     | 
| 
       7 
7 
     | 
    
         
             
              p.developer('Tony Doan', 'tdoan@tdoan.com')
         
     | 
| 
       8 
8 
     | 
    
         
             
              p.changes              = p.paragraphs_of("History.txt", 0..1).join("\n\n")
         
     | 
| 
       9 
     | 
    
         
            -
              p.post_install_message =  
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
              p.post_install_message = %Q{
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            A sample config file can be found in:
         
     | 
| 
      
 12 
     | 
    
         
            +
            #{GEM_DIR}/port_upgrade-#{Ports::VERSION}/etc
         
     | 
| 
      
 13 
     | 
    
         
            +
            To install copy it to ~/.port_upgrade.conf
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              p.rubyforge_name       = "portupgrade"
         
     | 
| 
       11 
19 
     | 
    
         
             
              p.summary = "Summary"
         
     | 
| 
       12 
20 
     | 
    
         
             
              p.extra_deps         = [
         
     | 
| 
       13 
21 
     | 
    
         
             
                ['sqlite3-ruby','>= 1.2.0'],
         
     | 
| 
         @@ -26,6 +34,3 @@ end 
     | 
|
| 
       26 
34 
     | 
    
         | 
| 
       27 
35 
     | 
    
         
             
            require 'newgem/tasks' # load /tasks/*.rake
         
     | 
| 
       28 
36 
     | 
    
         
             
            Dir['tasks/**/*.rake'].each { |t| load t }
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
            # TODO - want other tests/tasks run by default? Add them to the list
         
     | 
| 
       31 
     | 
    
         
            -
            # task :default => [:spec, :features]
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- 
         
     | 
| 
      
 2 
     | 
    
         
            +
            :actions:
         
     | 
| 
      
 3 
     | 
    
         
            +
              ruby: 
         
     | 
| 
      
 4 
     | 
    
         
            +
                :after_uninstall: rm -rf /opt/local/share/ri
         
     | 
| 
      
 5 
     | 
    
         
            +
              ncursesw:
         
     | 
| 
      
 6 
     | 
    
         
            +
                :after_uninstall: rm -rf /opt/local/share/terminfo
         
     | 
| 
      
 7 
     | 
    
         
            +
              ImageMagick:
         
     | 
| 
      
 8 
     | 
    
         
            +
                :before_uninstall: gem uninstall rmagick
         
     | 
| 
      
 9 
     | 
    
         
            +
                :after_install: gem install rmagick
         
     | 
| 
      
 10 
     | 
    
         
            +
              python25:
         
     | 
| 
      
 11 
     | 
    
         
            +
                :after_install: python_select python25
         
     | 
    
        data/lib/port_upgrade/cli.rb
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ module PortUpgrade extend OptiFlagSet 
     | 
|
| 
       19 
19 
     | 
    
         
             
                def self.execute(stdout, arguments=[])
         
     | 
| 
       20 
20 
     | 
    
         
             
                  pdb = Ports::PortsDB.new(PortUpgrade.flags.receipts)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  pdb.set_outdated(PortUpgrade.flags.outdated.split(" ")) if PortUpgrade.flags.outdated
         
     | 
| 
       22 
     | 
    
         
            -
                  $stderr.puts("Outdated: #{pdb.outdated.join(' ')}")
         
     | 
| 
      
 22 
     | 
    
         
            +
                  $stderr.puts("Outdated(#{pdb.outdated.size}): #{pdb.outdated.join(' ')}")
         
     | 
| 
       23 
23 
     | 
    
         
             
                  to_remove = pdb.to_remove
         
     | 
| 
       24 
24 
     | 
    
         
             
                  $stderr.puts "#{to_remove.size} ports to remove: #{to_remove.join(',')}"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  pdb.upgrade(PortUpgrade.flags.output)
         
     | 
    
        data/lib/port_upgrade.rb
    CHANGED
    
    | 
         @@ -26,10 +26,10 @@ class String 
     | 
|
| 
       26 
26 
     | 
    
         
             
            end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            module Ports
         
     | 
| 
       29 
     | 
    
         
            -
              VERSION = '0.0. 
     | 
| 
      
 29 
     | 
    
         
            +
              VERSION = '0.0.3'
         
     | 
| 
       30 
30 
     | 
    
         
             
              RECEIPT_PATH = '/opt/local/var/macports/receipts'
         
     | 
| 
       31 
31 
     | 
    
         
             
              MACPORTS_DB='/opt/local/var/macports/sources/rsync.macports.org/release/ports'
         
     | 
| 
       32 
     | 
    
         
            -
              CONFIG_FILE = ' 
     | 
| 
      
 32 
     | 
    
         
            +
              CONFIG_FILE = 'port_upgrade.conf'
         
     | 
| 
       33 
33 
     | 
    
         
             
              Struct.new('Edge',:port,:dep,:level)
         
     | 
| 
       34 
34 
     | 
    
         
             
              class Struct::Edge
         
     | 
| 
       35 
35 
     | 
    
         
             
                def <=>(other)
         
     | 
| 
         @@ -180,7 +180,7 @@ module Ports 
     | 
|
| 
       180 
180 
     | 
    
         
             
                      if l =~ /depends_run (\{([^}]*)\}|([^ ]*))/
         
     | 
| 
       181 
181 
     | 
    
         
             
                        deps = $2||$3
         
     | 
| 
       182 
182 
     | 
    
         
             
                        deps.split(" ").each do |d|
         
     | 
| 
       183 
     | 
    
         
            -
                          original_depname = d.split(":") 
     | 
| 
      
 183 
     | 
    
         
            +
                          original_depname = d.split(":").last
         
     | 
| 
       184 
184 
     | 
    
         
             
                          depname = d.split(":")[1].gsub(/(-|\.|\/)/,'_')
         
     | 
| 
       185 
185 
     | 
    
         
             
                          begin
         
     | 
| 
       186 
186 
     | 
    
         
             
                            @pdb.db.execute("insert into deps values(?,?)",original_portname,original_depname)
         
     | 
| 
         @@ -241,7 +241,6 @@ module Ports 
     | 
|
| 
       241 
241 
     | 
    
         
             
                  to_search << File.join(local_dir,"etc",Ports::CONFIG_FILE)
         
     | 
| 
       242 
242 
     | 
    
         
             
                  to_search << File.join(ENV['HOME'],"."+Ports::CONFIG_FILE)
         
     | 
| 
       243 
243 
     | 
    
         
             
                  to_search.each do |path|
         
     | 
| 
       244 
     | 
    
         
            -
                    $stderr.puts "PATH: #{path}"
         
     | 
| 
       245 
244 
     | 
    
         
             
                    return path if File.readable?(path)
         
     | 
| 
       246 
245 
     | 
    
         
             
                  end
         
     | 
| 
       247 
246 
     | 
    
         
             
                  return nil
         
     | 
| 
         @@ -312,10 +311,25 @@ module Ports 
     | 
|
| 
       312 
311 
     | 
    
         
             
                        end
         
     | 
| 
       313 
312 
     | 
    
         
             
                      end
         
     | 
| 
       314 
313 
     | 
    
         
             
                      portfile_path = File.join(MACPORTS_DB,cats.flatten,port,'Portfile')
         
     | 
| 
       315 
     | 
    
         
            -
                       
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
       318 
     | 
    
         
            -
             
     | 
| 
      
 314 
     | 
    
         
            +
                      unless File.exist?(portfile_path)
         
     | 
| 
      
 315 
     | 
    
         
            +
                        $stderr.puts "Searching for #{port}'s Portfile"
         
     | 
| 
      
 316 
     | 
    
         
            +
                        Dir.entries(MACPORTS_DB).each do |d|
         
     | 
| 
      
 317 
     | 
    
         
            +
                          if File.directory?(File.join(MACPORTS_DB,d)) && d != '.' && d != '..'
         
     | 
| 
      
 318 
     | 
    
         
            +
                            testpath = File.join(MACPORTS_DB,d,port,'Portfile')
         
     | 
| 
      
 319 
     | 
    
         
            +
                            if File.exist?(testpath)
         
     | 
| 
      
 320 
     | 
    
         
            +
                               portfile_path = testpath
         
     | 
| 
      
 321 
     | 
    
         
            +
                               break
         
     | 
| 
      
 322 
     | 
    
         
            +
                             end
         
     | 
| 
      
 323 
     | 
    
         
            +
                          end
         
     | 
| 
      
 324 
     | 
    
         
            +
                        end
         
     | 
| 
      
 325 
     | 
    
         
            +
                      end
         
     | 
| 
      
 326 
     | 
    
         
            +
                      if File.exist?(portfile_path)
         
     | 
| 
      
 327 
     | 
    
         
            +
                        curver = Portfile.new(portfile_path).version
         
     | 
| 
      
 328 
     | 
    
         
            +
                        #puts "%-32s%s < %s" %[port,version.split('+').first,curver] if Ports::Utilities.cmp_vers(version.split('+').first,curver) < 0
         
     | 
| 
      
 329 
     | 
    
         
            +
                        @outdated << port if Ports::Utilities.cmp_vers(version.split('+').first,curver) < 0
         
     | 
| 
      
 330 
     | 
    
         
            +
                      else
         
     | 
| 
      
 331 
     | 
    
         
            +
                        $stderr.puts "Unable to process Portfile (File Not Found) for #{port}"
         
     | 
| 
      
 332 
     | 
    
         
            +
                      end
         
     | 
| 
       319 
333 
     | 
    
         
             
                    end
         
     | 
| 
       320 
334 
     | 
    
         
             
                  end
         
     | 
| 
       321 
335 
     | 
    
         
             
                  @outdated.uniq
         
     | 
    
        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.3
         
     | 
| 
       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: 2008-12- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-12-31 00:00:00 -08:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -72,25 +72,26 @@ extensions: [] 
     | 
|
| 
       72 
72 
     | 
    
         
             
            extra_rdoc_files: 
         
     | 
| 
       73 
73 
     | 
    
         
             
            - History.txt
         
     | 
| 
       74 
74 
     | 
    
         
             
            - Manifest.txt
         
     | 
| 
       75 
     | 
    
         
            -
            - PostInstall.txt
         
     | 
| 
       76 
75 
     | 
    
         
             
            - README.txt
         
     | 
| 
       77 
76 
     | 
    
         
             
            files: 
         
     | 
| 
       78 
77 
     | 
    
         
             
            - History.txt
         
     | 
| 
       79 
78 
     | 
    
         
             
            - Manifest.txt
         
     | 
| 
       80 
     | 
    
         
            -
            - PostInstall.txt
         
     | 
| 
       81 
79 
     | 
    
         
             
            - README.txt
         
     | 
| 
       82 
80 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       83 
81 
     | 
    
         
             
            - lib/port_upgrade.rb
         
     | 
| 
       84 
82 
     | 
    
         
             
            - lib/port_upgrade/cli.rb
         
     | 
| 
       85 
83 
     | 
    
         
             
            - bin/port_upgrade
         
     | 
| 
      
 84 
     | 
    
         
            +
            - etc/port_upgrade.conf.sample
         
     | 
| 
       86 
85 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       87 
86 
     | 
    
         
             
            homepage: http://portupgrade.rubyforge.org/
         
     | 
| 
       88 
     | 
    
         
            -
            post_install_message:  
     | 
| 
       89 
     | 
    
         
            -
               
     | 
| 
      
 87 
     | 
    
         
            +
            post_install_message: |+
         
     | 
| 
      
 88 
     | 
    
         
            +
              
         
     | 
| 
      
 89 
     | 
    
         
            +
              
         
     | 
| 
      
 90 
     | 
    
         
            +
              A sample config file can be found in:
         
     | 
| 
      
 91 
     | 
    
         
            +
              /opt/local/lib/ruby/gems/1.8/gems/port_upgrade-0.0.3/etc
         
     | 
| 
      
 92 
     | 
    
         
            +
              To install copy it to ~/.port_upgrade.conf
         
     | 
| 
      
 93 
     | 
    
         
            +
              
         
     | 
| 
       90 
94 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
              sudo port selfupdate (or sync)
         
     | 
| 
       92 
     | 
    
         
            -
              port_upgrade -output upgrade.sh
         
     | 
| 
       93 
     | 
    
         
            -
              sudo ./upgrade.sh # Watch it fly
         
     | 
| 
       94 
95 
     | 
    
         
             
            rdoc_options: 
         
     | 
| 
       95 
96 
     | 
    
         
             
            - --main
         
     | 
| 
       96 
97 
     | 
    
         
             
            - README.txt
         
     | 
    
        data/PostInstall.txt
    DELETED
    
    | 
         @@ -1,5 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Port upgrade will recursively uninstall and reinstall your ports tree to get it fresh and clean and up to date. This gem installs a command "port_upgrade" which requires one option "-output". Portupgrade generates a shell script to do the actual work. To use port_upgrade do the following:
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            sudo port selfupdate (or sync)
         
     | 
| 
       4 
     | 
    
         
            -
            port_upgrade -output upgrade.sh
         
     | 
| 
       5 
     | 
    
         
            -
            sudo ./upgrade.sh # Watch it fly
         
     |