You are not logged in.

#26 2006-12-06 21:11:04

yankees26
Member
From: Connecticut, USA
Registered: 2006-09-29
Posts: 190

Re: orphans

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

#27 2006-12-15 12:58:24

kamagurka
Member
From: Munich, Germany
Registered: 2006-02-20
Posts: 150
Website

Re: orphans

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

#28 2006-12-15 21:19:01

Romashka
Forum Fellow
Registered: 2005-12-07
Posts: 1,054

Re: orphans

kamagurka wrote:

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

#29 2006-12-17 16:06:17

kamagurka
Member
From: Munich, Germany
Registered: 2006-02-20
Posts: 150
Website

Re: orphans

"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

#30 2007-02-02 18:28:50

bakaohki
Member
Registered: 2007-02-01
Posts: 11

Re: orphans

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

#31 2007-02-04 14:24:23

brainwasher
Member
From: Lucca (Italy)
Registered: 2007-01-04
Posts: 81
Website

Re: orphans

[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.

mad

Offline

#32 2007-02-04 16:08:44

Speek
Member
Registered: 2005-04-07
Posts: 36

Re: orphans

bakaohki wrote:

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

#33 2007-02-05 16:52:06

brainwasher
Member
From: Lucca (Italy)
Registered: 2007-01-04
Posts: 81
Website

Re: orphans

thanks smile

Offline

#34 2007-02-07 00:30:43

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: orphans

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

#35 2007-02-07 11:18:25

Speek
Member
Registered: 2005-04-07
Posts: 36

Re: orphans

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

#36 2007-02-07 12:17:22

wain
Member
From: France
Registered: 2005-05-01
Posts: 289
Website

Re: orphans

Speek wrote:

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 wink

Offline

#37 2007-02-07 12:55:28

Speek
Member
Registered: 2005-04-07
Posts: 36

Re: orphans

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

#38 2007-02-07 15:05:07

Speek
Member
Registered: 2005-04-07
Posts: 36

Re: orphans

Well, I don't understand how it works, but it does work smile 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

#39 2007-02-20 01:58:58

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: orphans

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

#40 2007-03-23 00:04:08

japetto
Member
From: Chicago, IL US
Registered: 2006-07-02
Posts: 183

Re: orphans

Thanks Speek, script works great. smile

Offline

#41 2011-05-15 19:06:56

semeion
Member
From: Brazil
Registered: 2008-10-20
Posts: 65

Re: orphans

This script still working with the new pacman?

I can´t put this script working here...

Offline

#42 2011-05-15 19:12:18

hauzer
Member
From: Belgrade, Serbia
Registered: 2010-11-17
Posts: 279
Website

Re: orphans

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

#43 2011-05-16 03:52:01

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: orphans

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

Board footer

Powered by FluxBB