You are not logged in.
I made a slight change that only prints out the package name so that way, the results can easily be passed to pacman. For example, now you can do:
pacman -Rn `orphans`
Here it is at pastebin.archlinux
Offline
You mean there ain't no builtin way to do this? That's important!
I always roll 20s on my disbelieve checks.
You better believe it.
Offline
You mean there ain't no builtin way to do this? That's important!
What is "this"?
BTW, Pacman 3 does print only real orphans when using -Qe.
to live is to die
Offline
"This" is killing all packages that were installed at dependencies for packages that don't exist anymore.
And if pacman does that, why not just add an option to remove those packages in one fell swoop?
I always roll 20s on my disbelieve checks.
You better believe it.
Offline
Erm, maybe it is my browser, but backslashes seems to be missing from the script... I think this might be connected to the forum conversion?
Offline
[manuel@unix ~]$ orphans
syntax error at /usr/bin/orphans line 7, near "/,"
BEGIN not safe after errors--compilation aborted at /usr/bin/orphans line 21.
Offline
Erm, maybe it is my browser, but backslashes seems to be missing from the script... I think this might be connected to the forum conversion?
I entered the code again. Looks like it's fixed now.
Offline
thanks
Offline
pt-orphans doesn't handle "Provides:"
Example: amarok-base requires amarok-engine; package amarok-engine doesn't exist itself, but e.g. amarok-engine-xine "Provides:" amarok-engine (just check pacman -Qi amarok-engine-xine)
pt-orphans in this situation includes amarok-engine-xine as an orphan. I don't know perl enough to fix it...
Not much trouble, but I wouldn't recommend doing 'pacman -R `pt-orphans`'.
Last edited by bender02 (2007-02-07 00:31:48)
Offline
Yes, you have a point. I've made a new version that has this logic:
if pkg was installed as dependency and not required by any other pkg:
1. provides nothing => orphan
2. provides "someting" => test if any pkg depends on "something" => if not => orphan
And I translated it from perl to shell.
Please try it:
http://members.home.nl/w.speek/arch/orphans.sh
Offline
And I translated it from perl to shell.
Please try it:
http://members.home.nl/w.speek/arch/orphans.sh
Same fonction as yaourt -Qt:
Look at the code, it's a litte bit easier:
PACMANROOT="/var/lib/pacman"
for pkg in `ls "$PACMANROOT/local/"`; do
if echo $(cat "$PACMANROOT/local/$pkg/desc" 2>/dev/null) | grep -q "%REASON% 1"; then reason=1; else reason=0; fi
if echo $(cat "$PACMANROOT/local/$pkg/depends" 2>/dev/null) | grep -q "%REQUIREDBY% %CONFLICTS%"; then requiredby=0; else requiredby=1; fi
if [ $reason -eq 1 -a $requiredby -eq 0 ]; then
version=$(echo $(cat "$PACMANROOT/local/$pkg/desc" 2>/dev/null) | awk '{print $4}')
orphans[${#orphans[@]}]=${pkg%-${version}}
echo -e "${COL_YELLOW}${pkg%-${version}} ${COL_NORMAL}seems to be safely removable"
fi
done
note: yaourt shows automatically new orphans after "yaourt -Rcs" command
Offline
I don't understand your code.
grep "%REASON% 1" desc
grep "%REQUIREDBY% %CONFLICTS%" depends
will never match a line in those files.
But I will try yaourt later. I'm in a hurry now.
Offline
Well, I don't understand how it works, but it does work The echo and cat thing probably removes the newlines (\n).
But your code doesn't include the issue with "Provides" that bender02 pointed out.
Offline
Sorry for the delay - forum's notification doesn't work the way I expected. So I tried, the new orphans.sh works well, but yaourt (great utility, though) doesn't handle the issue I mentioned above (in my example it would remove amarok-engine-xine).
@Speek - thanks for the script!
Offline
Thanks Speek, script works great.
Offline
This script still working with the new pacman?
I can´t put this script working here...
Offline
pacman -Qdt does the same. And you're bumping a four years old thread.
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
Closed. @semeion, its good that you search for threads, but if its 4 years old its pretty certain everything has already changed.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline