Automatic BuildRequires

Richard W.M. Jones rjones at redhat.com
Thu Nov 6 11:01:42 UTC 2008


[I'm sure this isn't the first time this has occurred to someone, or
even been done -- but couldn't find anything for it in Google ...]

http://et.redhat.com/~rjones/auto-buildrequires/

This tries to find the correct set of BuildRequires automatically when
running 'rpmbuild'.  Just replace the ordinary rpmbuild command with
auto-br-rpmbuild, and it will print out a suggested set of
BuildRequires lines at the end.  For example:

$ auto-br-rpmbuild -ba mingw32-iconv.spec
[...]
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rjones/rpmbuild/BUILDROOT/mingw32-iconv-1.12-5.fc10.x86_64
Wrote: /home/rjones/rpmbuild/SRPMS/mingw32-iconv-1.12-5.fc10.src.rpm
Wrote: /home/rjones/rpmbuild/RPMS/noarch/mingw32-iconv-1.12-5.fc10.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.XpFhTF
+ umask 022
+ cd /home/rjones/rpmbuild/BUILD
+ cd libiconv-1.12
+ rm -rf /home/rjones/rpmbuild/BUILDROOT/mingw32-iconv-1.12-5.fc10.x86_64
+ exit 0
BuildRequires: bash = 3.2.29.fc10.x86_64
BuildRequires: binutils = 2.18.50.0.9.7.fc10.x86_64
BuildRequires: ccache = 2.4.13.fc9.x86_64
BuildRequires: coreutils = 6.12.16.fc10.x86_64
BuildRequires: diffutils = 2.8.1.21.fc9.x86_64
BuildRequires: file = 4.26.3.fc10.x86_64
BuildRequires: findutils = 1:4.4.0.1.fc10.x86_64
BuildRequires: gawk = 3.1.5.18.fc10.x86_64
BuildRequires: gcc-gfortran = 4.3.2.6.x86_64
BuildRequires: gettext = 0.17.8.fc10.x86_64
BuildRequires: glibc-common = 2.8.90.14.x86_64
BuildRequires: grep = 2.5.1a.61.fc10.x86_64
BuildRequires: gzip = 1.3.12.7.fc10.x86_64
BuildRequires: make = 1:3.81.14.fc10.x86_64
BuildRequires: mingw32-binutils = 2.18.50_20080109_2.8.fc9.x86_64
BuildRequires: mingw32-filesystem = 34.1.fc9.noarch
BuildRequires: mingw32-gcc-c++ = 4.3.2.8.fc9.x86_64
BuildRequires: mingw32-gcc = 4.3.2.8.fc9.x86_64
BuildRequires: mingw32-gettext = 0.17.6.fc9.noarch
BuildRequires: mingw32-iconv = 1.12.4.fc9.noarch
BuildRequires: mingw32-runtime = 3.15.1.1.fc9.noarch
BuildRequires: mingw32-w32api = 3.12.1.fc9.noarch
BuildRequires: net-tools = 1.60.91.fc10.x86_64
BuildRequires: sed = 4.1.5.10.fc9.x86_64
BuildRequires: tar = 2:1.20.3.fc10.x86_64

As you can see it's not perfect.  It doesn't ignore 'core' packages
which are always expected in a mock/koji build.  Also because autoconf
scripts tend to touch the C++ and Fortran compilers, even when they
are not used, it always suggests those packages.  Also it doesn't
exclude some tools like tar which are touched by rpmbuild itself.

The implementation is a simple LD_PRELOAD script that analyzes open(2)
and execve(2) system calls, a Perl script that does the analysis, and
some shell scripts to hang it all together.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the fedora-devel-list mailing list