~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# pylint: disable-msg=E0211,E0213

"""DistroSeriesParent interface."""

__metaclass__ = type

__all__ = [
    'IDistroSeriesParent',
    'IDistroSeriesParentSet',
    ]

from lazr.restful.fields import Reference
from zope.interface import Interface
from zope.schema import (
    Int,
    Bool,
    )

from canonical.launchpad import _
from lp.registry.interfaces.distroseries import IDistroSeries


class IDistroSeriesParent(Interface):
    """`DistroSeriesParent` interface."""

    id = Int(title=_('ID'), required=True, readonly=True)

    derived_series = Reference(
        IDistroSeries, title=_("Derived Series"), required=True,
        description=_("The derived distribution series."))

    parent_series = Reference(
        IDistroSeries, title=_("Parent Series"), required=True,
        description=_("The parent distribution series."))

    initialized = Bool(
        title=_("Initialized"), required=True,
        description=_(
            "Whether or not the derived_series has been populated with "
            "packages from its parent_series."))


class IDistroSeriesParentSet(Interface):
    """`DistroSeriesParentSet` interface."""

    def new(derived_series, parent_series, initialized):
        """Create a new `DistroSeriesParent`."""

    def getByDerivedSeries(derived_series):
        """Get the `DistroSeriesParent` by derived series.

        :param derived_series: An `IDistroseries`
        """

    def getByParentSeries(parent_series):
        """Get the `DistroSeriesParent` by parent series.

        :param parent_series: An `IDistroseries`
        """