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

Re: How to track header dependencies amongst -dev packages?



Ferenc Wagner <wferi@niif.hu> writes:

> I'm packaging software which consists of multiple libraries.  I put
> those libraries into various lib* binary packages with corresponding
> lib*-dev packages.  Some header files contained in the lib*-dev packages
> include others in other lib*-dev packages, thus package dependencies
> must be declared between them.  Is there any tool to help me with this,
> or should I create my own?  I imagine something like ${misc:Depends}...

I put something together which might (after recoding in a safe manner)
bu useful to others or be considered a horrible hack (which I'd like to
know of).  I invoke this script:

    #!/bin/sh -e
    
    cd debian
    
    pkgs=$(grep-dctrl -sPackage -n -FSection libdevel control)
    
    for p in $pkgs; do
        includes="$includes -I $p/usr/include"
    done
    
    for pkg in $pkgs; do
      {
        printf 'header:Depends='
        for header in $(find "$pkg" -name "*.h"); do
            gcc -MM -MT '' -E $includes $header
        done | sed "s|^:||;s|^ *||;\|^$pkg/|d;s|/.*| (= \${binary:Version}),|" | sort -u | tr '\n' ' '
        printf '\n'
      } >>"$pkg.substvars"
    done
    
from debian/rules like

    override_dh_gencontrol:
    	debian/check_header_deps
    	dh_gencontrol
    
and use Depends: ${header:Depends} in the control file.  Works for me in
the single case I tested.

Do you think it's worth developing into some proper helper?
-- 
Regards,
Feri.


Reply to: