diff options
Diffstat (limited to 'scripts/combo-layer')
| -rwxr-xr-x | scripts/combo-layer | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 36123238b9..73d61cce4c 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 | ||
| 147 | def 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 | |||
| 147 | def action_update(conf, args): | 184 | def 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 | ||
