Created
October 3, 2011 15:03
-
-
Save jbrown/1259304 to your computer and use it in GitHub Desktop.
Detailed package info for CentOS 5.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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