scripts/generate-kernel-patch: Make the patch format more standard

Make sure that both paths in the diff header have the same number of
components. This patch does not change the result of applying a patch
generated by this script.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7441 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-07-23 04:31:00 +00:00
parent 953b86a9a2
commit 30d36bbfe6

View File

@@ -48,8 +48,8 @@ function add_patch {
exit 1
fi
sed -e "s:^--- [^ ]*:--- orig/linux-${kver}/$2:" \
-e "s:^+++ [^ ]*:+++ linux-${kver}/$2:" \
sed -e "s:^--- [^ ]*:--- linux-${kver}/$2:" \
-e "s:^+++ [^ ]*:+++ linux-${kver}/$2:" \
< "$1"
}
@@ -70,8 +70,8 @@ function add_file {
# -- skip *.mod.c.
if [ "$1" = "${1%.mod.c}" ] && [ "$1" ]; then
cat <<EOF
diff -uprN orig/linux-${kver}/$2 linux-${kver}/$2
--- orig/linux-${kver}/$2
diff -uprN linux-${kver}/$2 linux-${kver}/$2
--- linux-${kver}/$2
+++ linux-${kver}/$2
@@ -0,0 +1,$(wc -l "$1" | { read -r a b; echo "$a"; echo "$b" >/dev/null; }) @@
EOF
@@ -94,8 +94,8 @@ EOF
function add_empty_file {
cat <<EOF
diff -uprN orig/linux-${kver}/$1 linux-${kver}/$1
--- orig/linux-${kver}/$1
diff -uprN linux-${kver}/$1 linux-${kver}/$1
--- linux-${kver}/$1
+++ linux-${kver}/$1
@@ -0,0 +1,1 @@
+