sorting srpms by buildorder
May 17, 2013
Working on something for Spot I revived some code I had written a
few years ago and then discovered that other people had made much more
robust leveled topological sorts than I had written🙂
Anyway – if you grab the files from:
python buildorder.py /path/to/*.src.rpm
it will look up the interdependencies of the src.rpm to figure out a
build order. It outputs a bunch of different things:
1. a flat build order
2. a build order broken out by groups – you can build all the pkgs in
any group in parallel provided that all the pkgs in the previous group
have finished building.
3. outputs lists of direct loops between srpms.
4. probably will output A LOT of noise and garbage from the rpm
specfile parsing from the rpm.spec() module
But it might be worth a look at and, ideally, patches to make it a bit
If you have a set of pkgs which you need to build but you can’t figure
out the buildorder this might help you out.
I’d love to know how often it is right or ‘right enough’.
1. some spec files make the rpm.spec() parsing break in interesting
ways – sometimes tracing back🙂
2. if a pkg is not dependent on any other pkg and nothing else depends
on it – they get lumped in the last grouping. Not really an issue –
just something someone noticed and was surprised.
3. It will handle file-buildreqs not at all, it will handle virtual
provide buildreqs, not at all, if your buildreqs are REALLY picky about
requiring <= Version – it will ignore all of that.🙂
4. I fully expect that 2 or more level circular build deps (foo req bar
req baz req quux) will not be detected but will make the topological
sort function die). If so…. tough… go fix your packaging.
Anyway – give it a run and see if it helps you solve a problem.
If it does let me know about it. Some of us are curious if this could
fit well in mockchain or wrapped around/in mockchain.