Cleaning Fink up: packages

The last post dealt with removing files (sources and .debs) that Fink might not need any longer. What about packages?

Word of advice: Some of the commands below should be run with care. If you’re not sure about what they do and how they should be used then you might want not to run them at all.

The basics: fink remove

The basic command for removing packages is fink remove:

fink remove packagename

Unless that package is necessary by other package(s), every file installed by that package will be removed. Well, actually that’s not precise. The remove command will keep configuration files, which is a nice idea in case you want to install that package again. If you want to remove both the package and its configuration files, run:

fink purge packagename

Some packages can’t be removed this way because other packages depend on it. Fink will warn you if that’s the case and tell you how to proceed if you want to recursively remove that package.

Packages containing developer files

Fink packages can roughly be categorized into user applications, utilities, shared libraries, and developer files. Users normally install applications, which in turn might need utilities or shared libraries to function properly (the so-called dependencies). If  a package needs to be compiled/built by Fink, then it will often need one of more developer files (usually header files) which are part of BuildDependsOnly (BDO) packages. After the compilation/build ends, these packages containing developer files may be removed – Fink will install them again if needs be.

BDO packages tend to be quite small so the effort of removing them might not be worth it.

If you want to list all the BDO packages installed by Fink, save the following shell script in a file (e.g. bdolist.sh):

#!/bin/sh
fink list -it | cut -f2 | \
xargs fink dumpinfo -fbuilddependsonly -p "%n" | \
while read line
do
  firstfield=`echo $line | cut -d: -f1`
  secondfield=`echo $line | cut -d: -f2`
  if [ "$firstfield" == "%n" -a \
    "$previousline" == "builddependsonly: true" ]
  then
    echo $secondfield
  fi
  previousline="$line"
done

Flag the file as being executable and run it:

chmod +x bdolist.sh
./bdolist.sh

If you want to remove all the BDO packages listed by the script, run the  following command:

./bdolist.sh | xargs fink remove

Deb management packages

In general, deb management programs besides the APT and dpkg management systems should work on Fink. They need to be installed by the fink install command and, as they are not part of Fink core, Fink cannot vouch for (or support) them.

Deborphan lists packages (libraries and BDO packages mostly) that have no other packages depending on them. Run

deborphan

in order to get a list of such packages. If you want to remove them, run

deborphan | xargs fink remove

Debfoster, when run in interactive mode, asks the user for which packages should be kept on the system, assisting with the removal of packages (especially libraries and BDO packages) that are no longer necessary.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s