summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-11-10 14:45:16 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-23 11:10:12 +0000
commitd316363b7ba57cbf5300c6cd3b4cc68fb3258d6f (patch)
treec4b674b7fcc6c4904f609e7e7694c20b125fc84a
parente5a391795aa49645d1a6033becb6a6c1f96e6fb9 (diff)
downloadpoky-d316363b7ba57cbf5300c6cd3b4cc68fb3258d6f.tar.gz
lib/oe/patch: fix handling of patches with no header
If a patch applied by a recipe has no header and we turn the recipe's source into a git tree (when PATCHTOOL = "git" or when using devtool extract / modify / upgrade), the commit message ends up consisting only of the original filename marker ("%% original patch: filename.patch"). When we come to do turn the commits back into a set of patches in extractPatches(), this first line ends up in the "Subject: " part of the file, but we were ignoring it because the line didn't start with the marker text. The end result was we weren't able to get the original patch name. Strip off any "Subject [PATCH x/y]" part before looking for the marker text to fix. This caused "devtool modify openssl" followed by "devtool update-recipe openssl" (without any changes in-between) to remove version-script.patch because that patch has no header and we weren't able to determine the original filename. (From OE-Core rev: d9971f5dc8eb7de551fd6f5e058fd24770ef5d78) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/patch.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 0332f100f1..dbefd28e67 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -428,6 +428,7 @@ class GitApplyTree(PatchTree):
428 def extractPatches(tree, startcommit, outdir, paths=None): 428 def extractPatches(tree, startcommit, outdir, paths=None):
429 import tempfile 429 import tempfile
430 import shutil 430 import shutil
431 import re
431 tempdir = tempfile.mkdtemp(prefix='oepatch') 432 tempdir = tempfile.mkdtemp(prefix='oepatch')
432 try: 433 try:
433 shellcmd = ["git", "format-patch", startcommit, "-o", tempdir] 434 shellcmd = ["git", "format-patch", startcommit, "-o", tempdir]
@@ -443,10 +444,13 @@ class GitApplyTree(PatchTree):
443 try: 444 try:
444 with open(srcfile, 'r', encoding=encoding) as f: 445 with open(srcfile, 'r', encoding=encoding) as f:
445 for line in f: 446 for line in f:
446 if line.startswith(GitApplyTree.patch_line_prefix): 447 checkline = line
448 if checkline.startswith('Subject: '):
449 checkline = re.sub(r'\[.+?\]\s*', '', checkline[9:])
450 if checkline.startswith(GitApplyTree.patch_line_prefix):
447 outfile = line.split()[-1].strip() 451 outfile = line.split()[-1].strip()
448 continue 452 continue
449 if line.startswith(GitApplyTree.ignore_commit_prefix): 453 if checkline.startswith(GitApplyTree.ignore_commit_prefix):
450 continue 454 continue
451 patchlines.append(line) 455 patchlines.append(line)
452 except UnicodeDecodeError: 456 except UnicodeDecodeError: