summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
diff options
context:
space:
mode:
authorPuustinen, Ismo <ismo.puustinen@intel.com>2015-07-03 14:36:15 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-08 00:01:22 +0100
commitdaec53e9772b48bd11b3a0b900f0fcb32b687df3 (patch)
treefb5349048c8efcc14b48118d8fe64b1f72ea06d6 /scripts/combo-layer
parent8a0cb22f859b145f0f0ce775e6ac07004b7847e4 (diff)
downloadpoky-daec53e9772b48bd11b3a0b900f0fcb32b687df3.tar.gz
combo-layer: modified to generate better commit messages.
This patch includes support for a global section in combo-layer.conf called [combo-layer-settings]. Supported in this section is key "commit_msg"; its value is the template for the git commit message that updates the last_revision. The template can include substitution for the updated component list: ${components}. The substituted value will either be a comma-separated list of components or "all components", if combo-layer was invoked without component list argument. If the key is not present, the old default value is used for the commit message. Configuration file example: [combo-layer-settings] commit_msg = pulled in the latest changes for ${components}. (From OE-Core rev: fe84747f961772b61031af59d44e54b178148379) Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer33
1 files changed, 30 insertions, 3 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 4029d2bff8..2d100bebdf 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -29,6 +29,7 @@ import tempfile
29import ConfigParser 29import ConfigParser
30import re 30import re
31from collections import OrderedDict 31from collections import OrderedDict
32from string import Template
32 33
33__version__ = "0.2.1" 34__version__ = "0.2.1"
34 35
@@ -77,15 +78,27 @@ class Configuration(object):
77 value = getattr(parser, 'get' + types[name])(section, name) 78 value = getattr(parser, 'get' + types[name])(section, name)
78 self.repos[repo][name] = value 79 self.repos[repo][name] = value
79 80
81 def readglobalsection(parser, section):
82 for (name, value) in parser.items(section):
83 if name == "commit_msg":
84 self.commit_msg_template = value
85
80 logger.debug("Loading config file %s" % self.conffile) 86 logger.debug("Loading config file %s" % self.conffile)
81 self.parser = ConfigParser.ConfigParser() 87 self.parser = ConfigParser.ConfigParser()
82 with open(self.conffile) as f: 88 with open(self.conffile) as f:
83 self.parser.readfp(f) 89 self.parser.readfp(f)
84 90
91 # initialize default values
92 self.commit_msg_template = "Automatic commit to update last_revision"
93
85 self.repos = {} 94 self.repos = {}
86 for repo in self.parser.sections(): 95 for repo in self.parser.sections():
87 self.repos[repo] = {} 96 if repo == "combo-layer-settings":
88 readsection(self.parser, repo, repo) 97 # special handling for global settings
98 readglobalsection(self.parser, repo)
99 else:
100 self.repos[repo] = {}
101 readsection(self.parser, repo, repo)
89 102
90 # Load local configuration, if available 103 # Load local configuration, if available
91 self.localconffile = None 104 self.localconffile = None
@@ -715,7 +728,21 @@ def action_update(conf, args):
715 if output: 728 if output:
716 logger.info("Committing updated configuration file") 729 logger.info("Committing updated configuration file")
717 if output.lstrip().startswith("M"): 730 if output.lstrip().startswith("M"):
718 runcmd('git commit -m "Automatic commit to update last_revision" %s' % relpath) 731
732 # create the "components" string
733 component_str = "all components"
734 if len(components) > 0:
735 # otherwise tell which components were actually changed
736 component_str = ", ".join(components)
737
738 # expand the template with known values
739 template = Template(conf.commit_msg_template)
740 raw_msg = template.substitute(components = component_str)
741
742 # sanitize the string before using it in command line
743 msg = raw_msg.replace('"', '\\"')
744
745 runcmd('git commit -m "%s" %s' % (msg, relpath))
719 746
720def apply_patchlist(conf, repos): 747def apply_patchlist(conf, repos):
721 """ 748 """