purplepkg 0.0.4 → 0.0.5
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/lib/purple/debian.rb +1 -1
- data/lib/purple/getter.rb +1 -1
- data/lib/purple/getter_wget.rb +37 -28
- data/lib/purple/makefile.rb +3 -3
- data/lib/purple/matches.rb +1 -1
- data/lib/purple/pkg_actions.rb +2 -2
- data/lib/purple/process.rb +2 -2
- data/lib/purple/script.rb +9 -10
- metadata +2 -2
    
        data/lib/purple/debian.rb
    CHANGED
    
    | @@ -50,7 +50,7 @@ module Purple | |
| 50 50 |  | 
| 51 51 | 
             
                    def deploy
         | 
| 52 52 | 
             
                        package_list = Dir.new(packagedir).to_a.reject{|s| s =~ /^\.{1,2}/}
         | 
| 53 | 
            -
                        puts "DEBUG PurpleCabinet#deploy(debian.rb): #{package_list.inspect}"
         | 
| 53 | 
            +
                        puts "DEBUG PurpleCabinet#deploy(debian.rb): #{package_list.inspect}" if $DEBUG
         | 
| 54 54 | 
             
                        system "cd #{packagedir}; sudo dpkg -i #{package_list.collect{|s| '"'+s+'"'}.join(' ')}"
         | 
| 55 55 | 
             
                    end
         | 
| 56 56 | 
             
                end
         | 
    
        data/lib/purple/getter.rb
    CHANGED
    
    
    
        data/lib/purple/getter_wget.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Purple | |
| 11 11 | 
             
                        def get
         | 
| 12 12 | 
             
                            @thread = Thread.new do
         | 
| 13 13 | 
             
                                filename = File.basename uri.path
         | 
| 14 | 
            -
                                Open3.popen3 "wget --progress dot -O '#{@destdir}/#{filename}' #{@uri.to_s} 2>&1" do
         | 
| 14 | 
            +
                                Open3.popen3 "wget --passive-ftp --progress dot -O '#{@destdir}/#{filename}' #{@uri.to_s} 2>&1" do
         | 
| 15 15 | 
             
                                    |pw, pr, pe|
         | 
| 16 16 | 
             
                                    parse_input pw, pr, pe
         | 
| 17 17 | 
             
                                end
         | 
| @@ -25,27 +25,26 @@ module Purple | |
| 25 25 | 
             
                        # wget specific methods
         | 
| 26 26 |  | 
| 27 27 | 
             
                        def parse_input pw, pr, pe
         | 
| 28 | 
            -
                             | 
| 28 | 
            +
                            puts "DEBUG Getter_wget#parse_input: Start" if $DEBUG
         | 
| 29 29 |  | 
| 30 30 | 
             
                            loop do
         | 
| 31 31 | 
             
                                # Start line
         | 
| 32 32 | 
             
                                2.times { pr.gets }
         | 
| 33 33 |  | 
| 34 34 | 
             
                                # Host lookup
         | 
| 35 | 
            -
                                 | 
| 35 | 
            +
                                puts "DEBUG Getter_wget#parse_input: Host lookup" if $DEBUG
         | 
| 36 36 | 
             
                                line = pr.gets
         | 
| 37 | 
            -
                                 | 
| 37 | 
            +
                                puts "->#{line}" if $DEBUG
         | 
| 38 38 | 
             
                                if line =~ /failed:/
         | 
| 39 39 | 
             
                                    @status = 'Host lookup failed'
         | 
| 40 40 | 
             
                                    return
         | 
| 41 41 | 
             
                                end
         | 
| 42 42 |  | 
| 43 43 | 
             
                                # Connecting
         | 
| 44 | 
            -
                                 | 
| 44 | 
            +
                                puts "DEBUG Getter_wget#parse_input: Connecting" if $DEBUG
         | 
| 45 45 | 
             
                                line = pr.gets
         | 
| 46 | 
            -
                                 | 
| 46 | 
            +
                                puts "->#{line}" if $DEBUG
         | 
| 47 47 | 
             
                                md = /^Connecting to (.*?)... (.*?)$/.match line
         | 
| 48 | 
            -
                                #puts "DEBUG Getter_wget#parse_input: md[2]=#{md[2].inspect}"
         | 
| 49 48 |  | 
| 50 49 | 
             
                                unless 'connected.' == md[2]
         | 
| 51 50 | 
             
                                    @status = 'Connection failed'
         | 
| @@ -53,41 +52,51 @@ module Purple | |
| 53 52 | 
             
                                end
         | 
| 54 53 |  | 
| 55 54 | 
             
                                # Request
         | 
| 56 | 
            -
                                 | 
| 55 | 
            +
                                puts "DEBUG Getter_wget#parse_input: Sending request" if $DEBUG
         | 
| 57 56 | 
             
                                line = pr.gets
         | 
| 58 | 
            -
                                 | 
| 59 | 
            -
                                 | 
| 60 | 
            -
                                 | 
| 61 | 
            -
             | 
| 62 | 
            -
                                     | 
| 63 | 
            -
             | 
| 64 | 
            -
                                     | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
                                     | 
| 69 | 
            -
             | 
| 57 | 
            +
                                puts "->#{line}" if $DEBUG
         | 
| 58 | 
            +
                                case line
         | 
| 59 | 
            +
                                when /HTTP request sent, awaiting response\.\.\. (.*)/
         | 
| 60 | 
            +
                                    case $1
         | 
| 61 | 
            +
                                    when '200 OK'
         | 
| 62 | 
            +
                                        # Okay. Continue
         | 
| 63 | 
            +
                                    when /^3\d{2}/
         | 
| 64 | 
            +
                                        # Redirection
         | 
| 65 | 
            +
                                        pr.gets # Location line
         | 
| 66 | 
            +
                                        redo
         | 
| 67 | 
            +
                                    else
         | 
| 68 | 
            +
                                        @status = $1
         | 
| 69 | 
            +
                                        return
         | 
| 70 | 
            +
                                    end
         | 
| 71 | 
            +
                                when /Logging in as anonymous \.\.\. (.*)/
         | 
| 72 | 
            +
                                    case $1
         | 
| 73 | 
            +
                                    when 'Logged in!'
         | 
| 74 | 
            +
                                        # Okay. Go ahead.
         | 
| 75 | 
            +
                                    else
         | 
| 76 | 
            +
                                        @status = $1
         | 
| 77 | 
            +
                                        return
         | 
| 78 | 
            +
                                    end
         | 
| 70 79 | 
             
                                end
         | 
| 71 | 
            -
             | 
| 72 80 | 
             
                                break
         | 
| 73 81 | 
             
                            end
         | 
| 74 82 |  | 
| 75 83 | 
             
                            # Content details
         | 
| 76 | 
            -
                             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
                             | 
| 84 | 
            +
                            loop do
         | 
| 85 | 
            +
                                line = pr.gets
         | 
| 86 | 
            +
                                puts "->#{line}" if $DEBUG
         | 
| 87 | 
            +
                                break if line =~ /^Length: /
         | 
| 88 | 
            +
                            end
         | 
| 89 | 
            +
                            #@length = md[1].gsub(',', '').to_i
         | 
| 90 | 
            +
                            #@content_type = md[3]
         | 
| 81 91 |  | 
| 82 92 | 
             
                            # Empty line
         | 
| 83 93 | 
             
                            pr.gets
         | 
| 84 94 |  | 
| 85 95 | 
             
                            # Data incoming
         | 
| 86 96 | 
             
                            pr.each do |line|
         | 
| 87 | 
            -
                                 | 
| 97 | 
            +
                                puts "->#{line}" if $DEBUG
         | 
| 88 98 |  | 
| 89 99 | 
             
                                md = / *([0-9]+)K[ \.]+([0-9]+)% +([0-9\.,]+ KB\/s)/.match line
         | 
| 90 | 
            -
                                #puts (md ? "DEBUG #{md.to_a.inspect}" : "DEBUG nil")
         | 
| 91 100 | 
             
                                if md
         | 
| 92 101 | 
             
                                    @done = md[2]
         | 
| 93 102 | 
             
                                    @rate = md[3]
         | 
    
        data/lib/purple/makefile.rb
    CHANGED
    
    | @@ -15,7 +15,7 @@ module Purple | |
| 15 15 | 
             
                    def makefilename
         | 
| 16 16 | 
             
                        return @makefilename if defined? @makefilename
         | 
| 17 17 | 
             
                        @makefilename = ['GNUmakefile', 'makefile', 'Makefile'].find do |name|
         | 
| 18 | 
            -
                            puts "DEBUG MakefileMaven#makefilename: testing #{File.join(@srcdir, name)}"
         | 
| 18 | 
            +
                            puts "DEBUG MakefileMaven#makefilename: testing #{File.join(@srcdir, name)}" if $DEBUG
         | 
| 19 19 | 
             
                            FileTest.exist? File.join(@srcdir, name)
         | 
| 20 20 | 
             
                        end
         | 
| 21 21 | 
             
                    end
         | 
| @@ -43,7 +43,7 @@ module Purple | |
| 43 43 | 
             
                        while files.size > 0
         | 
| 44 44 | 
             
                            filename = File.join(@srcdir, files.shift)
         | 
| 45 45 | 
             
                            if FileTest.exist? filename
         | 
| 46 | 
            -
                                puts "DEBUG MakefileMaven#makefile_contents: loop->if"
         | 
| 46 | 
            +
                                puts "DEBUG MakefileMaven#makefile_contents: loop->if" if $DEBUG
         | 
| 47 47 | 
             
                                text = File.open(filename) { |f| f.read }
         | 
| 48 48 | 
             
                                @contents << text
         | 
| 49 49 | 
             
                                text.grep(/^include /).each do |s|
         | 
| @@ -52,7 +52,7 @@ module Purple | |
| 52 52 | 
             
                                end
         | 
| 53 53 | 
             
                            end
         | 
| 54 54 | 
             
                        end
         | 
| 55 | 
            -
                        puts "DEBUG MakefileMaven#makefile_contents: #{@contents.to_a.size} lines"
         | 
| 55 | 
            +
                        puts "DEBUG MakefileMaven#makefile_contents: #{@contents.to_a.size} lines" if $DEBUG
         | 
| 56 56 | 
             
                        @contents
         | 
| 57 57 | 
             
                    end
         | 
| 58 58 | 
             
                end
         | 
    
        data/lib/purple/matches.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Purple | |
| 11 11 | 
             
                    def self.match_filename filename
         | 
| 12 12 | 
             
                        md = nil
         | 
| 13 13 | 
             
                        REGEXPS.find { |r| md = r.match filename }
         | 
| 14 | 
            -
                         | 
| 14 | 
            +
                        puts "DEBUG Matches#match_filename: filename=#{filename.inspect} md=#{md.to_a.inspect}" if $DEBUG
         | 
| 15 15 | 
             
                        raise 'filename does not match pattern' if not (md and not md.to_a[0..1].include? nil)
         | 
| 16 16 |  | 
| 17 17 | 
             
                        { :name => md[1], :version => md[2] } 
         | 
    
        data/lib/purple/pkg_actions.rb
    CHANGED
    
    | @@ -46,7 +46,7 @@ module Purple | |
| 46 46 | 
             
                    package_method :make
         | 
| 47 47 |  | 
| 48 48 | 
             
                    def default_prepare
         | 
| 49 | 
            -
                        puts "DEBUG PackageActions#default_prepare"
         | 
| 49 | 
            +
                        puts "DEBUG PackageActions#default_prepare" if $DEBUG
         | 
| 50 50 | 
             
                        files.each do |f|
         | 
| 51 51 | 
             
                            unpack = case f
         | 
| 52 52 | 
             
                                when /gz$/; '-z'
         | 
| @@ -73,7 +73,7 @@ module Purple | |
| 73 73 |  | 
| 74 74 | 
             
                        require 'purple/makefile'
         | 
| 75 75 |  | 
| 76 | 
            -
                        puts "DEBUG PackageActions#default_stage: srcdir=#{srcdir}"
         | 
| 76 | 
            +
                        puts "DEBUG PackageActions#default_stage: srcdir=#{srcdir}" if $DEBUG
         | 
| 77 77 | 
             
                        mkm = MakefileMaven.new srcdir
         | 
| 78 78 | 
             
                        if mkm.uses_prefix?
         | 
| 79 79 | 
             
                            if mkm.uses_destdir?
         | 
    
        data/lib/purple/process.rb
    CHANGED
    
    | @@ -19,9 +19,9 @@ module Purple | |
| 19 19 | 
             
                            end
         | 
| 20 20 | 
             
                            Thread.new do
         | 
| 21 21 | 
             
                                begin
         | 
| 22 | 
            -
                                    #puts "DEBUG Purple::Process::Child#start: HERE"
         | 
| 22 | 
            +
                                    #puts "DEBUG Purple::Process::Child#start: HERE" if $DEBUG
         | 
| 23 23 | 
             
                                    @exit_code = Process.waitpid2(pid)[1].exitstatus
         | 
| 24 | 
            -
                                    #puts "DEBUG Purple::Process::Child#start: status=#{@exit_code}"
         | 
| 24 | 
            +
                                    #puts "DEBUG Purple::Process::Child#start: status=#{@exit_code}" if $DEBUG
         | 
| 25 25 | 
             
                                ensure
         | 
| 26 26 | 
             
                                    @status = :done
         | 
| 27 27 | 
             
                                end
         | 
    
        data/lib/purple/script.rb
    CHANGED
    
    | @@ -45,7 +45,7 @@ module Purple | |
| 45 45 | 
             
                    def self.parse string
         | 
| 46 46 | 
             
                        script = self.new
         | 
| 47 47 | 
             
                        script.instance_eval string
         | 
| 48 | 
            -
                        puts "DEBUG Purple::Script##parse: cabinet=#{script.cabinet}"
         | 
| 48 | 
            +
                        puts "DEBUG Purple::Script##parse: cabinet=#{script.cabinet}" if $DEBUG
         | 
| 49 49 | 
             
                        script.cabinet
         | 
| 50 50 | 
             
                    end
         | 
| 51 51 |  | 
| @@ -86,10 +86,9 @@ module Purple | |
| 86 86 |  | 
| 87 87 | 
             
                    def infer_all
         | 
| 88 88 | 
             
                        @package_scripts.each { |pkg|
         | 
| 89 | 
            -
                            puts "DEBUG PurpleScript#infer_all"
         | 
| 89 | 
            +
                            puts "DEBUG PurpleScript#infer_all" if $DEBUG
         | 
| 90 90 | 
             
                            pkg.infer
         | 
| 91 91 | 
             
                        }
         | 
| 92 | 
            -
                        puts "DEBUG PurpleScript#infer_all: b4end"
         | 
| 93 92 | 
             
                        infer
         | 
| 94 93 | 
             
                    end
         | 
| 95 94 |  | 
| @@ -116,7 +115,7 @@ module Purple | |
| 116 115 | 
             
                        def initialize cabinet
         | 
| 117 116 | 
             
                            @package = cabinet.create_package
         | 
| 118 117 | 
             
                            @cabinet = cabinet
         | 
| 119 | 
            -
                            puts "DEBUG PackageScript#initialize: @package=#{@package}"
         | 
| 118 | 
            +
                            puts "DEBUG PackageScript#initialize: @package=#{@package}" if $DEBUG
         | 
| 120 119 | 
             
                        end
         | 
| 121 120 |  | 
| 122 121 | 
             
                        callthrough :long_name, :name, :identifier, :version, :major, :minor
         | 
| @@ -131,12 +130,12 @@ module Purple | |
| 131 130 | 
             
                        end
         | 
| 132 131 |  | 
| 133 132 | 
             
                        def infer
         | 
| 134 | 
            -
                            puts "DEBUG #infer"
         | 
| 135 | 
            -
                            puts "DEBUG PackageScript#infer: pkg=#{pkg}"
         | 
| 133 | 
            +
                            puts "DEBUG #infer" if $DEBUG
         | 
| 134 | 
            +
                            puts "DEBUG PackageScript#infer: pkg=#{pkg}" if $DEBUG
         | 
| 136 135 | 
             
                            # Take a guess at the filename
         | 
| 137 136 | 
             
                            if 0 == pkg.files.size
         | 
| 138 137 | 
             
                                files = @cabinet.files
         | 
| 139 | 
            -
                                puts "DEBUG #infer: cabinet_files=#{files.inspect}"
         | 
| 138 | 
            +
                                puts "DEBUG #infer: cabinet_files=#{files.inspect}" if $DEBUG
         | 
| 140 139 | 
             
                                if 0 == files.size
         | 
| 141 140 | 
             
                                    warn 'Cabinet files section is empty. Did you not specify any urls?'
         | 
| 142 141 | 
             
                                else
         | 
| @@ -151,11 +150,11 @@ module Purple | |
| 151 150 | 
             
                                end
         | 
| 152 151 | 
             
                            end
         | 
| 153 152 |  | 
| 154 | 
            -
                             | 
| 155 | 
            -
                             | 
| 153 | 
            +
                            puts "DEBUG #infer: pkg.files=#{pkg.files.inspect}" if $DEBUG
         | 
| 154 | 
            +
                            puts "DEBUG #infer: long_name=#{pkg.long_name}" if $DEBUG
         | 
| 156 155 | 
             
                            # Take a guess at properties long_name, name, version, major, and minor
         | 
| 157 156 | 
             
                            md = Matches.match_filename pkg.files[0]
         | 
| 158 | 
            -
                            puts "DEBUG #infer: filename match result  #{md.inspect}"
         | 
| 157 | 
            +
                            puts "DEBUG #infer: filename match result  #{md.inspect}" if $DEBUG
         | 
| 159 158 |  | 
| 160 159 | 
             
                            pkg.long_name = "#{md[:name]}-#{md[:version]}" if not pkg.long_name
         | 
| 161 160 | 
             
                            pkg.name = md[:name] if not pkg.name
         | 
    
        metadata
    CHANGED
    
    | @@ -3,8 +3,8 @@ rubygems_version: 0.8.1 | |
| 3 3 | 
             
            specification_version: 1
         | 
| 4 4 | 
             
            name: purplepkg
         | 
| 5 5 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 6 | 
            -
              version: 0.0. | 
| 7 | 
            -
            date: 2004-11- | 
| 6 | 
            +
              version: 0.0.5
         | 
| 7 | 
            +
            date: 2004-11-23
         | 
| 8 8 | 
             
            summary: A simple pre-packing tool with meta-package plugin support.
         | 
| 9 9 | 
             
            require_paths: 
         | 
| 10 10 | 
             
              - lib
         |