How to remove orphan packages in OpenSUSE

Hi everyone,
I’d like to know if there is a way to remove all unneeded dependencies on OpenSUSE (11.4 in my case, but a general solution would be nice).

I have read (here) that some option can be used when removing a package so that all its dependencies (i hope just the one not needed by others) are removed.
Do you suggest not to modify that line in zypper.conf? Can it be unsafe?
And also, is there a way to do it on demand? Like on Debian/Ubuntu you can do with apt-get autoremove.

I have tried rpmorphan, but it removed too many packages, also some that were manually installed by me, and screwed my system; epic fail.

Suggestions?

Thanks in advance!

On 2011-11-09 10:56, frasmog wrote:

> I have read (‘here’ (http://tinyurl.com/bnz4b2r)) that some option can
> be used when removing a package so that all its dependencies (i hope
> just the one not needed by others) are removed.
> Do you suggest not to modify that line in zypper.conf? Can it be
> unsafe?

Little tested, I believe.

> And also, is there a way to do it -on demand-? Like on Debian/Ubuntu
> you can do with -apt-get autoremove-.

Not that I know.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I’ve written a small Perl script that prints you a list of packages that
COULD be removed:


#!/usr/bin/perl

use strict;

my @out;

open(RPM, “rpm -qa |”);
my @rpm = <RPM>;
close RPM;

foreach my $rpm (@rpm)
{
chomp($rpm);
open(RPM, “rpm -e --test $rpm 2>&1 |”);
my @ret = <RPM>;
close RPM;

push(@out, "$rpm
") if ($#ret <= 0);
}

@out = sort @out;
print @out;

It shows you all packages that are not installed because of any
dependencies.

You don’t want to remove all of them, but any orphan packages should be in
this list.

Fruchtratte wrote:
> I’ve written a small Perl script that prints you a list of packages that
> COULD be removed:

That’s a nice little program :slight_smile:

For the benefit of anybody picking up style tips it would be good to add

use warnings;

after use strict;

Cheers, Dave