Dependency discovery

Stanislav Brabec sbrabec at suse.cz
Tue Apr 5 10:35:15 PDT 2011


Donnie Berkholz wrote:
> Do any of you have useful software that scans source code to determine 
> its dependencies? We're considering a Google Summer of Code project that 
> would include this as one aspect of a semi-automated package generator, 
> but I'd hate to see us duplicating effort.
> 
> The basic idea I had in mind is a set of plugins, one per language, with 
> a sufficient understanding of that language's syntax to determine the 
> external files a given piece of code depends on. We'd then couple that 
> with a tool like distromatch to figure out which packages the files came 
> from.

I wrote a small utility pkg-buildrequires, a post-mortem analyzer of the
autoconf-style configure script checks that were called. It was capable
to collect most dependencies in several steps. I tried to build with
base system in the build root, then analyzed and updated list of
required packages. It was tested on ~200 packages (GNOME and related
packages) and succeeded for ~90% of packages in ~4 iterations.
http://ftp.suse.com/pub/people/sbrabec/pkg-buildrequires/

Problems of that idea:

1. There is not yet a solution for the situation, when building for more
platforms or more distro versions will end with a different requirement
list.

2. Thinking about it, ideally such tool should be integrated directly
into autoconf macros - configure script could optionally write a machine
readable .pc and library check list. Package system tools can then
assign these checks to packages or symbols.

My idea was following:

Packaging system or package creating tool would call:
./configure --generate-check-log ...

And then parse config-check.log, update new requirements for build and
try again until all dependencies are checked and reviewed by the
packager.

The log should contain following information:

- What type of dependency it is (.pc file check, library check)
Easy to implement.


- whether it is mandatory check (configure fails if not found), optional
check (configure continues and the package is limited in features), pick
one check (one of several checks must succeed)

This would probably require autoconf syntax change; we really need to
know it only for failed checks - and there it is easy to detect
mandatory check.

- whether it is sequential version check (more versions is checked, one
check passes, other don't; can be mandatory, optional or pick-one).
This would probably require autoconf syntax change.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec at suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/



More information about the Distributions mailing list