Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created November 23, 2011 18:51
Show Gist options
  • Save commuterjoy/1389530 to your computer and use it in GitHub Desktop.
Save commuterjoy/1389530 to your computer and use it in GitHub Desktop.
Rake task to list the latest test RPMs that can be deployed to stage
desc "list the latest test RPMs that can be deployed to stage"
task :releasable do
packages = ['bbc-pal-tabloid', 'bbc-pal-library-berliner', 'bbc-pal-library-news-core', 'bbc-pal-newspopular', 'bbc-pal-jibbajabba']
repo = 'bbc-test'
info = `yum info #{packages.join(' ')} --verbose --enablerepo=#{repo} | egrep '(Name)|(^Version)|(Arch)|(Release)|(Buildtime)|(^$)'`
rpm = {}
info.split(/\n/).each do |line|
tokens = line.split(/:/)
rpm[tokens[0].strip!.downcase!] = tokens[1].strip! if tokens.length > 0
if line =~ /Release/ then
puts "%s-%s-%s.%s.rpm" % [rpm['name'], rpm['version'], rpm['release'], rpm['arch']]
rpm = {}
end
end
puts "\n-----------\n#{info}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment