From 6081bd0e6f6ecd28fa2812d64c57123c66587d8b Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 25 Aug 2017 17:33:32 +0200 Subject: Use value string check from osmo-ci Change-Id: I513835be2d931d0a931cdfc996f361a451bc1a15 --- contrib/jenkins-arm.sh | 2 +- contrib/jenkins.sh | 5 ++-- .../verify_value_string_arrays_are_terminated.py | 33 ---------------------- 3 files changed, 4 insertions(+), 36 deletions(-) delete mode 100755 contrib/verify_value_string_arrays_are_terminated.py (limited to 'contrib') diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh index 510b0e9e..ad992af1 100755 --- a/contrib/jenkins-arm.sh +++ b/contrib/jenkins-arm.sh @@ -2,7 +2,7 @@ set -ex -./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") autoreconf --install --force ./configure --enable-static \ diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 6a72840d..4a26776d 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -1,8 +1,9 @@ -#!/usr/bin/env bash +#!/bin/sh +# jenkins build helper script for libosmo-sccp. This is how we build on jenkins.osmocom.org set -ex -./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") +verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") if [ "x$label" = "xFreeBSD_amd64" ]; then ENABLE_SANITIZE="" diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py deleted file mode 100755 index 020bb4dd..00000000 --- a/contrib/verify_value_string_arrays_are_terminated.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -# vim: expandtab tabstop=2 shiftwidth=2 nocin - -''' -Usage: - verify_value_string_arrays_are_terminated.py PATH [PATH [...]] - -e.g. -libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") -''' - -import re -import sys -import codecs - -value_string_array_re = re.compile( - r'((\bstruct\s+value_string\b[^{;]*?)\s*=[^{;]*{[^;]*}\s*;)', - re.MULTILINE | re.DOTALL) - -members = r'(\.(value|str)\s*=\s*)?' -terminator_re = re.compile('{\s*' + members + '(0|NULL)\s*,' - '\s*' + members + '(0|NULL)\s*}') -errors_found = 0 - -for f in sys.argv[1:]: - arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) - for array_def, name in arrays: - if not terminator_re.search(array_def): - print('ERROR: file contains unterminated value_string %r: %r' - % (name, f)) - errors_found += 1 - -sys.exit(errors_found) -- cgit v1.2.3