40
40
build_log = Reference(build_log_id, 'LibraryFileAlias.id')
42
42
build_state = EnumCol(
43
dbName='buildstate', notNull=True, schema=BuildStatus)
43
dbName='build_state', notNull=True, schema=BuildStatus)
45
45
date_created = UtcDateTimeCol(notNull=True)
46
date_built = UtcDateTimeCol(notNull=True)
47
date_first_dispatched = UtcDateTimeCol(notNull=True)
46
date_built = UtcDateTimeCol(notNull=False)
47
date_first_dispatched = UtcDateTimeCol(notNull=False)
49
49
distroseries_id = Int(name='distroseries', allow_none=True)
50
50
distroseries = Reference(distroseries_id, 'DistroSeries.id')
55
55
recipe_id = Int(name='recipe', allow_none=False)
56
56
recipe = Reference(recipe_id, 'SourcePackageRecipe.id')
58
requester_id = Int(name='requester', allow_none=True)
58
requester_id = Int(name='requester', allow_none=False)
59
59
requester = Reference(requester_id, 'Person.id')
61
61
manifest_id = Int(name='manifest', allow_none=True)
62
62
manifest = Reference(manifest_id, '_SourcePackageRecipeData.id')
64
def __init__(self, distroseries, sourcepackagename, recipe, requester,
65
date_created=None, date_first_dispatched=None,
66
date_built=None, manifest=None, builder=None,
67
build_state=BuildStatus.NEEDSBUILD, build_log=None,
69
"""Construct a SourcePackageBuild."""
70
super(SourcePackageBuild, self).__init__()
71
self.build_duration = build_duration
72
self.build_log = build_log
73
self.builder = builder
74
self.build_state = build_state
75
self.date_built = date_built
76
self.date_created = date_created
77
self.date_first_dispatched = date_first_dispatched
78
self.distroseries = distroseries
79
self.manifest = manifest
81
self.requester = requester
82
self.sourcepackagename = sourcepackagename
85
def new(cls, sourcepackage, recipe, requester, date_created=None):
86
"""See `ISourcePackageBuildSource`."""
66
87
store = IMasterStore(SourcePackageBuild)
88
if date_created is None:
89
date_created = UTC_NOW
91
sourcepackage.distroseries,
92
sourcepackage.sourcepackagename,
95
date_created=date_created)