git --no-pager diff
exit $(git diff | wc -l)
working_directory: ~/project
+ - run:
+ name: Check Makefile.am SOURCES sort order
+ command: |
+ exitcode=0
+ for f in $(find . -type f -name 'Makefile.am'); do
+ ./build-scripts/test-sources-sorted.py ${f}
+ if [ $? -ne 0 ]; then
+ exitcode=1
+ fi
+ done
+ exit ${exitcode}
build-auth:
docker:
--- /dev/null
+#!/usr/bin/env python3
+
+import re
+import sys
+
+REGEX = re.compile(r'(?s)[a-z0-9][a-z0-9_]+_SOURCES ?= ?\\.*?^$', re.MULTILINE)
+
+
+def test_sources(fname) -> int:
+ text = ""
+ with open(fname, mode="r") as f:
+ text = f.read()
+
+ matches = re.findall(REGEX, text)
+ ret = 0
+ for match in matches:
+ lines = match.split(" \\\n\t")
+ elem = lines[0].rstrip(' =')
+ lines = lines[1:]
+ sorted_lines = sorted(lines)
+
+ if sorted_lines != lines:
+ ret = 1
+ print(f'Source files for {elem} in {fname} is not sorted properly'
+ .format(elem=elem, fname=fname))
+ return ret
+
+
+if __name__ == "__main__":
+ sys.exit(test_sources(sys.argv[1]))