MyNixOS website logo
Description

Sort RPM packages in dependency order.

The rpmbuild-order tool sorts source RPM packages by build dependencies, so that they can be built in a correct order. It does this by reading RPM package spec files and then topologically sorts them according to their build dependencies. The code evolved from cabal-sort by Henning Thielemann. It can also order the dependencies or reverse depends of one or more packages among the packages checked out in neighboring directories (which can be useful to see what packages are affected when a low-level package changes, or which packages are dependents of one of more packages). It also has support for setting RPM options for bcond etc, which can affect dependencies. It can also output dependency graphs. Since version 0.4, a library API is provided.

GitHub CI Hackage license

rpmbuild-order

This is a tool to sort RPM source packages in build dependency order. The code was originally derived from cabal-sort by Henning Thielemann.

Usage

$ rpmbuild-order --version

0.4.12

$ rpmbuild-order --help

Order packages by build dependencies

Usage: rpmbuild-order [--version] COMMAND

  Sort package sources (spec files) in build dependency order

Available options:
  -h,--help                Show this help text
  --version                Show version

Available commands:
  sort                     sort packages
  deps                     sort dependencies in neighbouring package dirs
  rdeps                    sort dependents in neighbouring package dirs
  layers                   ordered output of dependency layers
  chain                    ordered output suitable for a chain-build
  leaves                   List of the top leaves of package graph
  roots                    List lowest root packages
  render                   Show graph with graphviz
$ rpmbuild-order sort mycore mylib myapp
mylib mycore myapp

The arguments passed can either be directories containing the package or spec files.

If the dependency graph has cycles then an error will be output with a list of cycles and any shortest path subcycles.

Using the rpmbuild-order deps and rdeps commands the ordered dependencies and reverse dependencies of a package can be obtained within the current set of checked out package sources. ie If you have a directory with packages:

pkg1/ pkg2/ lib1/ lib2/ lib3/ misc1/

then the output of rpmbuild-order deps pkg1 might be lib1 lib3 pkg1 for example.

The render command displays a graph of package dependencies using graphviz and X11 or can print the dot format to stdout.

Library

As of version 0.4, a library is also provided.

There are two modules:

  • Distribution.RPM.Build.Order provides higher level functions for sorting packages in build dependency orders and output. It is built on top of:
  • Distribution.RPM.Build.Graph provides lower level functions for generating RPM dependency graphs

Please see their documentation for more details.

Notes and known problems

  1. Handles pkgconfig() provides by grepping .spec for .pc files

  2. Given packages A, B, C, where C depends on B, and B depends on A, and you call

    rpmbuild-order sort C.spec A.spec
    

    then the output may be wrong if C does not have a direct dependency on A. Even if the order is correct, B is missing in the output and thus in this case the list of packages cannot be reliably used for a sequence of builds.

    However the deps and rdeps commands take other neighbouring package directories into account.

  3. repoquery is not used to resolve meta-dependencies or files to packages. So if a package BuildRequires a file, it will not be resolved to a package. This may get addressed some day, but file dependencies seem uncommon for BuildRequires compared to Requires.

  4. rpmspec is used to parse spec files (for macro expansion etc): so missing macros packages can lead to erroneous results in some cases.

  5. Since version 0.4.6 there is some support now for packages using dynamic buildrequires (in Fedora: golang, python, ruby, and rust packages).

  6. Since version 0.4.8 %{_isa} suffixed Provides are filtered out for x86_64.

Installation

rpmbuild-order is packaged in Fedora Linux.

Building from source

Use cabal-rpm builddep && cabal install or stack install.

Metadata

Version

0.4.12

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows