[rock-devel] Runtime Dependency Checking - Proof-of-Concept Implementation

Stefan Fiedler stefan.fiedler at students.jku.at
Thu Oct 26 20:50:41 CEST 2006


Hi all,

here is a sample implementation of runtime dependency checking for ROCK Linux 
packages. For now it is provided in the form of two shell scripts, to ease 
testing, debugging and rapid development. It is also (for now) limited to a 
subset of runtime dependencies: shared libraries. The scripts are attached to 
this email.

The first script, create-runtime-deps, extracts dependency info stored in ELF 
files and writes it to (per-package) files in /var/adm/provides 
and /var/adm/requires.
This script could eventually become a part of Build-Pkg, creating this 
metadata immediately after each package build.

The second script, resolve-runtime-deps, takes three sets of packages as 
arguments: installed, selected and installable sets.
The installed set contains packages already installed, the selected set 
contains packages you want to install, and the third contains those packages 
available for installation (e.g. packages on install media).
The script will check if shared libraries required by packages in the selected 
set are provided by packages in the installed set, and if not, add packages 
which provide these libraries from the installable to the selected set.
The result is a modified selected set that consists of the original selected 
set plus all packages containing required libraries.
The rocket installer could use this script to resolve runtime dependencies 
during installation.

To give it a try, first create the necessary package metadata:
	./create-runtime-deps

Then you can run some resolver tests, e.g.:
	./resolve-runtime-deps "glibc23" "gimp" "$( cd /var/adm/flists ; ls )"
which means glibc23 is already 'installed', you want to 'install' gimp, and 
the packages 'available for installation' are the ones currently installed in 
your system.
The result (the modified selected set) is on the last line of output:

	result: gimp libart_lgpl23  alsa  atk  cairo  fontconfig  freetype  gtk+
	gimp-print42  glib  libice  libjpeg  lcms  libmng  pango  libpng  libsm
	libtiff  libx11  libxmu  libxpm  libxt  zlib  ncurses  libxrender  expat
	openssl  cups  libxau  libxcursor  libxdmcp  libxext  libxfixes  libxinerama
	libxi  libxrandr  readline  libxft  gcc40 acl  pam  gmp  attr  cracklib

This means you have to install these packages in order to use (all programs 
from) the gimp package, given that glibc23 is already installed.

This implementation is rather simple: it searches for libraries only by their 
names. An advanced implementation would also check library versions and flags 
as provided by GNU ELF extensions (and which are already stored 
in /var/adm/{provides,requires} files).
Another improvement would be to take info provided by pkg-config (*.pc) files 
into account.
There's also much room for optimization, the resolve example above takes about 
2:20 minutes on my Athlon XP 2000+ ;)

For some general considerations regarding (run- and build-time) package 
dependencies please see http://www.rocklinux.org/wiki/Package_Dependencies

As always, your feedback and cooperation is greatly appreciated.

With best regards,
	Stefan Fiedler

-- 
Liberty means responsibility. That is why most men dread it.
  George Bernard Shaw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: create-runtime-deps
Type: application/x-shellscript
Size: 2341 bytes
Desc: not available
Url : http://www.rocklinux.net/pipermail/rock-devel/attachments/20061026/3db66fb8/create-runtime-deps.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resolve-runtime-deps
Type: application/x-shellscript
Size: 2507 bytes
Desc: not available
Url : http://www.rocklinux.net/pipermail/rock-devel/attachments/20061026/3db66fb8/resolve-runtime-deps.bin


More information about the rock-devel mailing list