summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-05-07 10:32:40 +0200
committerDamjan Marion <dmarion@me.com>2019-05-29 09:03:24 +0000
commite4218be67141311e8999059d7f848af4c2c311df (patch)
tree155e63178c7caf6ff5ae76371a16aa22ad16f7de
parent11965c7b47670da7d02eb2c543be52008c66848e (diff)
make: git commit template
Add a commit template for tagging of commits with a type. Later tooling can then process the commit log and generate reports of new features etc. Usage: The template is automatically added to the current repository by make install-dep. (git config commit.template .git_commit_template.txt) Type: make Change-Id: I485d61f9852b7390e4f0539d737ab210f7b0723a Signed-off-by: Ole Troan <ot@cisco.com>
-rw-r--r--.git_commit_template.txt47
-rw-r--r--Makefile1
2 files changed, 48 insertions, 0 deletions
diff --git a/.git_commit_template.txt b/.git_commit_template.txt
new file mode 100644
index 00000000000..d748e02e568
--- /dev/null
+++ b/.git_commit_template.txt
@@ -0,0 +1,47 @@
+# <feature-name>: <subject>
+# |<---- Using a maximum of 50 characters ---->|
+#
+# Explain why this change is being made
+# |<---- Try to limit each line to a maximum of 72 characters ---->|
+
+# Ticket: <JIRA #id>
+# Type: <type>
+# Fixes: <offending-git-commit-id>
+# Change-Id: <sha1>
+# Signed-off-by: <email>
+#
+#
+# --- COMMIT END ---
+#
+# Type can be
+# feature (new feature)
+# fix (bug fix)
+# refactor (refactoring production code)
+# style (formatting, missing semi colons, etc; no code change)
+# docs (changes to documentation)
+# test (adding or refactoring tests; no production code change)
+# make (change the build process, or tools, or infrastructure)
+#
+# feature-name: Is the name of the VPP feature, plugin or directory.
+# Commits across multiple components should be split.
+# E.g. ip, fib, nat, acl, host, api
+#
+# Fixes: If type is fix refers to the original commit (optional).
+# Ticket: Refers to JIRA ticket if it exists (optional).
+#
+# --------------------
+# Remember to:
+# Lowercase the subject line.
+# Use the imperative mood in the subject line.
+# Not end the subject line with a period.
+# Separate subject from body with a blank line.
+# Use the body to explain what and why vs. how.
+# Use multiple lines with "-" for bullet points in body.
+# --------------------
+# Usage:
+#
+# The template is automatically added to the current repository by
+# make install-dep.
+# (git config commit.template .git_commit_template.txt)
+#
+# --------------------
diff --git a/Makefile b/Makefile
index 8a1eaa277d5..90ed59f11c0 100644
--- a/Makefile
+++ b/Makefile
@@ -321,6 +321,7 @@ else ifeq ($(filter opensuse,$(OS_ID)),$(OS_ID))
else
$(error "This option currently works only on Ubuntu, Debian, RHEL, CentOS or openSUSE systems")
endif
+ git config commit.template .git_commit_template.txt
define make
@make -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
66; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# JSON generation
import json


def walk_enums(s):
    r = []
    for e in s:
        d = []
        d.append(e.name)
        for b in e.block:
            d.append(b)
        d.append({'enumtype': e.enumtype})
        r.append(d)
    return r


def walk_services(s):
    r = {}
    for e in s:
        d = {'reply': e.reply}
        if e.stream:
            d['stream'] = True
        if e.events:
            d['events'] = e.events
        r[e.caller] = d
    return r


def walk_defs(s):
    r = []
    for t in s:
        d = []
        d.append(t.name)
        for b in t.block:
            f = []
            if b.type == 'Field':
                f = [b.fieldtype, b.fieldname]
            elif b.type == 'Array':
                if b.lengthfield:
                    f = [b.fieldtype, b.fieldname, b.length, b.lengthfield]
                else:
                    f = [b.fieldtype, b.fieldname, b.length]
            elif b.type == 'Union':
                print('UNION')
            else:
                raise ValueError("Error in processing array type %s" % b)
            d.append(f)
        if t.crc:
            c = {}
            c['crc'] = "{0:#0{1}x}".format(t.crc, 10)
            d.append(c)

        r.append(d)
    return r


#
# Plugin entry point
#
def run(filename, s, file_crc):
    j = {}

    j['types'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Typedef'])
    j['messages'] = walk_defs(s['Define'])
    j['unions'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Union'])
    j['enums'] = walk_enums([o for o in s['types'] if o.__class__.__name__ == 'Enum'])
    j['services'] = walk_services(s['Service'])
    j['vl_api_version'] = hex(file_crc)
    return json.dumps(j, indent=4, separators=(',', ': '))