This guide briefly describes how to implement custom backend. Please see some of existing backends as example.
Lets assume that your new backend will be called
foo. You always need to create the following three classes within
your backend file.
Import everything from the
copr_rebuild_tools package that you will need
from copr_rebuild_tools import Backend, CoprBackend, Entity
First you need to create your own descendant of
Entity class. It will represent one module/gem/package from the backend.
While creating objects from your entity, you can pass all parameters as kwargs to the constructor.
No naming conventions are required.
class MyEntity(Entity): name = ...
Next, you will need to implement
Foo class. It will serve for getting information from the backend. For basic functionality
it is necessary to implement the
get_all method which returns list of individual modules/gems/packages as
class Foo(Backend): def get_all(self): pass
Last, you will need to implement
CoprFoo class which will communicate with Copr service. For basic functionality it is
required to implement
submit method which takes an instance of
MyEntity and submits its build into Copr.
class CoprFoo(CoprBackend): def submit(self, entity): pass
You will need to implement
pkgname property to generate proper package name according to
Fedora packaging guidelines.
class MyEntity(...): @property def pkgname(self): pass ...
You will need to pass entity version while its initialization or implement a property to obtaining it on the fly.
class MyEntity(...): version = ... ...