The Hidden Dependency Problem

Johnny C. Lam

jlam@pkgsrc.org

The NetBSD Project

Outline

The Problem

Typical command sequence:

/usr/pkg/bin/mutt no longer works.

The Problem (cont.)

What went wrong?

The Problem (cont.)

Revised command sequence:

Removing OpenSSL fails because Mutt depends on OpenSSL.

The Problem (cont.)

Problem solved, right?

No.

How do you configure Mutt to not use OpenSSL?

The FreeBSD Ports Way

Teach packages to honor WITH_* and WITHOUT_* knobs.

The FreeBSD Ports Way (cont.)

Major configure script options are promoted into WITH_* and WITHOUT_* knobs.

Problems:

The pkgsrc way

Manipulate the environment so that the configure script only sees what we want it to see and nothing more.

In either case, the Mutt configure script shouldn't see any of the OpenSSL files.

The pkgsrc way (cont.)

chroot is the obvious implementation.

Problems:

The pkgsrc way (cont.)

The infamous buildlink:

  1. Create buildlink directory, e.g. /tmp/buildlink.
  2. Symlink all required libraries and headers into that directory, e.g., /tmp/buildlink/lib/libreadline.so, /tmp/buildlink/include/readline/readline.h.
  3. Intercept calls to cc so that the compiler never looks in /usr/pkg, only in /tmp/buildlink.

This works for all packages that are compiled.

pkgsrc has been using buildlink for over 5 years now with good success.

buildlink

Benefits of buildlink over The FreeBSD Ports Way:

Simplifies package creation and maintenance.

buildlink (cont.)

Current implementation is mixture of make, shell, awk and sed code.

buildlink (cont.)

Problems with current implementation:

New wrapper design

To integrate into other packaging systems, Force using cc, etc. in /usr/pkg/bin in place of ones in /usr/bin.

New wrapper design (cont.)

Closing Thoughts