Tag Archives: package

Finding files in Fink

Let’s see some methods to find files and their packages in Fink.

Using find

find is a command that is provided by most, if not all, Unix-based systems, including Mac OS X. Let’s say you want to find a file named zipfile.py in your Fink installation. On my system,

$ find /sw -name zipfile.py
/sw/lib/python2.5/zipfile.py
/sw/lib/python2.6/zipfile.py

You can be more specific if you’re sure that a file resides in a certain directory, e.g.

$ find /sw/lib -name libgutils\*dylib
/sw/lib/fontforge/libgutils.1.0.3.dylib
/sw/lib/fontforge/libgutils.1.dylib
/sw/lib/fontforge/libgutils.dylib

In the command above I also used \* to indicate that I was interested in any file whose name starts with libgutils and ends with dylib.

Furthermore, depending on your configuration, you may use locate or mdfind for this purpose.

Using dpkg

Fink uses a fork of Debian’s dpkg tool for binary package management. Here are some useful dpkg commands.

If you want to find out which package installed a given file, use dpkg -S. For example,

$ dpkg -S zipfile.py
python26: /sw/lib/python2.6/zipfile.pyc
python26: /sw/lib/python2.6/zipfile.pyo
python26: /sw/lib/python2.6/test/test_zipfile.pyc
python26: /sw/lib/python2.6/test/test_zipfile.pyo
python25: /sw/lib/python2.5/zipfile.py
python25: /sw/lib/python2.5/zipfile.pyc
python25: /sw/lib/python2.5/zipfile.pyo
python25: /sw/lib/python2.5/test/test_zipfile.pyc
python25: /sw/lib/python2.5/test/test_zipfile.pyo
python26: /sw/lib/python2.6/test/test_zipfile.py
python25: /sw/lib/python2.5/test/test_zipfile.py
python26: /sw/lib/python2.6/zipfile.py

Specifying an absolute path will limit the results:

$ dpkg -S /sw/lib/python2.6/zipfile.py
python26: /sw/lib/python2.6/zipfile.py

If you want to list the files installed by a given package (e.g. the di package), use dpkg -L:

$ dpkg -L di
/.
/sw
/sw/bin
/sw/bin/di
/sw/bin/mi
/sw/share
/sw/share/doc
/sw/share/doc/di
/sw/share/doc/di/MANIFEST
/sw/share/doc/di/README
/sw/share/man
/sw/share/man/man1
/sw/share/man/man1/di.1

The grep command can be useful to filter the results: to list only the binaries (programs) installed under /sw/bin,

$ dpkg -L di | grep ^/sw/bin
/sw/bin
/sw/bin/di
/sw/bin/mi

If you have a binary package (i.e., a .deb file that was either built on your machine or obtained via a binary distribution), you need to use dpkg -c instead:

$ dpkg -c /sw/fink/debs/bibclean_2.11.4-2_darwin-i386.deb
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/bin/
-rwxr-xr-x root/admin   112564 2009-09-16 09:04 ./sw/bin/bibclean
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/doc/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/doc/bibclean/
-rw-r--r-- root/admin    26550 2009-09-16 09:04 ./sw/share/doc/bibclean/README
-rw-r--r-- root/admin     2932 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.copyright
-rw-r--r-- root/admin    48768 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.pdf
-rw-r--r-- root/admin    76512 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.ps
-rw-r--r-- root/admin    55226 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.txt
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/man/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/man/man1/
-rw-r--r-- root/admin    42974 2009-09-16 09:04 ./sw/share/man/man1/bibclean.1

The directory/folder /sw/fink/debs contains convenient symbolic links to the actual .deb files created when packages were built on your machine. On the other hand, .deb files obtained via binary distributions are located under /sw/var/cache/apt/archives.

Statistics for September 2009

Welcome to a new instalment of the statistics posts.

As usual, these statistics refer to package description files. A package description is a .info file that describes the information that Fink needs in order to manage packages. Sometimes a package is split into multiple .info files (e.g. package-10.5.info and package-10.6.info). It is also possible that a single .info file defines multiple packages: split-offs, different Perl/Python/… versions, -mac/-x11, etc. I’ve also counted a .info file that is in both stable and unstable as a single file.

The (monthly) evolution of the number of package descriptions is shown inside parentheses/in italics.

Currently Fink has 5,329 (+63) .info files split into the following sections:

Section # of Pkgs
libs/perlmods 673 (+3)
libs 462 (+5)
sci 426 (+2)
gnome 360 (+6)
kde 349 (+6)
utils 340 (+9)
crypto 326 (+2)
net 319 (+15)
devel 259 (-1)
graphics 237 (-1)
text 234 (+0)
games 197 (+15)
kde/po 186 (+0)
languages 159 (-6)
sound 157 (+6)
x11 137 (+0)
editors 128 (+0)
libs/pythonmods 81 (+0)
web 72 (+0)
x11-wm 61 (+1)
database 55 (+0)
libs/rubymods 48 (+1)
base 42 (+1)
shells 17 (+0)
x11-system 4 (+0)

The top 10 maintainers are

Maintainer # of Pkgs
Benjamin Reed 841 (+5)
Jack Fink 645 (+57)
Daniel Macks 280 (+0)
The Gnome Core Team 214 (+0)
Daniel Johnson 163 (+8)
Todai Fink Team 151 (+0)
Christian Schaffner 122 (+0)
Ben Hines 103 (+1)
Dave Morrison 99 (+0)
Kurt Schwehr 89 (+0)

These 10 top maintainers are responsible for 2,707 (51%) package descriptions. Out of 288 (-1) maintainers, 124 (+1) (43%) of them maintain only one package description, and 212 (+1) (74%) of them maintain five or less package descriptions.

There are 581 (+30) (11%) unmaintained package descriptions.

Our new maintainer this month is Fabien Thomas, who has packaged netperf. Welcome!

The passwd package

Fink has a special package named passwd that’s responsible for adding users to the system. This is necessary because some packages need users with specific names in order to build, install, or run. For example, when installing the postgresql84 package, there needs to exist a user named ‘postgres’ on the system.

Let’s use the dpkg command to inspect the contents of the passwd package:

$ dpkg -L passwd
/.
/sw
/sw/etc
/sw/etc/group-fink
/sw/etc/passwd-fink
/sw/sbin
/sw/sbin/update-passwd

/sw/etc/passwd-fink (group-fink) contains the list of users (resp. groups) that are to be/have been installed on the system, and /sw/sbin/update-passwd is a shell script that effectively adds users and groups based on the aforementioned files.

When the passwd package is being installed (usually because some other package needs a certain user/group) it asks the user whether it should add users and groups to the system. Whilst it is possible to answer negatively, the package that asked for passwd will probably have some problem during building, installing, or running, so users are in general advised to answer positively. If you’ve answered no then you can either add users and groups manually or run

fink reinstall passwd

and answer yes.

Also, if for some reason the users or groups installed by the passwd package are not present on your system any longer, the command above should fix that.

Statistics for August 2009

Welcome to a new instalment of the statistics posts.

As usual, these statistics refer to package description files. A package description is a .info file that describes the information that Fink needs in order to manage packages. Sometimes a package is split into multiple .info files (e.g. package-10.5.info and package-10.6.info). It is also possible that a single .info file defines multiple packages: split-offs, different Perl/Python/… versions, -mac/-x11, etc. I’ve also counted a .info file that is in both stable and unstable as a single file.

The (monthly) evolution of the number of package descriptions is shown inside parentheses/in italics.

Currently Fink has 5,266 (+41) .info files split into the following sections:

Section # of Pkgs
libs/perlmods 670 (+7)
libs 457 (+1)
sci 424 (+2)
gnome 354 (+7)
kde 343 (+1)
utils 331 (+2)
crypto 324 (+3)
net 304 (+2)
devel 260 (+2)
graphics 238 (+3)
text 234 (+2)
kde/po 186 (+0)
games 182 (+1)
languages 165 (+0)
sound 151 (+0)
x11 137 (+0)
editors 128 (+2)
libs/pythonmods 81 (+1)
web 72 (+3)
x11-wm 60 (+0)
database 55 (+0)
libs/rubymods 47 (+0)
base 42 (+1)
shells 17 (+0)
x11-system 4 (+0)

The top 10 maintainers are

Maintainer # of Pkgs
Benjamin Reed 836 (+0)
Jack Fink 588 (+17)
None 551 (+0)
Daniel Macks 280 (+21)
The Gnome Core Team 214 (+0)
Daniel Johnson 155 (+7)
Todai Fink Team 151 (+0)
Christian Schaffner 122 (+0)
Ben Hines 102 (+0)
Dave Morrison 99 (-1)
Kurt Schwehr 89 (+2)

These 10 top maintainers (excluding “No maintainer”) are responsible for 2,636 (50%) package descriptions. Out of 289 (+0) maintainers, 123 (+0) (43%) of them maintain only one package description, and 211 (+0) (73%) of them maintain five or less package descriptions.

There are 551 (+0) (10%) unmaintained package descriptions.

Starting anew

Some users have been asking how to reinstall Fink. This might be necessary when there isn’t an upgrade path — for instance, there’s no upgrade path from 32-bit Fink to 64-bit Fink, or when trying to replicate a Fink installation from one architecture (e.g. PowerPC, 32-bit Intel) to another (e.g. 64-bit Intel). This text explains how to save the list of installed packages and their configuration files in order to conveniently reinstall them on a clean Fink installation. Bear in mind that packages in one platform may not be available on another. For example, some packages are only available for PowerPC, and 64-bit Fink has (at the moment) fewer packages than on 32-bit Intel, 32-bit Fink.

Note: if you’re not sure how to execute the commands listed below on a terminal window, contact someone that’s more familiar with Unix and shells.

Preamble: Understanding virtual packages

Virtual packages are placeholders for packages or features that are present on your system but haven’t necessarily been installed by Fink itself. Some of them are system virtual packages, representing files that are shipped with the system (e.g. system-java, system-perl), whilst others may represent files installed by either Fink (e.g. pdftex) or the user (e.g. growl). Some of these virtual packages do not actually refer to files on your system. For example, the 64bit-cpu virtual package is just an indication that the system has a 64-bit processor. At any rate, virtual packages are managed by Fink and you can’t run commands fink install or fink remove on them.

Listing installed packages

Fink provides a handy command to list installed packages:

fink list --installed

or

fink list -i

for short. This command outputs a human-readable list of packages that are considered to be installed on your system, including packages you’ve installed yourself, their dependencies, and virtual packages. The following command trims virtual packages off this list:

fink list -i | grep -v " p " | grep -v "\["

We may use the -t flag and the cut command to get a nice list of installed packages that doesn't include virtual packages:

fink list -it | grep -v " p " | grep -v "\[" \
| cut -f2

In order to save this list to a file (e.g. instpkgs.txt) for further reference, use the command

fink list -it | grep -v " p " | grep -v "\[" \
| cut -f2 > instpkgs.txt

Saving configuration files

If you're planning on removing your entire /sw folder then you should consider saving your configuration files. Fink's configuration file is /sw/etc/fink.conf. Packages may also place configuration files under /sw, usually under but not limited to /sw/etc (on my system there are package configuration files under /sw/etc, sw/lib, and /sw/var).

The following command lists the configuration files of every package in instpkgs.txt as created in the previous section, saving the list in conffiles.txt:

cat instpkgs.txt | xargs fink dumpinfo -fconffiles \
| sed "s/^conffiles: //;s/^[ \t]*//" | tr " " "\n" \
| sort | uniq > conffiles.txt

Browse through this list and backup the configuration files you want to keep (don’t forget to write their original location down). Some of them don’t need to be backed up (e.g. /sw/etc/passwd-fink). If you want to know which package installed a certain configuration file (e.g. /sw/etc/pkgconffile.conf), run the following command:

dpkg -S /sw/etc/pkgconffile.conf

Please note that if you’re changing from a 32-bit Fink installation to a 64-bit Fink installation then it is possible that old configuration files won’t work on the new installation. As this is particular to each package there’s no general solution for it. If you’re changing from one OS X version to another, or from 32-bit Fink to 64-bit Fink, it is also possible that your old fink.conf won’t work on the new installation, especially the Distribution and SelfUpdateTrees entries. You’re better off using your old fink.conf as a guide when answering the questions asked by Fink during installation/bootstrapping or when running the

fink configure

command.

Local packages

If you’ve created local packages under /sw/fink/dists/local, don’t forget to backup them up. You probably won’t need to keep the binaries so it should be safe to keep only the package descriptions and patches; those are usually under /sw/fink/dists/local/main/finkinfo.

Removing Fink

Every file installed by Fink is under the /sw folder, so running the following command will wipe out your Fink installation:

sudo rm -rf /sw

Well, not exactly. Fink also places convenient shortcuts under /Applications/Fink for packages that are application bundles (those special folders whose name end with .app). If you use the fink remove command to remove a package that provides an application bundle then the equivalent shortcut is removed. However, if you simply remove the /sw folder, the shortcuts won’t get removed, so you might want to do that yourself.

Depending on how you’ve installed Fink or if you’ve run the pathsetup shell script, you might have a line resembling

test -r /sw/bin/init.sh && . /sw/bin/init.sh

in your $HOME/.profile shell initialisation script (or the equivalent command/file for csh, tcsh). The line above can be left there if you’re planning on reinstalling Fink. It is also harmless to leave if there if Fink is not installed.

Installing Fink

Follow the installation instructions on Fink’s Web site. Recall that at the moment there is no binary installer for OS X 10.6, Snow Leopard, so you need to use the source installation from version 0.29.9 or higher.

Reinstalling the packages

You may use the instpkgs.txt created in the Listing installed packages section. The following shell script reads that file, line by line, and runs Fink’s installation command on each package:

cat instpkgs.txt | while read pkg
do
  fink install $pkg
done

Note that if you’re using sudo then this shell script will ask your password every now and then. You might want to save the whole script to a file (e.g. reinstall.sh) and run it with sudo (e.g. sudo ./reinstall.sh).

As some of the packages in instpkgs.txt are dependencies of other packages it is quite probable that you’ll get some No packages to install warnings which may safely be ignored — they mean that the command above is trying to install a package that’s already been installed. If a package is not available on your new installation, you’ll get Failed: no package found for specification errors.

You may also want to restore the configuration files you’ve saved. Remember that if you’ve changed from one platform to another there might be differences in the configuration files. Whenever possible, use the application itself to enter the configuration, using the old (backed up) configuration file as a guide.

If you’ve backed up your local packages, restore them to /sw/fink/dists/local and run

fink index

so that Fink becomes (once again) aware of them.