Skip to content

Instantly share code, notes, and snippets.

@perl2ruby
Created March 30, 2012 16:27
Show Gist options
  • Save perl2ruby/2252622 to your computer and use it in GitHub Desktop.
Save perl2ruby/2252622 to your computer and use it in GitHub Desktop.
List all rpm packages in all groups
ruby -lne ' puts %Q{==== group: "#{$_}" ====}; system %Q{rpm -qg "#{$_}"}' /usr/share/doc/rpm*/GROUPS
@perl2ruby
Copy link
Author

Official list of RPM groups are defined in /usr/share/doc/rpm*/GROUPS.

For example, /usr/share/doc/rpm-4.4.2.3 on centos contains:
Amusements/Games
Amusements/Graphics
Applications/Archiving
Applications/Communications
Applications/Databases
Applications/Editors
Applications/Emulators
Applications/Engineering
Applications/File
Applications/Internet
Applications/Multimedia
Applications/Productivity
Applications/Publishing
Applications/System
Applications/Text
Development/Debuggers
Development/Languages
Development/Libraries
Development/System
Development/Tools
Documentation
System Environment/Base
System Environment/Daemons
System Environment/Kernel
System Environment/Libraries
System Environment/Shells
User Interface/Desktops
User Interface/X
User Interface/X Hardware Support

The way to identify the list of packages in group 'System Environment/Shells' is:
rpm -qg 'System Environment/Shells'

which returns (depending on your machine) the following packages:
bash-3.2-24.el5
tcsh-6.14-17.el5_5.2

The ruby oneliner above shows the list of packages for each group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment