This code demonstrates how to steal an object from a caller somewhere up in the stack.
To demonstrate this, it mimics the handler()
method of a BuildSRPMFromSCMTask
object in a Koji
builder process, calling callbacks implemented in plugins. The object the callback is interested in
(which for some reason isn't accessible) is the created build root broot
.
Running this would look like this (the build root id is random):
> ./kojid.py BuildRoot(id=None) => id=19791 process_distgit_cb('postSCMCheckout', taskinfo={'method': 'buildSRPMFromSCM'}, *args=(), **kwargs={}) BuildRoot(id=19791).mock(args=['--shell', 'echo', 'We did it!']) BuildRoot(id=19791).mock(args=['--buildsrpm', '...']) >