Skip to content

Instantly share code, notes, and snippets.

@jbrown
Created October 3, 2011 15:03
Show Gist options
  • Save jbrown/1259304 to your computer and use it in GitHub Desktop.
Save jbrown/1259304 to your computer and use it in GitHub Desktop.
Detailed package info for CentOS 5.6
require 'rubygems'
require 'nokogiri'
require 'open-uri'
@xml = Nokogiri open 'http://vault.centos.org/5.6/os/x86_64/repodata/comps.xml'
def printGroups(default = true)
puts "=== #{'Non' unless default}Default Groups ==="
@xml.xpath("//default[text()='#{default}']/..").each_with_index do |group, ix|
puts "#{ix + 1}.) #{group.at_xpath('name').text}"
printPackages group, 'mandatory'
printPackages group, 'default'
printPackages group, 'optional'
end
end
def printPackages(group, type)
puts " * #{type} packages *"
group.xpath(".//packagereq[@type='#{type}']").to_a.sort_by!(&:text).each do |req|
puts " - #{req.text}"
end
end
printGroups
# printGroups(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment