You are not logged in.

#1 2004-02-11 12:55:06

Registered: 2004-02-11
Posts: 32

Remove with dependencies

Well I'm not sure if this topic as already be solved but here is a little bash function I wrote to do it :

myremove() {
        # save package list
        lspac > tmp1

        # remove packages
        rmpac $*

        # new list for comparison
        lspac > tmp2

        # packages to remove during next step
        NEWLISTE=`diff tmp1 tmp2 | grep > | cut -d " " -f2 | tr "n" " "`

        if [ -n "$NEWLISTE" ]; then
                # remove dependencies
                myremove $NEWLISTE
                # remove tmp files
                rm tmp1 tmp2

with :

alias lspac="pacman -Qi --orphan | cut -d ' ' -f1"
alias rmpac="pacman -Rn"

Well it works and that's all, no confirmation etc but I think it should be easy to implement. The basic idea behind this is that if you remove a package and that package has a dependency, let say X, you have two choice :
- either something else uses X and you won't remove it because it won't appear in the list of "orphan packages"
- either nothing uses it and it appears in the orphan list, so it will be removed during next call

Hope it will be helpfull.


#2 2004-02-11 12:58:01

From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975

Re: Remove with dependencies

i thought that is what the cascading removal option was?

AKA uknowme

I am not your friend


#3 2004-02-11 13:03:05

Registered: 2004-02-11
Posts: 32

Re: Remove with dependencies

Well in fact I think that the cascade package remove packages depending on the one you're removing to avoid breaking dependencies, whereas what I do is removing the unused dependencies.

if you've got : X -> Y -> Z

and you remove Y

- pacman -Rc removes X and Y
- I remove Y and Z if Z is unused

(hoping I'm right ant the cascade option does this)


#4 2004-03-02 19:06:10

Registered: 2004-02-11
Posts: 32

Re: Remove with dependencies

Well this is now obsolete since the "--recursive" option has been added (see pacman changelog)

Good news smile


Board footer

Powered by FluxBB