LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   Yum: What "Package Group" can provide a package? (http://www.linuxquestions.org/questions/red-hat-31/yum-what-package-group-can-provide-a-package-760652/)

stefanlasiewski 10-08-2009 05:55 PM

Yum: What "Package Group" can provide a package?
 
Yum supports the idea of "Package groups". Here's a listing of available groups on my RHEL5.4 system, after a vanilla installation:

Code:

[root@host1 ~]# yum grouplist
Loaded plugins: rhnplugin, security
Setting up Group Process
Installed Groups:
  Editors
  Legacy Network Server
  Mail Server
  Network Servers
  System Tools
Available Groups:
  Administration Tools
  Authoring and Publishing
  DNS Name Server
  ...
  ...

Is there a way to tell which Package Groups will provide a particular individual package?

For example, "emacs" is provided by the "Editor" package group, the "Development Environment" package group, and possibly others. I'm looking for a theoretical command like "yum groupinfo-whatprovides emacs"?

Here's what I am doing right now, to query all of the package groups for the 'httpd' package. This is a little clunky, and I was looking for a simpler method.

Code:

[root@host1 ~]# yum grouplist >/tmp/yum.grouplist
[root@host1 ~]# cat /tmp/yum.grouplist |while read GROUP; do echo GROUP=$GROUP; yum groupinfo "$GROUP" |grep -i httpd; done
GROUP=Editors
GROUP=Legacy Network Server
...
...
GROUP=Server Configuration Tools
  system-config-httpd
GROUP=Sound and Video
GROUP=Text-based Internet
GROUP=Web Server
  httpd
  httpd-manual
  httpd-suexec
GROUP=Windows File Server
GROUP=X Software Development
GROUP=X Window System

Thank you,

-= Stefan

chrism01 10-08-2009 08:20 PM

Well, I think you can eliminate the unwanted groups
Code:

yum grouplist >/tmp/yum.grouplist
for GROUP in `cat /tmp/yum.grouplist`
do
    name=`yum groupinfo "$GROUP" |grep -i httpd`
    if [[ $? -eq  0 ]] # $? is status of last cmd in pipe ie matched
    then
        echo $GROUP = $name 
    fi
done

It's theoretically possible for the same pkg to turn up in many groups; don't know how often it happens.
Don't know if this page may inspire a different approach http://kbase.redhat.com/faq/docs/DOC-2531 ?

stefanlasiewski 10-09-2009 04:43 PM

Thanks Chris.

It looks like RHEL does not support this feature. It's probably not a big deal, since it looks like RedHat has cleaned up the Package Groups in RHEL5. With RHEL4, there is more duplication.

Thanks again,

-= Stefan

amacks 11-14-2010 06:49 PM

Updated for rhel6
 
rhel 6 has some weird group names, there are spaces in the generic names. I added some sed magic to handle that, or at least most of it. This script will workfor all but:
English (UK) Support
Myanmar (Burmese) Support
Some smarter awkery would solve that, but I don't care enough. Save the following as a script and run it as root with one arg, the package you want to search for:
Code:

#!/bin/bash
yum grouplist -v | grep "^ " | cut -f 2 -d \( | sed -e "s/)//" > /tmp/yum.grouplist

for GROUP in `cat /tmp/yum.grouplist`
do
    name=`yum groupinfo "$GROUP" |grep -i $1`
    if [[ $? -eq  0 ]] # $? is status of last cmd in pipe ie matched
    then
        echo $GROUP = $name 
    fi
done
rm /tmp/yum.grouplist

A

kjerick 03-07-2012 12:49 PM

amacks, I found your post very helpful. I modified your script somewhat because there were a couple things that didn't work quite right yet. One I saw problem with RHEL 5.5 and another with RHEL 6.1.

For RHEL 5.5, the 'yum grouplist -v' portion of the command produces the following for one of the groups:

KDE (K Desktop Environment) (kde-desktop)

So the rest of the processing turns this into "K Desktop Environment" instead of "kde-desktop". I used a little awk to fix that one.

For RHEL 6.1 I didn't like that all the languages are listed and time is spent looking through them. 99.9%+ of the time I will not be looking for something in a language group, so I eliminated them with a little more grep to eliminate them, which all seemed to have [text] associated with them.

The net change to your code looks like this:

Code:

#!/bin/bash

yum grouplist -v | grep "^ " | grep -v "]$" | awk '{print $NF}' | sed -e "s/(//" | sed -e "s/)//" > /tmp/yum.grouplist

for GROUP in `cat /tmp/yum.grouplist`
do
    name=`yum groupinfo "$GROUP"  2>&1 | grep -i $1`
    if [[ $? -eq  0 ]] # $? is status of last cmd in pipe ie matched
    then
        echo $GROUP : $name
    fi
done
rm /tmp/yum.grouplist

Hope someone else finds this useful,
Kevin

Ernst0 03-11-2012 07:38 PM

Hey,

I'm befuddled here.. I paid for RHEL6 so I am hoping to get things like Ghex and Gcalctools 2.6 going and I see that yum bails (fails) with broken dependancies.

Is this Group thing a way to install all the needed packages for say Gnome?

Or other stuff?

I am looking at manually installing like 40 packages just to get a couple of dependancies resolved for Ghex and Gcalctool 2.6

Who know how many other dependancies will pop up.

Yes I am a previous Fedora user and pampered with Yum fetching and installing everything without me bothering.

I found the "Groupinstall" function for YUM and install "Compatability Libraries" didn't solve the configure: error: glib-compile-schemas not found.

I'm still looking..

This is frustrating.

Larry Baker 06-12-2012 05:34 PM

On CentOS 6.2 (RHEL 6.2) it's simple:

# yum groupinfo \*

qux 03-21-2013 01:31 PM

For search engines: now the yum-list-data plugin can be used for the subject issue:

Code:

$ yum -C list-groups yum
...
==================== Installed Packages ====================
Core                      1 ( 50%)
Critical Path (Base)      1 ( 50%)



All times are GMT -5. The time now is 05:03 PM.