Statistics
| Branch: | Tag: | Revision:

root / devflow / __init__.py @ 18a2af6d

History | View | Annotate | Download (2.9 kB)

1 c181882a Christos Stavrakakis
# Copyright 2012, 2013 GRNET S.A. All rights reserved.
2 c181882a Christos Stavrakakis
#
3 c181882a Christos Stavrakakis
# Redistribution and use in source and binary forms, with or
4 c181882a Christos Stavrakakis
# without modification, are permitted provided that the following
5 c181882a Christos Stavrakakis
# conditions are met:
6 c181882a Christos Stavrakakis
#
7 c181882a Christos Stavrakakis
#   1. Redistributions of source code must retain the above
8 c181882a Christos Stavrakakis
#      copyright notice, this list of conditions and the following
9 c181882a Christos Stavrakakis
#      disclaimer.
10 c181882a Christos Stavrakakis
#
11 c181882a Christos Stavrakakis
#   2. Redistributions in binary form must reproduce the above
12 c181882a Christos Stavrakakis
#      copyright notice, this list of conditions and the following
13 c181882a Christos Stavrakakis
#      disclaimer in the documentation and/or other materials
14 c181882a Christos Stavrakakis
#      provided with the distribution.
15 c181882a Christos Stavrakakis
#
16 c181882a Christos Stavrakakis
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 c181882a Christos Stavrakakis
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 c181882a Christos Stavrakakis
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 c181882a Christos Stavrakakis
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 c181882a Christos Stavrakakis
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 c181882a Christos Stavrakakis
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 c181882a Christos Stavrakakis
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 c181882a Christos Stavrakakis
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 c181882a Christos Stavrakakis
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 c181882a Christos Stavrakakis
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 c181882a Christos Stavrakakis
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 c181882a Christos Stavrakakis
# POSSIBILITY OF SUCH DAMAGE.
28 c181882a Christos Stavrakakis
#
29 c181882a Christos Stavrakakis
# The views and conclusions contained in the software and
30 c181882a Christos Stavrakakis
# documentation are those of the authors and should not be
31 c181882a Christos Stavrakakis
# interpreted as representing official policies, either expressed
32 c181882a Christos Stavrakakis
# or implied, of GRNET S.A.
33 c181882a Christos Stavrakakis
34 4a45f70c Christos Stavrakakis
"""A set of tools to ease versioning and use of git flow"""
35 c181882a Christos Stavrakakis
36 c181882a Christos Stavrakakis
from collections import namedtuple
37 c181882a Christos Stavrakakis
38 c181882a Christos Stavrakakis
# Branch types:
39 c181882a Christos Stavrakakis
# builds_snapshot: Whether the branch can produce snapshot builds
40 c181882a Christos Stavrakakis
# builds_release: Whether the branch can produce release builds
41 c181882a Christos Stavrakakis
# versioned: Whether the name of the branch defines a specific version
42 c181882a Christos Stavrakakis
# allowed_version_re: A regular expression describing allowed values for
43 c181882a Christos Stavrakakis
#                     base_version in this branch
44 c181882a Christos Stavrakakis
branch_type = namedtuple("branch_type", ["builds_snapshot", "builds_release",
45 05e156a6 Christos Stavrakakis
                                         "versioned", "allowed_version_re",
46 05e156a6 Christos Stavrakakis
                                         "debian_branch"])
47 c181882a Christos Stavrakakis
VERSION_RE = "[0-9]+\.[0-9]+(\.[0-9]+)*"
48 c181882a Christos Stavrakakis
BRANCH_TYPES = {
49 05e156a6 Christos Stavrakakis
    "feature": branch_type(True, False, False, "^%snext$" % VERSION_RE,
50 05e156a6 Christos Stavrakakis
                          "debian-develop"),
51 05e156a6 Christos Stavrakakis
    "develop": branch_type(True, False, False, "^%snext$" % VERSION_RE,
52 05e156a6 Christos Stavrakakis
                           "debian-develop"),
53 c181882a Christos Stavrakakis
    "release": branch_type(True, True, True,
54 05e156a6 Christos Stavrakakis
                           "^(?P<bverstr>%s)rc[1-9][0-9]*$" % VERSION_RE,
55 05e156a6 Christos Stavrakakis
                           "debian-develop"),
56 e6eede99 Christos Stavrakakis
    "master": branch_type(True, True, False,
57 05e156a6 Christos Stavrakakis
                          "^%s$" % VERSION_RE, "debian"),
58 c181882a Christos Stavrakakis
    "hotfix": branch_type(True, True, True,
59 05e156a6 Christos Stavrakakis
                          "^(?P<bverstr>^%s\.[1-9][0-9]*)$" % VERSION_RE,
60 05e156a6 Christos Stavrakakis
                          "debian")}
61 c181882a Christos Stavrakakis
BASE_VERSION_FILE = "version"