summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-03-22 17:15:05 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-23 12:13:08 (GMT)
commitab69a16b21d0ce81458f6d3e6821e1800ee19a7c (patch)
treecb7375c3795cb44a576bb691e4a8c03550ed42cf /scripts/combo-layer
parentfd3f7d5d6a6fd0c08f34e9eecfed6f9689e44e85 (diff)
downloadpoky-ab69a16b21d0ce81458f6d3e6821e1800ee19a7c.tar.gz
scripts/combo-layer: handle diffs in commit messages
A few recent commits in the OE-Core repository contain diffs in their commit messages, which totally confuses git-am when applying them to the combo repository during update. Add some code to detect and indent any diff text in the commit message so that this does not happen (and show a warning). (From OE-Core rev: 6e70c95dc69be6708c3bc231cc2a99eac1360815) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 3612323..73d61cc 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -144,6 +144,43 @@ def check_repo_clean(repodir):
144 logger.error("git repo %s is dirty, please fix it first", repodir) 144 logger.error("git repo %s is dirty, please fix it first", repodir)
145 sys.exit(1) 145 sys.exit(1)
146 146
147def check_patch(patchfile):
148 f = open(patchfile)
149 ln = f.readline()
150 of = None
151 in_patch = False
152 beyond_msg = False
153 pre_buf = ''
154 while ln:
155 if not beyond_msg:
156 if ln == '---\n':
157 if not of:
158 break
159 in_patch = False
160 beyond_msg = True
161 elif ln.startswith('--- '):
162 # We have a diff in the commit message
163 in_patch = True
164 if not of:
165 print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile)
166 of = open(patchfile + '.tmp', 'w')
167 of.write(pre_buf)
168 pre_buf = ''
169 elif in_patch and not ln[0] in '+-@ \n\r':
170 in_patch = False
171 if of:
172 if in_patch:
173 of.write(' ' + ln)
174 else:
175 of.write(ln)
176 else:
177 pre_buf += ln
178 ln = f.readline()
179 f.close()
180 if of:
181 of.close()
182 os.rename(patchfile + '.tmp', patchfile)
183
147def action_update(conf, args): 184def action_update(conf, args):
148 """ 185 """
149 update the component repos 186 update the component repos
@@ -227,6 +264,7 @@ def action_update(conf, args):
227 count=len(revlist)-1 264 count=len(revlist)-1
228 for patch in patchlist: 265 for patch in patchlist:
229 f.write("%s %s\n" % (patch, revlist[count])) 266 f.write("%s %s\n" % (patch, revlist[count]))
267 check_patch(os.path.join(patch_dir, patch))
230 count=count-1 268 count=count-1
231 f.close() 269 f.close()
232 270