Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix platform issues with md5sum utility #4077

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ jobs:

- name: Ensure generated grammar files are up to date
run: |
cat src/antlr4/keywords.txt src/antlr4/Cypher.g4 | md5sum > tmphashfile
python3 scripts/antlr4/hash.py src/antlr4/keywords.txt src/antlr4/Cypher.g4 > tmphashfile
cmp tmphashfile scripts/antlr4/hash.md5
rm tmphashfile
Expand Down
12 changes: 3 additions & 9 deletions scripts/antlr4/generate_grammar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
# This is to make sure clean build from source needn't have Java installed.
# We can't use checksums because of windows line ending normalization.

find_package(Python3 REQUIRED COMPONENTS Interpreter)


file(READ hash.md5 OLDHASH)
execute_process(
COMMAND cat ${ROOT_DIR}/src/antlr4/keywords.txt ${ROOT_DIR}/src/antlr4/Cypher.g4
COMMAND md5sum OUTPUT_VARIABLE NEWHASH
RESULTS_VARIABLE RESVAR
ERROR_VARIABLE ERRVAR)

if(NOT "${RESVAR}" STREQUAL "0 0")
message(DEBUG "${ERRVAR}")
endif()
execute_process(
COMMAND ${Python3_EXECUTABLE} hash.py ${ROOT_DIR}/src/antlr4/keywords.txt ${ROOT_DIR}/src/antlr4/Cypher.g4 OUTPUT_VARIABLE NEWHASH)

if("${OLDHASH}" STREQUAL "${NEWHASH}")
message(DEBUG " Not regenerating grammar files as Cypher.g4 and keywords.txt is unchanged.")
Expand All @@ -35,7 +30,6 @@ endif()
file(MAKE_DIRECTORY generated)

find_package(Java REQUIRED)
find_package(Python3 REQUIRED COMPONENTS Interpreter)

# use script to generate final Cypher.g4 file and update tools/shell/include/keywords.h
execute_process(COMMAND ${Python3_EXECUTABLE} keywordhandler.py ${ROOT_DIR}/src/antlr4/Cypher.g4 ${ROOT_DIR}/src/antlr4/keywords.txt Cypher.g4 ${ROOT_DIR}/tools/shell/include/keywords.h)
Expand Down
2 changes: 1 addition & 1 deletion scripts/antlr4/hash.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e9d15715485e7edcd27e1374e1ef57cc -
e9d15715485e7edcd27e1374e1ef57cc
2 changes: 2 additions & 0 deletions scripts/antlr4/hash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import hashlib, sys
print(hashlib.md5((''.join(open(sys.argv[1])) + ''.join(open(sys.argv[2]))).encode('utf-8')).hexdigest())
Loading