Re: [CentOS] determining what depends on a rpm

2018-12-17 Thread Phil Perry

On 17/12/2018 17:24, Simon Matter wrote:

On 12/17/18 3:50 AM, Leon Fauster via CentOS wrote:


or this one :-)
rpm -ev --test PACKAGENAME
will list all packages that require PACKAGENAME



True.  I considered that, and then decided that I could never recommend
using "rpm -e" as a test, even with the --test flag, due to the risk of
operator error.  Though if you put it in an alias, I suppose that the
risk is minimal and the answer is simpler.  :)


It's not really dangerous even without --test, because if it has
dependencies the remove is not done, you just get an error.



And further, the OP originally asked for a solution which could be run 
as a non-root user (otherwise yum erase PACKAGE would give the same 
answer), and when run as non-root, the transaction will fail and nothing 
can be removed anyway. So overall I think it's a pretty good solution to 
the OPs question.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-17 Thread Simon Matter
> On 12/17/18 3:50 AM, Leon Fauster via CentOS wrote:
>>
>> or this one :-)
>> rpm -ev --test PACKAGENAME
>> will list all packages that require PACKAGENAME
>
>
> True.  I considered that, and then decided that I could never recommend
> using "rpm -e" as a test, even with the --test flag, due to the risk of
> operator error.  Though if you put it in an alias, I suppose that the
> risk is minimal and the answer is simpler.  :)

It's not really dangerous even without --test, because if it has
dependencies the remove is not done, you just get an error.

Regards,
Simon

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-17 Thread Gordon Messmer

On 12/17/18 3:50 AM, Leon Fauster via CentOS wrote:


or this one :-)
rpm -ev --test PACKAGENAME
will list all packages that require PACKAGENAME



True.  I considered that, and then decided that I could never recommend 
using "rpm -e" as a test, even with the --test flag, due to the risk of 
operator error.  Though if you put it in an alias, I suppose that the 
risk is minimal and the answer is simpler.  :)


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-17 Thread Leon Fauster via CentOS


> Am 16.12.2018 um 00:07 schrieb Gordon Messmer :
> 
> On 12/15/18 1:05 PM, Frank Cox wrote:
>> Ultimately it would be very useful to have some kind of a tool that would 
>> generate a report from the rpms installed on a system and tell you exactly 
>> what depends on what else.  Among other things you could use that report to 
>> remove stuff that's not needed in any installation.
> 
> 
> While not a simple answer, this bash function will provide what you're 
> looking for:
> 
> whatrequires () { (rpm -q --qf '%{NAME}\n' "$1" ; rpm -q --provides "$1" ) | 
> tr \\n \\0 | xargs -0 rpm -q --whatrequires ; }
> 

or this one :-)

rpm -ev --test PACKAGENAME

will list all packages that require PACKAGENAME 

--
LF

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-15 Thread Jon LaBadie
On Sat, Dec 15, 2018 at 03:05:45PM -0600, Frank Cox wrote:
> yum remove lightdm
> 
> That command tells me that it's also going to remove lightdm-gobject and 
> lightdm-gtk.
> 
> rpm -q --whatrequires lightdm
> no package requires lightdm
> 
Perhaps you want the "--requires" instead of "--whatrequires" option.
"rpm -q --requires lightdm" gives me 41 lines of output.

You might also try "yum deplist lightdm".

Jon
-- 
Jon H. LaBadie j...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-15 Thread Gordon Messmer

On 12/15/18 1:05 PM, Frank Cox wrote:

Ultimately it would be very useful to have some kind of a tool that would 
generate a report from the rpms installed on a system and tell you exactly what 
depends on what else.  Among other things you could use that report to remove 
stuff that's not needed in any installation.



While not a simple answer, this bash function will provide what you're 
looking for:


whatrequires () { (rpm -q --qf '%{NAME}\n' "$1" ; rpm -q --provides "$1" 
) | tr \\n \\0 | xargs -0 rpm -q --whatrequires ; }



___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] determining what depends on a rpm

2018-12-15 Thread Phil Perry

On 15/12/2018 21:05, Frank Cox wrote:

yum remove lightdm

That command tells me that it's also going to remove lightdm-gobject and 
lightdm-gtk.

rpm -q --whatrequires lightdm
no package requires lightdm

So obviously we can't take the word of the --whatrequires option from the rpm 
command since yum remove tells me that there are two.

That being the case, using yum remove to determine the actual dependency chain 
is not all that helpful since (a) only the root user can do that, which seems 
unnecessary when all you want to get is a report about the installed packages 
that the rpm command can already read as a user, and (b) you're taking a chance 
of fat-fingering something and destroying your system by accident.

Ultimately it would be very useful to have some kind of a tool that would 
generate a report from the rpms installed on a system and tell you exactly what 
depends on what else.  Among other things you could use that report to remove 
stuff that's not needed in any installation.



Take a look at what the package provides:

rpm -q --provides lightdm
config(lightdm) = 1.25.0-1.el7
lightdm = 1.25.0-1.el7
lightdm(x86-64) = 1.25.0-1.el7
service(graphical-login) = lightdm

and then look at what requires those 'provides':

rpm -q --whatrequires 'lightdm(x86-64)'
lightdm-qt-1.25.0-1.el7.x86_64
lightdm-gobject-1.25.0-1.el7.x86_64

It should be simple enough to script that, and that should get you started.

Hope that helps.

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


[CentOS] determining what depends on a rpm

2018-12-15 Thread Frank Cox
yum remove lightdm

That command tells me that it's also going to remove lightdm-gobject and 
lightdm-gtk.

rpm -q --whatrequires lightdm
no package requires lightdm

So obviously we can't take the word of the --whatrequires option from the rpm 
command since yum remove tells me that there are two.

That being the case, using yum remove to determine the actual dependency chain 
is not all that helpful since (a) only the root user can do that, which seems 
unnecessary when all you want to get is a report about the installed packages 
that the rpm command can already read as a user, and (b) you're taking a chance 
of fat-fingering something and destroying your system by accident.

Ultimately it would be very useful to have some kind of a tool that would 
generate a report from the rpms installed on a system and tell you exactly what 
depends on what else.  Among other things you could use that report to remove 
stuff that's not needed in any installation.

-- 
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos