Refactor to store compose id to Compose model
Instead of storing compose ID to Event.compose_id and
ArtifactBuild.build_args['odcs_pulp_compose_id'], this patch stores
compose IDs to Compose model and build the relationship to each
ArtifactBuild. This is flexible for adding more composes, for example,
a base image requires a compose containing boot.iso but other images
don't.
Major changes
* ErrataAdvisoryRPMsSignedHandler._prepare_yum_repo is refactored and
now it returns the requested new compose instead of storing into
database directly.
* ErrataAdvisoryRPMsSignedHandler._record_batches is updated to store
pulp compose id to Compose instead of
ArtifactBuild.build_args['odcs_pulp_compose_id'].
* ContainerBuildHandler.get_repo_urls now simply gathers an
ArtifactBuild's repo URLs by querying database through
ArtifactBuildCompose relationship.
* ContainerBuildHandler._build_first_batch is removed.
* In ErrataAdvisoryRPMsSignedHandler.handle, call start_to_build_images
to build first batch directly. It's simple enough, so no need of
extra call to _build_first_batch.
* ErrataAdvisoryRPMsSignedHandler._prepare_yum_repos_for_rebuilds is
updated to store composes into Compose, which are requested for
current event and dependent events. Original code was to store compose
id into dependent event's compose_id, that was actually a bug. Now, it
is fixed.
* ComposeStateChangeHandler.handle is rewritten. Start to rebuild a
image, which is in first batch, only when all composes finish. In
handle method, just call start_to_build_images with builds that can
be rebuilt.
* Some helper methods are added to models.
* Add and update tests as well.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>