diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2015-03-13 13:04:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-20 11:21:25 +0000 |
commit | be6289f4af5a2dbd325da6cf92e1a4793cf75886 (patch) | |
tree | 26a71f2ca7f5595c577f2ef76bb8234aec8a35bc | |
parent | b4e78cf6df8a2f42979e22a4dd95ecd53b78c906 (diff) | |
download | ast2050-yocto-poky-be6289f4af5a2dbd325da6cf92e1a4793cf75886.zip ast2050-yocto-poky-be6289f4af5a2dbd325da6cf92e1a4793cf75886.tar.gz |
combo-layer-hook-default.sh: handle patches without Signed-off-by
Inserting the "From rev" comment depended on having at least one
Signed-off-by line in the patch header. Some old repository commits in
openembedded-core and bitbake do not have those.
When inporting those, just insert at the end of the patch
header. While doing so, ensure that there's exactly one blank line
since the last non-blank line.
(From OE-Core rev: 58548081b15f37452b71c135d5aa8cbbda5b1b61)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/combo-layer-hook-default.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/combo-layer-hook-default.sh b/scripts/combo-layer-hook-default.sh index 46f2b70..1e3a3b9 100755 --- a/scripts/combo-layer-hook-default.sh +++ b/scripts/combo-layer-hook-default.sh @@ -10,4 +10,11 @@ rev=$2 reponame=$3 sed -i -e "0,/^Subject:/s#^Subject: \[PATCH\] \($reponame: \)*\(.*\)#Subject: \[PATCH\] $reponame: \2#" $patchfile -sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\($reponame rev: $rev\)\n\n\1#" $patchfile +if grep -q '^Signed-off-by:' $patchfile; then + # Insert before Signed-off-by. + sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\(From $reponame rev: $rev\)\n\n\1#" $patchfile +else + # Insert before final --- separator, with extra blank lines removed. + perl -e "\$_ = join('', <>); s/^(.*\S[ \t]*)(\n|\n\s*\n)---\n/\$1\n\nFrom $reponame rev: $rev\n---\n/s; print;" $patchfile >$patchfile.tmp + mv $patchfile.tmp $patchfile +fi |