Cabal 1.1.6: an infelicity and a bug

Gregory Wright gwright at
Tue Oct 31 12:00:44 EST 2006


I've been updating the various haskell ports in MacPorts and
have found a couple of problems with the latest Cabal (1.1.6,
as provided by ghc-6.6).

One is simply an infelicity that adds unnecessary work:  why

	./Setup register

fail with an error when used with an application that installs no
libraries?  Could it simply return success and an informational
message like, "No library to install"?  As it is, the user (or the  
building the package) needs to know if a library is installed or
not.  It's not a big deal in the case of packages which just provide
libraries, but it creates a difference in installation procedure for
packages that only provide applications and those that provide
applications along with libraries.

(For an application, the script version of registration, ./Setup  
register --gen-script,
  should just generate a stub that returns success, too.)

Having register simply return success for an application also makes the
library and application installation procedures identical.
 From my experience in building packages, the more uniform the
installation procedure, the better.

The second problem I found is more serious.  When installing a
library, in this case MissingH 0.16, I get the error:

ghc-pkg: /opt/local/lib/MissingH-0.16.0/ghc-6.6/include doesn't exist  
or isn't a directory (use --force to override)
Error: Target returned: shell command "/opt/local/ 
libexec/missingh/" returned error 1
Command output: Reading package info from stdin ... done.
ghc-pkg: /opt/local/lib/MissingH-0.16.0/ghc-6.6/include doesn't exist  
or isn't a directory (use --force to override)

Warning: the following items did not execute (for missingh):
Error: Status 1 encountered during processing.

(the above is the output of the MacPorts portfile.)

The problem is that when the build is staged into a temporary
location so the files can be inventoried, an empty directory,
<prefix>/lib/MissingH-0.16.0/ghc-6.6/include is created.  MacPorts
deletes this empty directory (along with a number of other unused
directories it creates in the staging process).  The registration  
requires the empty directory to be present and fails, as shown above,
if it is not.

The solution is simple:  cabal can to drop a small file into any
directory it needs, say ".cabal-turd", preventing it from being deleted
(This is most easily done from the cabal side, rather than the packaging
system side, since the path has the haskell compiler and version
coded into it.)

I know that a case can be made for packaging systems preserving
all the directories created by a package, even empty ones.  However,
Macports (formerly darwinports) and cabal played nicely in the past
and the 1.1.6 behavior breaks this.

Best Wishes,

More information about the Libraries mailing list