auto-buildrequires

I just pushed a new release of auto-buildrequires, a super little tool for finding the BuildRequires that your package needs automatically. Just replace rpmbuild with auto-br-rpmbuild:

$ auto-br-rpmbuild -ta auto-buildrequires-0.9.tar.gz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wphzM5
[ lots of stuff here ... ]
+ exit 0
BuildRequires: bash = 3.2.30.fc10.x86_64
BuildRequires: binutils = 2.18.50.0.9.8.fc10.x86_64
BuildRequires: coreutils = 6.12.19.fc10.x86_64
BuildRequires: cpio = 2.9.90.2.fc10.x86_64
BuildRequires: diffutils = 2.8.1.21.fc9.x86_64
BuildRequires: elfutils = 0.140.1.fc10.x86_64
BuildRequires: file = 4.26.4.fc10.x86_64
BuildRequires: filesystem = 2.4.19.1.fc10.x86_64
BuildRequires: findutils = 1:4.4.0.1.fc10.x86_64
BuildRequires: gawk = 3.1.6.2.fc10.x86_64
BuildRequires: gcc = 4.3.2.7.x86_64
BuildRequires: glibc-devel = 2.9.3.x86_64
BuildRequires: glibc-headers = 2.9.3.x86_64
BuildRequires: grep = 2.5.1a.61.fc10.x86_64
BuildRequires: gzip = 1.3.12.7.fc10.x86_64
BuildRequires: kernel-headers = 2.6.27.19.170.2.35.fc10.x86_64
BuildRequires: make = 1:3.81.14.fc10.x86_64
BuildRequires: net-tools = 1.60.91.fc10.x86_64
BuildRequires: sed = 4.1.5.11.fc10.x86_64
BuildRequires: tar = 2:1.20.5.fc10.x86_64

It currently lists everything that your package needs. It doesn’t know which dependencies are in the core mock / Koji system, because these don’t seem to be listed anywhere as far as I can tell.

The program works using an LD_PRELOAD hack that intercepts any system calls that try to read or write files, and at the end a small Perl script works out which installed packages each file belongs to.

There are currently some problems. For example, autoconf tends to check for a C++ and FORTRAN compiler if one is installed, even if it is never requested or used, so you’ll get these as false requirements. Nevertheless it’s a great tool that I have been using all the time as a replacement for plain rpmbuild and as a final check that I’ve got the BuildRequires approximately right.

Developers, please see the git repository.

12 Comments

Filed under Uncategorized

12 responses to “auto-buildrequires

  1. I wonder if something like this exists for Python Requires

  2. rwmj

    Hello giallu, thanks for commenting.

    I’m not sure what you mean by Python requires in this context.

    auto-buildrequires will find all build time requirements (even ones for scripting languages).

    For runtime requirements of RPMs we rely as usual on RPM’s own mechanisms (/usr/lib/rpm/find-requires etc). find-requires looks inside Python, Perl and other scripts to try to detect what packages they require at runtime.

  3. That’s a great news. I built blueman in one of my systems after a lot of manual dependency resolution steps. I copied to spec file to another system and trying to build fails with “pygtk should be >=2.12” even though I have pygtk2-2.13 installed. Hope this tool will help, I’m going to try later tonight. Can it point out the py* deps too?

  4. rwmj

    Rajeesh, I hope so (for build deps not runtime deps). If not, it’s a bug.

    • OK, I tried now. “rpmbuild –rebuild SRPMS/auto-buildrequires-0.9-1.src.rpm” built “auto-buildrequires-0.9-1.i386.rpm” fine. On installing, it yelled dependency perl-String-ShellQuote is missing.
      After dependency resolution, rpm is installed. But running “auto auto-br-rpmbuild -ba SPECS/blueman.spec” aborts with error:
      ‘/lib64/libc.so.6: cannot open shared object file: No such file or directory
      /usr/bin/auto-br: line 34: 9571 Aborted “$@” ‘

      I’m on i386, not x86_64.

      Also, I cloned the git-repo and added a “Requires: perl-String-ShellQuote” to “auto-buildrequires.spec.in”. Is that correct? If so, would you accept a patch?

  5. The minimal buildroot is tracked as a comps group. Run ‘yum groupinfo buildsys-build’ to get the list of packages. This isn’t a depsolved list, admittedly.

  6. rwmj

    Thanks ajax. Another useful change for auto-buildrequires would be to have it remove packages which would be pulled in as requirements of other packages. Features, features …

  7. raorn

    Have you seen rpm-utils written by Dmitry V. Levin and Alexey Tourbin? There is buildreq utility that does almost same thing.

    http://git.altlinux.org/people/ldv/packages/?p=rpm-utils.git

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.