This is a tool to sort RPM source packages in build dependency order. This code is originally derived from cabal-sort by Henning Thielemann.
$ 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 shortest path subcycles.
Using the rpmbuild-order
rdeps commands the ordered
dependencies and reverse dependencies of a package can be obtained
within the current set of checked out package sources.
render command displays a graph of package dependencies
using graphviz and X11 or optionally instead prints the dot format to stdout.
As of version 0.4, a library is also provided.
There are two modules:
Distribution.RPM.Build.Graphprovides lower level functions for generating RPM dependency graphs
Distribution.RPM.Build.Orderprovides higher level functions for sorting packages in build dependency orders and output.
Please see the documentation for more details.
Notes and known problems
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.
rdeps commands take
other neighbouring package directories into account.
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.
rpmspec is used to parse spec files (for macro expansion etc): so missing macros packages can lead to erroneous results in some cases.
- ‘render’: do not reverse arrows
- ‘render’: rename -o/–output option to -g/–gv-output
- ‘render’: friendly error message if graphviz is not installed
- add ‘render’ command to display graph graphically with graphviz with an option to output dot format
- fix subcycle algorithm: now lists correct shortest path subcycles
- improve cycles output (#2)
- library Graph: add printGraph, renderGraph, createGraph’’’’
- intercalate newlines between cycles
- only list subcycles with over 2 packages
- ‘deps’ and ‘rdeps’: –exclude option to ignore a “broken” neighboring package
- ‘deps’ and ‘rdeps’ can now take –ignore-BR options (provided through depsPackages and new createGraph’’’)
- ‘sort’ no longer outputs a leading newline
- ‘sort’: fix arg handled which was causing reverse ordering!
- add a sort test for the installed rpmbuild-order
- drop the erroneous dependency on Cabal
- support options for rpmspec (suggested by QuLogic)
rpmbuild-order sort --rpmopt --with=bootstrap ...
- Graph: add createGraphRpmOpts and createGraph’’
- Order: add dependencySortRpmOpts
- add a newline between cycles
- no longer assume pkg dir = pkg name (though still optimize for it)
- output any subcycles for cyclic graph (suggested by QuLogic)
- performance: rework just to use String and only parse spec files once and also use faster PatriciaTree.Gr On about 500 packages roughly twice as fast as 0.3.1
- sort now defaults to outputting separate dependency stacks, with options for combined, connected, and independent packages only
- new ‘layers’ command outputs packages in ordered dependency independent layers
- new ‘chain’ command outputs Fedora chain-build format
- new ‘leaves’ commands to list outer leaf packages
- new ‘roots’ commands lists lowest dependencies
- new library exposed with 2 modules: low-level Graph and high-level Order:
- Distribution.RPM.Build.Order provides: dependencySort, dependencySortParallel, dependencyLayers, sortGraph output
- Distribution.RPM.Build.Graph provides: createGraph, dependencyNodes, subgraph’, packageLayers, etc
- graph Nodes are now only labelled by package/spec filepath and no longer carry redundant dependency lists
- add a basic testsuite for the library
- fix detection of circular dependencies (bug introduced in 0.3)
- check package provides instead of rpms
- use ByteString for packages (provides)
- move to simple-cmd-args (optparse-applicative)
- add –lenient for rpmspec failures
- error if no spec file
- filter out hidden files from deps search
- add –version
- generate manpage with help2man
- initial release with sort, deps and rdeps (reverse dependencies) commands