~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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# pylint: disable-msg=E0211,E0213

"""Interfaces including common IDistroSeries and IProductSeries classes."""

__metaclass__ = type

__all__ = [
    'SeriesStatus',
    'ISeriesMixin',
    ]

from lazr.enum import (
    DBEnumeratedType,
    DBItem,
    )
from lazr.restful.declarations import exported
from lazr.restful.fields import (
    CollectionField,
    Reference,
    )
from zope.schema import Bool

from lp import _
from lp.registry.interfaces.person import IPerson
from lp.registry.interfaces.role import IHasDrivers
from lp.services.fields import (
    PublicPersonChoice,
    Summary,
    )


class SeriesStatus(DBEnumeratedType):
    """Distro/Product Series Status

    A Distro or Product series (warty, hoary, 1.4 for example) changes state
    throughout its development. This schema describes the level of
    development of the series.
    """

    EXPERIMENTAL = DBItem(1, """
        Experimental

        This series contains code that is far from active release planning or
        management.

        In the case of Ubuntu, series that are beyond the current
        "development" release will be marked as "experimental". We create
        those so that people have a place to upload code which is expected to
        be part of that distant future release, but which we do not want to
        interfere with the current development release.
        """)

    DEVELOPMENT = DBItem(2, """
        Active Development

        The series that is under active development.
        """)

    FROZEN = DBItem(3, """
        Pre-release Freeze

        When a series is near to release the administrators will freeze it,
        which typically means all changes require significant review before
        being accepted.
        """)

    CURRENT = DBItem(4, """
        Current Stable Release

        This is the latest stable release. Normally there will only
        be one of these for a given distribution.
        """)

    SUPPORTED = DBItem(5, """
        Supported

        This series is still supported, but it is no longer the current stable
        release.
        """)

    OBSOLETE = DBItem(6, """
        Obsolete

        This series is no longer supported, it is considered obsolete and
        should not be used on production systems.
        """)

    FUTURE = DBItem(7, """
        Future

        This is a future series of this product/distro in which the developers
        haven't started working yet.
        """)


class ISeriesMixin(IHasDrivers):
    """Methods & properties shared between distro & product series."""

    active = exported(Bool(
        title=_("Active"),
        description=_(
            "Whether or not this series is stable and supported, or "
            "under current development. This excludes series which "
            "are experimental or obsolete.")))

    summary = exported(
        Summary(title=_("Summary"),
             description=_('A single paragraph that explains the goals of '
                           'of this series and the intended users. '
                           'For example: "The 2.0 series of Apache '
                           'represents the current stable series, '
                           'and is recommended for all new deployments".'),
             required=True))

    drivers = exported(
        CollectionField(
            title=_(
                'A list of the people or teams who are drivers for this '
                'series. This list is made up of any drivers or owners '
                'from this series and the parent drivers.'),
            readonly=True,
            value_type=Reference(schema=IPerson)))

    bug_supervisor = CollectionField(
        title=_('Currently just a reference to the parent bug '
                'supervisor.'),
        readonly=True,
        value_type=Reference(schema=IPerson))

    security_contact = PublicPersonChoice(
        title=_('Security Contact'),
        description=_('Currently just a reference to the parent '
                      'security contact.'),
        required=False, vocabulary='ValidPersonOrTeam')