summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-10-27 22:16:10 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-10-29 16:28:36 +0100
commit852f802a319e2d25cbf4e9bdf838c06f487c8a05 (patch)
tree32f218da30b05a69d4533694187cf6475f18b611
parent7fffe9763b53635d96d6e3af3b8b6b918f6217f8 (diff)
downloadpoky-852f802a319e2d25cbf4e9bdf838c06f487c8a05.tar.gz
quilt: backport a patch to address grep 3.8 failures
(From OE-Core rev: b5001af5c711a373bd2f1ea108c8b597dd40faca) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/quilt/quilt.inc1
-rw-r--r--meta/recipes-devtools/quilt/quilt/fix-grep-3.8.patch144
2 files changed, 145 insertions, 0 deletions
diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index 07611e6d85..ec69705093 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -12,6 +12,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
12 file://Makefile \ 12 file://Makefile \
13 file://test.sh \ 13 file://test.sh \
14 file://0001-tests-Allow-different-output-from-mv.patch \ 14 file://0001-tests-Allow-different-output-from-mv.patch \
15 file://fix-grep-3.8.patch \
15" 16"
16 17
17SRC_URI:append:class-target = " file://gnu_patch_test_fix_target.patch" 18SRC_URI:append:class-target = " file://gnu_patch_test_fix_target.patch"
diff --git a/meta/recipes-devtools/quilt/quilt/fix-grep-3.8.patch b/meta/recipes-devtools/quilt/quilt/fix-grep-3.8.patch
new file mode 100644
index 0000000000..68a4b4c195
--- /dev/null
+++ b/meta/recipes-devtools/quilt/quilt/fix-grep-3.8.patch
@@ -0,0 +1,144 @@
1From f73f8d7f71de2878d3f92881a5fcb8eafd78cb5f Mon Sep 17 00:00:00 2001
2From: Jean Delvare <jdelvare@suse.de>
3Date: Fri, 9 Sep 2022 10:10:37 +0200
4Subject: Avoid warnings with grep 3.8
5
6GNU grep version 3.8 became more strict about needless quoting in
7patterns. We have one occurrence of that in quilt, where "/"
8characters are being quoted by default. There are cases where they
9indeed need to be quoted (typically when used in a sed s/// command)
10but most of the time they do not, and this results in the following
11warning:
12
13grep: warning: stray \ before /
14
15So rename quote_bre() to quote_sed_re(), and introduce
16quote_grep_re() which does not quote "/".
17
18Signed-off-by: Jean Delvare <jdelvare@suse.de>
19Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/quilt.git/commit/?id=f73f8d7f71de2878d3f92881a5fcb8eafd78cb5f]
20Signed-off-by: Alexander Kanavin <alex@linutronix.de>
21---
22 quilt/diff.in | 2 +-
23 quilt/patches.in | 2 +-
24 quilt/scripts/patchfns.in | 20 +++++++++++++-------
25 quilt/upgrade.in | 4 ++--
26 4 files changed, 17 insertions(+), 11 deletions(-)
27
28diff --git a/quilt/diff.in b/quilt/diff.in
29index e90dc33..07788ff 100644
30--- a/quilt/diff.in
31+++ b/quilt/diff.in
32@@ -255,7 +255,7 @@ then
33 # Add all files in the snapshot into the file list (they may all
34 # have changed).
35 files=( $(find $QUILT_PC/$snap_subdir -type f \
36- | sed -e "s/^$(quote_bre $QUILT_PC/$snap_subdir/)//" \
37+ | sed -e "s/^$(quote_sed_re $QUILT_PC/$snap_subdir/)//" \
38 | sort) )
39 printf "%s\n" "${files[@]}" >&4
40 unset files
41diff --git a/quilt/patches.in b/quilt/patches.in
42index bb17a46..eac45a9 100644
43--- a/quilt/patches.in
44+++ b/quilt/patches.in
45@@ -60,7 +60,7 @@ scan_unapplied()
46 # Quote each file name only once
47 for file in "${opt_files[@]}"
48 do
49- files_bre[${#files_bre[@]}]=$(quote_bre "$file")
50+ files_bre[${#files_bre[@]}]=$(quote_grep_re "$file")
51 done
52
53 # "Or" all files in a single pattern
54diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
55index c2d5f9d..1bd7233 100644
56--- a/quilt/scripts/patchfns.in
57+++ b/quilt/scripts/patchfns.in
58@@ -78,8 +78,14 @@ array_join()
59 done
60 }
61
62-# Quote a string for use in a basic regular expression.
63-quote_bre()
64+# Quote a string for use in a regular expression for a grep pattern.
65+quote_grep_re()
66+{
67+ echo "$1" | sed -e 's:\([][^$.*\\]\):\\\1:g'
68+}
69+
70+# Quote a string for use in a regular expression for a sed s/// command.
71+quote_sed_re()
72 {
73 echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
74 }
75@@ -215,7 +221,7 @@ patch_in_series()
76
77 if [ -e "$SERIES" ]
78 then
79- grep -q "^$(quote_bre $patch)\([ \t]\|$\)" "$SERIES"
80+ grep -q "^$(quote_grep_re $patch)\([ \t]\|$\)" "$SERIES"
81 else
82 return 1
83 fi
84@@ -365,7 +371,7 @@ is_applied()
85 {
86 local patch=$1
87 [ -e $DB ] || return 1
88- grep -q "^$(quote_bre $patch)\$" $DB
89+ grep -q "^$(quote_grep_re $patch)\$" $DB
90 }
91
92 applied_patches()
93@@ -465,7 +471,7 @@ remove_from_db()
94 local tmpfile
95 if tmpfile=$(gen_tempfile)
96 then
97- grep -v "^$(quote_bre $patch)\$" $DB > $tmpfile
98+ grep -v "^$(quote_grep_re $patch)\$" $DB > $tmpfile
99 cat $tmpfile > $DB
100 rm -f $tmpfile
101 [ -s $DB ] || rm -f $DB
102@@ -520,7 +526,7 @@ find_patch()
103 fi
104
105 local patch=${1#$SUBDIR_DOWN$QUILT_PATCHES/}
106- local bre=$(quote_bre "$patch")
107+ local bre=$(quote_sed_re "$patch")
108 set -- $(sed -e "/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\|\.xz\|\.lzma\|\.lz\)\([ "$'\t'"]\|$\)/!d" \
109 -e 's/[ '$'\t''].*//' "$SERIES")
110 if [ $# -eq 1 ]
111@@ -631,7 +637,7 @@ files_in_patch()
112 then
113 find "$path" -type f \
114 -a ! -path "$(quote_glob "$path")/.timestamp" |
115- sed -e "s/$(quote_bre "$path")\///"
116+ sed -e "s/$(quote_sed_re "$path")\///"
117 fi
118 }
119
120diff --git a/quilt/upgrade.in b/quilt/upgrade.in
121index dbf7d05..866aa33 100644
122--- a/quilt/upgrade.in
123+++ b/quilt/upgrade.in
124@@ -74,7 +74,7 @@ printf $"Converting meta-data to version %s\n" "$DB_VERSION"
125
126 for patch in $(applied_patches)
127 do
128- proper_name="$(grep "^$(quote_bre $patch)"'\(\|\.patch\|\.diff?\)\(\|\.gz\|\.bz2\)\([ \t]\|$\)' $SERIES)"
129+ proper_name="$(grep "^$(quote_grep_re $patch)"'\(\|\.patch\|\.diff?\)\(\|\.gz\|\.bz2\)\([ \t]\|$\)' $SERIES)"
130 proper_name=${proper_name#$QUILT_PATCHES/}
131 proper_name=${proper_name%% *}
132 if [ -z "$proper_name" ]
133@@ -84,7 +84,7 @@ do
134 fi
135
136 if [ "$patch" != "$proper_name" -a -d $QUILT_PC/$patch ] \
137- && grep -q "^$(quote_bre $patch)\$" \
138+ && grep -q "^$(quote_grep_re $patch)\$" \
139 $QUILT_PC/applied-patches
140 then
141 mv $QUILT_PC/$patch $QUILT_PC/$proper_name \
142--
143cgit v1.1
144