You are not logged in.
is there a way to remove unused packages? i see pacman can remove a package and all the ones depending on it (-Rc), but i did'n find a way to remove all the ones needed only by it. is there a way to list all the dependencies (maybe in an ordered tree-like format)? if not i think these would be useful features to include in pacman.
Offline
EmaRsk wrote:is there a way to remove unused packages?
How is pacman supposed to know if a package is unused? beyond pacman -Rd/c i know of no feature like this and is sounds like it would require a fair bit of dynamic interaction by pacman.
for example, let's suppose i want to remove pac1. pacman could check, for each package pac1 depends on, if pac1 is the ONLY package that depends on 'em (something like a simulated "pacman -Rc" that doesn't actually remove anything), and if there is no other package that would go broke, proceed with removing.
i see pacman can remove a package and all the ones depending on it (-Rc), but i did'n find a way to remove all the ones needed only by it.
not sure what you are asking here but if you mean removing something like xfree86 without taking dependencies with it pacman -Rd will do that.
i mean removing those packages that were needed only by pac1 as dependencies. maybe an ask for confirmation would be needed to avoid accidentally removing packages useful by themselves.
is there a way to list all the dependencies (maybe in an ordered tree-like format)?
pacman -Qi packagename i believe lists the depends. if it doesn't there are lots of places to find the depends.
yes but if i want to know if i still need a package i would have to check the dependencies of all installed packages. doing it by hand is a pain... is there a more automated way?
thanks for reply. i hope my english is good enough to not generate misunderstandings (it'not my mother language).
Offline
There is no automatic way to do that, though it's an ok idea.
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
If your know what you need and what's cruft, you could use this script I wrote for my own nefarious purposes a while back:
#!/bin/bash
echo "Running a check for packages without depends."
echo "Started on:"
date
echo ""
for pac_name in `pacman -Qi | sed 's/ .*//'`;
do
Y=`pacman -Qi "$pac_name" | grep Required | grep None`
if [ ! -z "$Y" ]; then
echo Package: $pac_name
pacman -Qi $pac_name | grep Descript
echo
fi
done
It'll lists everything without a dependancy. Which means even programs your still using.
.... And it's probably horrendously coded. But it works for me.
Offline
Thanx RdsArts, it seems to work fine. one day i'd better learn to use sed ;-), i feel it's a powerful tool for scripts.
a reply to sarah: afaik pacman -Qi won't tell me ALL the packages needed for a package to run, but only direct dependencies. for example, xmms depends on gtk, which is listed, but gtk itself depends on other many packages that are not listed by "pacman -Qi xmms"...
thanks for replying
bye
Offline
that's the point: i never said i'm "asking for direct" nor that i "want to get into only second generation". my question was another one: if there's a way, when i remove a pkg, to remove those dependencies (recursively, not only direct or second generation) no more needed.
Offline
Sarah, he's talking about doing it backwards. pacman -R will remove a package and everything that depends on it. But what about removing a package and everything that it depends on that nothing else depends on.
Bad example, but let's say you want mozilla, but don't have xfree86 installed. xfree86 is obviously a depend of mozilla, so installing mozilla means you install xfree86. What if you remove mozilla? Removing mozilla leaves xfree86 because xfree86 doesn't depend on mozilla. At the same time (in this contrived example) nothing else on the system depend on xfree86, so why have it around if you weren't using it for anything other than mozilla?
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
It's like deborphan in debian, I think. It's listing orphaned package what the user can remove if he doasn't use it anymore.
Offline
You can list orpahaned packages with pacman -Qi --orphan. That will list all packages that are not needed by any other package, you can then remove the stuff you know you don't use with a simple pacman -R package.
This is not exactly what you are looking for but to make these removals auotmatic pacman would have to know the difference between a library you don't use and an app you do use.... That could be done by adding a flag ("toplevel ( 'x') " where x is yes or no) in the packagebuilds to distinguish a library from an end user application. An automatic removal should remove all "libraries (with "toplevel('n')" ) while all apps (like mozilla with "toplevel('y')") would be left alone. Of course this doesn't deal with the handling additional libraries that may be used by programs but aren't included as dependencies.
//Edited because I klicked submit before I was done//
Offline
cool. thanx. but i did'n find "--orphan" in pacman manpage... how can i find informations such this one? maybe i'm missing something? (btw, i saw also a "pacman -T" in makeworld script...). thanks for the help, y'all, i've got a lot to learn.
Offline
That I've modified the code so that it can skip some packages that you specified in the file "./pacNoReq.skip"
#!/bin/bash
echo "Running a check for packages required by none."
echo "Started on:"
date
echo ""
for pkgName in `pacman -Qi | sed 's/ .*//'`;
do
if [ -f "./pacNonReq.skip" ] && [ -n "`grep $pkgName ./pacNonReq.skip`" ]; then
:
elif [ -n "`pacman -Qi $pkgName | grep Required | grep None`" ]; then
echo "Package : $pkgName"
pacman -Qi $pkgName | grep Descript
echo
fi
done
If.. I break the code, please forgive me that it's my 1st time...
and..
@RdsArts
May I quote your code to our local wiki in Taiwan?
Thank you very much in advance!
Offline
pacman -Qe
-e, --orphans
List all packages that were explicitly installed (ie, not pulled
in as a dependency by other packages) and are not required by
any other packages.
Offline
I wrote a perl script fully like a debfoster.
You can grab it here: http://avb.bas-net.by/pkgpurge
Feel free to write bugreports
Regards, Alex
Offline