1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
From da7a349f731714b4a7ee98974e1d0979308b4abb Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Tue, 15 Aug 2017 16:56:45 -0400
Subject: [PATCH] spp: only return files that match KMACHINE and KTYPE
The search utility of spp was incorrect and was returning files
that matched only a defined ktype.
This leads to the system potentially building the wrong BSP, and
not being able to report an error.
We fix the search to only return files that match both ktype and
kmachine, as well as return 0/1 for success/fail in the search.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
tools/spp | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/git/tools/spp b/git/tools/spp
index 4345a0d..7155166 100755
--- a/git/tools/spp
+++ b/git/tools/spp
@@ -178,7 +178,7 @@ search_includes_for_defines()
done
if [ -n "${verbose}" ]; then
- echo "checking $scc ($score)" >&2
+ >&2 echo "checking $scc ($score)" >&2
fi
if [ $score -gt $max_score ]; then
@@ -189,11 +189,17 @@ search_includes_for_defines()
fi
done
- # return the first target found (among equals)
- rstring="$(echo $found_scc | cut -f2 -d' ')"
+ if [ -n "${verbose}" ]; then
+ >&2 echo "score: $max_score"
+ fi
- # .. and add the score
- echo "$rstring:$max_score"
+ if [ $max_score -gt 0 ]; then
+ # return the first target found (among equals)
+ rstring="$(echo $found_scc | cut -f2 -d' ')"
+
+ # .. and add the score
+ echo "$rstring:$max_score"
+ fi
}
search_include_paths()
@@ -306,7 +312,7 @@ if [ -n "${do_find}" ]; then
fi
# are we looking for a machine/kernel match ?
- if [ -n"${KMACHINE}" ] && [ -n "${KTYPE}" ]; then
+ if [ -n "${KMACHINE}" ] && [ -n "${KTYPE}" ]; then
found=$(search_includes_for_defines ${KMACHINE})
found_file=$(echo $found | cut -d: -f1)
found_score=$(echo $found | cut -d: -f2)
@@ -317,11 +323,17 @@ if [ -n "${do_find}" ]; then
found=$(search_includes_for_defines ${KMACHINE}:${KTYPE})
found_file2=$(echo $found | cut -d: -f1)
found_score2=$(echo $found | cut -d: -f2)
+
if [ "${found_score2}" == "2" ]; then
found_file=${found_file2}
found_score=${found_score2}
fi
- echo "${found_file}"
+
+ if [ -n "${found_file}" ]; then
+ echo "${found_file}"
+ else
+ exit 1
+ fi
fi
# or are we looking for a file in particular ?
--
2.7.4
|