sorting srpms by buildorder

May 17, 2013

Hey folks,
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:

And run:

python /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
more robust.

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

Known Issues:
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.

3 Responses to “sorting srpms by buildorder”

  1. You mentioned other efforts: were they also rpm based?

    How about putting the code into git? 🙂

    • skvidal Says:

      the only other attempts I’ve seen to do this are rpm-based, yah.

      Since the 2 pieces of code doing the topo sort aren’t mine I wasn’t quite sure if I should stuff it into git or not. I also need to verify license compatibility

      I’ll check on that tomorrow and see if I can get it into git.

      I assume this means you have patches 🙂

      • skvidal Says:

        Thinking about it a bit more – this code fits into the mock/mockchain framework pretty obviously. If I can verify license compatibility it might make sense to check it into mock’s git repo and work on integrating it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: