Rename to build_id, which is more accurate.

This commit is contained in:
Ralph Bean
2016-07-16 00:53:59 -04:00
parent 2871ca9537
commit 0b369baf66
3 changed files with 13 additions and 7 deletions

View File

@@ -231,7 +231,7 @@ class KojiModuleBuilder(GenericBuilder):
def build(self, artifact_name, source):
"""
:param source : scmurl to spec repository
:return koji taskid
:return koji build id
"""
if not self.__prep:
raise RuntimeError("Buildroot is not prep-ed")
@@ -239,9 +239,9 @@ class KojiModuleBuilder(GenericBuilder):
if '://' not in source:
raise NotImplementedError("Only scm url is currently supported, got source='%s'" % source)
self._koji_whitelist_packages([artifact_name,])
task_id = self.koji_session.build(source, self.module_target['name'])
print("Building %s (taskid=%s)." % (source, task_id))
return task_id
build_id = self.koji_session.build(source, self.module_target['name'])
print("Building %s (build_id=%s)." % (source, build_id))
return build_id
def _get_tag(self, tag, strict=True):
if isinstance(tag, dict):

View File

@@ -232,19 +232,25 @@ class ComponentBuild(Base):
package = Column(String, nullable=False)
# XXX: Consider making this a proper ENUM
format = Column(String, nullable=False)
task = Column(Integer)
build_id = Column(Integer) # This is the id of the build in koji
# XXX: Consider making this a proper ENUM (or an int)
state = Column(String)
module_id = Column(Integer, ForeignKey('module_builds.id'), nullable=False)
module_build = relationship('ModuleBuild', backref='component_builds', lazy=False)
@classmethod
def from_fedmsg(cls, session, msg):
if '.buildsys.build.state.change' not in msg['topic']:
raise ValueError("%r is not a koji message." % msg['topic'])
return session.query(cls).filter(cls.build_id==msg['msg']['id']).one()
def json(self):
return {
'id': self.id,
'package': self.package,
'format': self.format,
'task': self.task,
'build_id': self.build_id,
'state': self.state,
'module_build': self.module_id,
}

View File

@@ -59,5 +59,5 @@ def done(config, session, msg):
)
artifact_name = 'TODO'
component_build.state = koji.BUILD_STATES['BUILDING']
component_build.task = builder.build(artifact_name, scmurl)
component_build.build_id = builder.build(artifact_name, scmurl)
session.commit()