On Mon, 2003-02-17 at 18:16, Fabian wrote:
On Tue, 2003-02-18 at 00:43, Leif Mathis Gaup wrote:
We could/should ask for SuSE to apply something similar to this for YaST:
rpm -qa | while read pkg do rpm -ql $pkg | perl -ne 'chomp; next unless -f $_; $e=1; if (-A _ < 6*30) { $e=0; last } END {exit (!$e)}' && echo $pkg
<snip>
Instead I'm looking for packages that no other packages depend on. That means they can be uninstalled without breaking dependencies. Since rpm checks dependencies when packages are installed and uninstalled the needed information should already be in the rpm-database. A script should be able to perform this. Unfortunately I have no clue about that.
wow, I didn't realize that YaST has been leaving orphaned files behind until this thread...I have MANY things that have been left behind from when I just "try" certain packages out. OK, a script can do this, here is what I was thinking: You could do "rpm -qR $pkgName >> listA" which lists all the files $pkgName is dependant on. Then do "rpm -qaR >> listB" to list all the dependencies for all files (if you just want to list .rpm's for listB and not all .so files and whatnot, try to run something like: "more listB | egrep -v 'so|bin|rpmlib'" agains listB). If more then one .rpm depends on a file, the depended upon file is listed more then once. So, if anything in listA appears once, and only once, in listB then you *should* be able to remove that package as well. So, this could work in a script. so for example if I want to remove oaf-devel I would do: $> rpm -qR oaf-devel RESULTS: orbit-devel; popt; /bin/sh/; rpmlib(PayloadIsBzip2) <= 3.0.5-1 (ignore /bin/sh and rpmlib...) So, oaf-devel needs orbit-devel and popt to run. So, if I uninstall oaf-devel then orbit-devel and popt are now orphaned .rpm's. Let's see if we can remove them too... $> rpm -qRa >> listB $> more listB | egrep oaf-devel RESULTS: <blank> This means that nothing else depends on oaf-devel. (YaST would handle this part anyway) $> more listB | egrep orbit-devel RESULTS: orbit-devel; orbit-devel; orbit-devel So, orbit-devel is needed by 3 programs (oaf-devel and 2 others) $> more listB | egrep popt | grep -v so RESULTS: popt; popt; popt = 1.6; popt So, three other programs require popt. I used the "grep -v so" due to alot of "libpopt.so.0" files in the list. For arguments sake, if popt only appeared once, then you could remove oaf-devel and popt, but not orbit-devel. You could also make some kind of recursive function, or loop that would keep checking all the dependencies for each. Then list and/or prompt you to remove them also. If I have time later, I'll work on this some more. I would like to remove all that stuff also, in the future. -Jeric -- JericAtSbcglobalDotNetwork 6:51pm up 1 day, 49 min, 6 users, load average: 0.23, 0.15, 0.12 "The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated..." -U.S. Constitution, Amendment IV, 1791 (Say "NO" to TIA!)