Sha256: 212010adc16f8e9782749dbee4b11bb0f75b1ca787cca4f6650de2a2f7180cb9

Contents?: true

Size: 1.08 KB

Versions: 23

Compression:

Stored size: 1.08 KB

Contents

module PKGWizard 
  class Mock

    #
    # mandatory args 
    #   :profile
    #   :resultdir
    #   :srpm
    #
    def self.srpm(args =  {})
      mock_profile = args[:profile]
      result_dir = args[:resultdir]
      srpm = args[:srpm]
      mock_args = args[:mock_args] || ""

      raise ArgumentError.new('Invalid mock profile') if mock_profile.nil?

      if not File.exist?(srpm) or (srpm !~ /src\.rpm$/)
        raise ArgumentError.new('Invalid SRPM')
      end

      raise ArgumentError.new('Invalid result dir') if result_dir.nil?


      if mock_profile.nil?
        raise Exception.new "Missing mock profile."
      end
      
      if result_dir.nil?
        raise Exception.new "Missing result_dir."
      end

      if not File.directory?(result_dir)
        raise Exception.new "Invalid result_dir #{result_dir}"
      end

      cmd = "/usr/bin/mock #{mock_args} -r #{mock_profile} --disable-plugin ccache --resultdir #{result_dir} #{srpm}"
      output = `#{cmd} 2>&1`
      if $? != 0
        raise Exception.new(output)
      end
      output
    end
  end # class
end # mod

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pkg-wizard-0.1.29 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.28 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.27 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.26 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.25 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.24 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.23 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.22 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.21 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.19 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.18 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.17 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.16 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.15 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.14 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.12 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.10 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.8 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.7 lib/pkg-wizard/mock.rb
pkg-wizard-0.1.6 lib/pkg-wizard/mock.rb