Sha256: dc63f0bbd9fc1860af4a9bd13aeb0c74c39ebd881be2e80fd4ed6872c6094cb3

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

def build_rpm(buildarg = "-bs")
  check_tool('rpmbuild')
  temp = get_temp
  if dist = el_version
    if dist.to_i < 6
      dist_string = "--define \"%dist .el#{dist}"
    end
  end
  rpm_define = "#{dist_string} --define \"%_topdir  #{temp}\" "
  rpm_old_version = '--define "_source_filedigest_algorithm 1" --define "_binary_filedigest_algorithm 1" \
     --define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
     --define "_default_patch_fuzz 2"'
  args = rpm_define + ' ' + rpm_old_version
  mkdir_pr temp, 'pkg/srpm', "#{temp}/SOURCES", "#{temp}/SPECS"
  if buildarg == '-ba'
    mkdir_p 'pkg/rpm'
  end
  if @build.sign_tar
    Rake::Task["pl:sign_tar"].invoke
    cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz.asc", "#{temp}/SOURCES"
  end
  cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz", "#{temp}/SOURCES"
  erb "ext/redhat/#{@build.project}.spec.erb", "#{temp}/SPECS/#{@build.project}.spec"
  sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@build.project}.spec"
  mv FileList["#{temp}/SRPMS/*.rpm"], "pkg/srpm"
  if buildarg == '-ba'
    mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
  end
  rm_rf temp
  puts
  output = FileList['pkg/*/*.rpm']
  puts "Wrote:"
  output.each do | line |
    puts line
  end
end

namespace :package do
  desc "Create srpm from this git repository (unsigned)"
  task :srpm => :tar do
    build_rpm("-bs")
  end

  desc "Create .rpm from this git repository (unsigned)"
  task :rpm => :tar do
    build_rpm("-ba")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-2.7.22 ext/packaging/tasks/rpm.rake
puppet-2.7.21 ext/packaging/tasks/rpm.rake