rpmbuild-order: Order RPM packages by dependencies

[ bsd3, distribution, library, program ] [ Propose Tags ]

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

[Skip to Readme]
Versions [faq] 0.1, 0.2, 0.2.1, 0.3, 0.3.1, 0.4.0, 0.4.1, 0.4.2,, 0.4.3, (info)
Change log ChangeLog.md
Dependencies base (<5), bytestring, case-insensitive, containers, directory, extra (>=1.6.4), fgl, filepath, optparse-applicative, process, rpmbuild-order, simple-cmd-args [details]
License BSD-3-Clause
Copyright 2010-2018 Henning Thielemann, 2018-2020 Jens Petersen <petersen@redhat.com>
Author Henning Thielemann <haskell@henning-thielemann.de>, Jens Petersen <petersen@redhat.com>
Maintainer Jens Petersen <petersen@redhat.com>
Category Distribution
Home page https://github.com/juhp/rpmbuild-order
Bug tracker https://github.com/juhp/rpmbuild-order/issues
Source repo head: git clone https://github.com/juhp/rpmbuild-order
Uploaded by JensPetersen at 2020-09-24T17:25:21Z
Distributions Fedora:, LTSHaskell:0.2.1, NixOS:, Stackage:0.2.1
Executables rpmbuild-order
Downloads 2442 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-09-24 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for rpmbuild-order-

[back to package description]

Build Status Hackage license


This package originally based on code from cabal-sort, sorts rpm package spec files by build order.

$ rpmbuild-order --help
$ 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 subcycles.

Using the rpmbuild-order deps and rdeps commands the ordered dependencies and reverse dependencies of a package can be obtained from the current set of checked out package sources.


As of version 0.4, a library is also provided.

There are two modules:

  • Distribution.RPM.Build.Graph provides lower level functions for generating RPM dependency graphs
  • Distribution.RPM.Build.Order provides higher level functions for sorting packages in build dependency orders and output.

Please see the documentation for more details.

Notes and known problems

  1. 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.

  1. 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 less common for BuildRequires than Requires.

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