44
47
initialized = Bool(allow_none=False)
49
is_overlay = Bool(allow_none=False, default=False)
52
dbName='pocket', notNull=False,
53
schema=PackagePublishingPocket)
55
component_id = Int(name='component', allow_none=True)
56
component = Reference(component_id, 'Component.id')
47
59
class DistroSeriesParentSet:
48
60
"""See `IDistroSeriesParentSet`."""
49
61
implements(IDistroSeriesParentSet)
50
62
title = "Cross reference of parent and derived distroseries."
52
def new(self, derived_series, parent_series, initialized):
64
def new(self, derived_series, parent_series, initialized,
65
is_overlay=False, pocket=None, component=None):
53
66
"""Make and return a new `DistroSeriesParent`."""
54
67
store = IMasterStore(DistroSeriesParent)
55
68
dsp = DistroSeriesParent()
56
69
dsp.derived_series = derived_series
57
70
dsp.parent_series = parent_series
58
71
dsp.initialized = initialized
72
dsp.is_overlay = is_overlay
74
dsp.component = component
73
89
DistroSeriesParent,
74
90
DistroSeriesParent.parent_series_id == parent_series.id)
92
def getFlattenedOverlayTree(self, derived_series):
93
"""See `IDistroSeriesParentSet`."""
94
self.getByDerivedSeries(derived_series)
95
rec_overlay_query = '''
96
RECURSIVE t_parents(parent_series) AS (
98
FROM DistroSeriesParent
99
WHERE derived_series=? AND
102
SELECT dsp.parent_series
103
FROM DistroSeriesParent dsp, t_parents p
104
WHERE dsp.derived_series = p.parent_series AND
105
dsp.is_overlay = True
107
store = IStore(DistroSeriesParent)
108
# XXX: rvb 2011-05-20 bug=785733: Order by DSD.id for now.
109
# Once the ordering is specified in the database, it should
110
# be used to sort the results.
112
SQL(rec_overlay_query, (derived_series.id, ))).find(
114
SQL('DistroSeriesParent.parent_series IN '
115
'(SELECT parent_series FROM t_parents)')
116
).order_by(DistroSeriesParent.id)