pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to remove pkgsrc orphan dependencies?



Ottavio Caruso <ottavio2006-usenet2012%yahoo.com@localhost> writes:

> My system has grown to be a mix-and-match of binary packages installed
> with pkgin and other packages compiled natively from pkgsrc.
>
> I have then removed some of the latter packages but I have Gbytes of
> unused orphan packages.
>
> I know that "pkgin autoremove" can remove orphan packages but that
> doesn't take in consideration compiled packages.
>
> I could force pkgin to "keep" some packages, but thay are really too many.
>
> Is there a native way to achieve this goal?
>
> How do you guys manage a system that grows a bit too big, without
> sacrificing essential dependencies?

As I understand it, pkgin's notion of "keepable" is exactly the same as
a package not having automatic=YES.    The packages that you manually
built should not have automatic=YES set.   So you should be able to
"pkgin -n ar" and see what it wants to remove.

The following will make 4 files, separating packages into
automatic/manual and required/notrequired.   Then you can adjust
automatic.

I use this to remove automatic-notrequired, but pkgin ar is better
because it does it all in one step instead of having to redo it.


rm -f PKG.automatic-required PKG.automatic-notrequired \
    PKG.manual-required PKG.manual-notrequired
for d in `cd /var/db/pkg && ls`; do
    D=/var/db/pkg/$d
    DREQ=$D/+REQUIRED_BY
    DINS=$D/+INSTALLED_INFO
    REQ=notrequired
    AUTO=manual
    if [ ! -d $D ]; then
        continue;
    fi
    if [ -s $DREQ ]; then
        REQ=required
    fi
    if [ -f $DINS ] && egrep 'automatic=(yes|YES)' $DINS > /dev/null; then
        AUTO=automatic
    fi
    echo $d >> PKG.$AUTO-$REQ
done

Attachment: pgpbUpufXybe8.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index