<commit_before># Copyright 2008 by <NAME>. All rights reserved.
require 'capistrano'
require 'fileutils'

module Yum

  def enable_repository(name)
    case name
    when :rpmforge
      rpm_install("http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.`uname -i`.rpm")
    when :epel
      sudo "sudo test -f /etc/yum.repos.d/epel.repo || sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm"
    end
  end
  
  def rpm_install(packages, options={})
    send(run_method, "wget -Ncq #{[*packages].join(' ')}", options)
    files=[*packages].collect { |package| File.basename(package) }
    # TODO hmm... This should me replaces with something more smart, like check if package is already installed
    send(run_method, "rpm -i --force #{files.join(' ')}", options)
    send(run_method, "rm #{files.join(' ')}", options)
  end

  def install_from_src(src_package, src_dir)
    package_dir = File.join(src_dir, src_package[:dir])
    deprec2.unpack_src(src_package, src_dir)
    enable_repository :rpmforge
    enable_repository :epel
    rpm_install("http://www.asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm") 
    apt.install( {:base => %w(gcc gcc-c++ make patch rpm-build which)}, :stable )
    # XXX replace with invoke_command
    sudo <<-SUDO
    sh -c '
    cd #{package_dir};
    #{src_package[:configure]}
    #{src_package[:make]}
    /usr/local/sbin/checkinstall -y -R --install #{src_package[:install]}
    #{src_package[:post_install]}
    '
    SUDO
    #/usr/local/sbin/checkinstall --fstrans=no -y -R #{src_package[:install]}
  end

end

Capistrano.plugin :yum, Yum<commit_msg>added pkgversion and pkgrelease to checkinstall call. Each packages should have version with 'c' at the beginning(which stands for centostrano), this will prevent from overwritting packages when updating system with yum.<commit_after># Copyright 2008 by <NAME>. All rights reserved.
require 'capistrano'
require 'fileutils'

module Yum

  def enable_repository(name)
    case name
    when :rpmforge
      rpm_install("http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.`uname -i`.rpm")
    when :epel
      sudo "sudo test -f /etc/yum.repos.d/epel.repo || sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm"
    end
  end
  
  def rpm_install(packages, options={})
    send(run_method, "wget -Ncq #{[*packages].join(' ')}", options)
    files=[*packages].collect { |package| File.basename(package) }
    # TODO hmm... This should me replaces with something more smart, like check if package is already installed
    send(run_method, "rpm -i --force #{files.join(' ')}", options)
    send(run_method, "rm #{files.join(' ')}", options)
  end

  def install_from_src(src_package, src_dir)
    package_dir = File.join(src_dir, src_package[:dir])
    deprec2.unpack_src(src_package, src_dir)
    enable_repository :rpmforge
    enable_repository :epel
    rpm_install("http://www.asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm") 
    apt.install( {:base => %w(gcc gcc-c++ make patch rpm-build which)}, :stable )
    # XXX replace with invoke_command
    sudo <<-SUDO
    sh -c '
    cd #{package_dir};
    #{src_package[:configure]}
    #{src_package[:make]}
    sudo /usr/local/sbin/checkinstall -y -R --install --pkgversion=#{src_package[:version]}  --pkgrelease=#{src_package[:release]} #{src_package[:install]}
    #{src_package[:post_install]}
    '
    SUDO
    #/usr/local/sbin/checkinstall --fstrans=no -y -R #{src_package[:install]}
  end

end

Capistrano.plugin :yum, Yum
{'fraction_non_alphanumeric': 0.1489245848080588, 'fraction_numerical': 0.012523822488429077, 'mean_word_length': 3.6922094508301404, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4763816', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1264, 'n_words': 282}