From: Neil Horman <nhorman@tuxdriver.com>
To: dev@dpdk.org
Cc: Neil Horman <nhorman@tuxdriver.com>,
thomas@monjalon.net, john.mcnamara@intel.com,
bruce.richardson@intel.com, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH] checkpatches.sh: Add checks for ABI symbol addition
Date: Mon, 15 Jan 2018 14:05:45 -0500 [thread overview]
Message-ID: <20180115190545.25687-1-nhorman@tuxdriver.com> (raw)
Recently, some additional patches were added to allow for programmatic
marking of C symbols as experimental. The addition of these markers is
dependent on the manual addition of exported symbols to the EXPERIMENTAL
section of the corresponding libraries version map file. The consensus
on review is that, in addition to mandating the addition of symbols to
the EXPERIMENTAL version in the map, we need a mechanism to enforce our
documented process of mandating that addition when they are introduced.
To that end, I am proposing this change. It is an addition to the
checkpatches script, which scan incoming patches for additions and
removals of symbols to the map file, and warns the user appropriately
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: thomas@monjalon.net
CC: john.mcnamara@intel.com
CC: bruce.richardson@intel.com
CC: Ferruh Yigit <ferruh.yigit@intel.com>
---
devtools/checkpatches.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 88 insertions(+), 1 deletion(-)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 7676a6b50..d0e2120fe 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -61,6 +61,77 @@ print_usage () {
END_OF_HELP
}
+build_map_changes()
+{
+ local fname=$1
+ local mapdb=$2
+
+ cat $fname | filterdiff -i *.map | awk '
+ BEGIN {map="";sym="";ar="";sec=""; in_sec=0}
+ /[-+] a\/.*\.map/ {map=$2}
+ /+.*{/ {gsub("+","");sec=$1; in_sec=1}
+ /.*}/ {in_sec=0}
+ /^+.*[^:*];/ {gsub(";","");sym=$2;
+ if (in_sec == 1) {
+ print map " " sym " " sec " add"
+ }
+ }
+ /^-.*[^:*];/ {gsub(";","");sym=$2;
+ if (in_sec == 1) {
+ print map " " sym " " sec " del"
+ }
+ }' > ./$mapdb
+
+ sort $mapdb | uniq > ./$mapdb.2
+ mv -f $mapdb.2 $mapdb
+
+}
+
+check_for_rule_violations()
+{
+ local mapdb=$1
+ local mname
+ local symname
+ local secname
+ local ar
+
+ cat $mapdb | while read mname symname secname ar
+ do
+ if [ "$ar" == "add" -a "$secname" != "EXPERIMENTAL" ]
+ then
+ # Symbols that are getting added in a section other
+ # Than the experimental section need to be moving
+ # from an already supported section or its a violation
+ grep -q "$mname $symname [^EXPERIMENTAL] del" $mapdb
+ if [ $? -ne 0 ]
+ then
+ echo "ERROR: symbol $symname is added in a section other than the EXPERIMENTAL section of the version map"
+ fi
+ fi
+
+ if [ "$ar" == "del" -a "$secname" != "EXPERIMENTAL" ]
+ then
+ # Just inform users that non-experimenal symbols need
+ # to go through a deprecation process
+ echo "INFO: symbol $symname is being removed, ensure that it has gone through the deprecation process"
+ fi
+
+ done
+}
+
+validate_api_changes()
+{
+ mapfile=`mktemp mapdb.XXXXXX`
+ patch=$1
+
+ build_map_changes $patch $mapfile
+ result=$(check_for_rule_violations $mapfile)
+
+ rm -f $mapfile
+
+ echo $result
+}
+
number=0
quiet=false
verbose=false
@@ -96,9 +167,25 @@ check () { # <patch> <commit> <title>
else
report=$($DPDK_CHECKPATCH_PATH $options - 2>/dev/null)
fi
- [ $? -ne 0 ] || return 0
+ reta=$?
+
$verbose || printf '\n### %s\n\n' "$3"
printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
+
+ echo
+ echo "Checking API additions/removals:"
+ if [ -n "$1" ] ; then
+ report=$(validate_api_changes $1)
+ elif [ -n "$2" ] ; then
+ report=$(git format-patch \
+ --find-renames --no-stat --stdout -1 $commit |
+ validate_api_changes /dev/stdin)
+ else
+ report=$(validate_api_changes /dev/stdin)
+ fi
+ [ $? -ne 0 -o $reta -ne 0 ] || return 0
+ printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
+
status=$(($status + 1))
}
--
2.14.3
next reply other threads:[~2018-01-15 19:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 19:05 Neil Horman [this message]
2018-01-15 21:52 ` Thomas Monjalon
2018-01-16 0:37 ` Neil Horman
2018-01-15 22:20 ` Stephen Hemminger
2018-01-16 0:36 ` Neil Horman
2018-01-16 18:22 ` [dpdk-dev] [PATCH v2] " Neil Horman
2018-01-21 20:29 ` Thomas Monjalon
2018-01-22 1:54 ` Neil Horman
2018-01-22 2:05 ` Thomas Monjalon
2018-01-31 17:27 ` [dpdk-dev] [PATCH v3] " Neil Horman
2018-02-04 14:44 ` Thomas Monjalon
2018-02-05 17:29 ` [dpdk-dev] [PATCH v4] " Neil Horman
2018-02-05 17:57 ` Thomas Monjalon
2018-02-09 15:21 ` [dpdk-dev] [PATCH v5] " Neil Horman
2018-02-13 22:57 ` Thomas Monjalon
2018-02-14 19:19 ` [dpdk-dev] [PATCH v6] " Neil Horman
2018-05-27 19:34 ` Thomas Monjalon
2018-05-27 21:00 ` Neil Horman
2018-05-27 22:01 ` Thomas Monjalon
2018-05-28 17:08 ` Neil Horman
2018-06-05 12:21 ` [dpdk-dev] [PATCH v7] " Neil Horman
2018-06-14 13:30 ` [dpdk-dev] [PATCH v8] " Neil Horman
2018-06-25 23:04 ` Thomas Monjalon
2018-06-27 17:58 ` Neil Horman
2018-06-27 18:01 ` [dpdk-dev] [PATCH v9] " Neil Horman
2018-07-15 23:12 ` Thomas Monjalon
2018-08-14 3:53 ` Rao, Nikhil
2018-08-14 11:04 ` Neil Horman
2018-08-15 6:10 ` Nikhil Rao
2018-08-15 10:48 ` Neil Horman
2018-08-16 6:19 ` Rao, Nikhil
2018-08-16 10:42 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180115190545.25687-1-nhorman@tuxdriver.com \
--to=nhorman@tuxdriver.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=john.mcnamara@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).