From 226e8e65bc378ac63af3c88bb51c0c79d5a075d1 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Tue, 22 Sep 2020 15:11:51 +0000 Subject: [PATCH] vppapigen: crcchecker: harmonize the in_progress marking The format for deprecation is "option deprecated" now, so harmonize the in-progress marking to logically be "option in_progress" At the same time recognize the legacy/erroneous types of marking, print the warning. Change-Id: If418dfadd69ffb112550164d63d13420e51cefd7 Type: fix Signed-off-by: Andrew Yourtchenko (cherry picked from commit 6a3d4cc9a11efbe73a1cda35a64c619eebde0b24) --- extras/scripts/crcchecker.py | 20 ++++++++++++++------ extras/scripts/tests/test_crcchecker.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/extras/scripts/crcchecker.py b/extras/scripts/crcchecker.py index 7929374c5c8..2b026338129 100755 --- a/extras/scripts/crcchecker.py +++ b/extras/scripts/crcchecker.py @@ -96,16 +96,24 @@ def filelist_from_patchset(): return set(filelist) def is_deprecated(d, k): - if 'options' in d[k] and 'deprecated' in d[k]['options']: - return True + if 'options' in d[k]: + if 'deprecated' in d[k]['options']: + return True + # recognize the deprecated format + if 'status' in d[k]['options'] and d[k]['options']['status'] == 'deprecated': + print("WARNING: please use 'option deprecated;'") + return True return False def is_in_progress(d, k): - try: - if d[k]['options']['status'] == 'in_progress': + if 'options' in d[k]: + if 'in_progress' in d[k]['options']: + return True + # recognize the deprecated format + if 'status' in d[k]['options'] and d[k]['options']['status'] == 'in_progress': + print("WARNING: please use 'option in_progress;'") return True - except: - return False + return False def report(new, old): added, removed, modified, same = dict_compare(new, old) diff --git a/extras/scripts/tests/test_crcchecker.sh b/extras/scripts/tests/test_crcchecker.sh index 07b6bbf7f4b..9cfc66ae523 100755 --- a/extras/scripts/tests/test_crcchecker.sh +++ b/extras/scripts/tests/test_crcchecker.sh @@ -77,6 +77,29 @@ git add crccheck.api git commit -m "deprecated api"; extras/scripts/crcchecker.py --check-patchset +echo "TEST 7.1: Verify we can delete deprecated message (old/confused style)" +cat >crccheck_dep.api <crccheck_dep.api <