[ismrmrd] 276/281: Now comparing a cleaning (no linebreaks or whitespace) version of the schema when hashing

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.

commit 709d79b705e9fc844d697dcb56e611020d7707a1
Author: Michael S. Hansen <michael.hansen at nih.gov>
Date:   Thu Sep 4 05:57:04 2014 -0400

    Now comparing a cleaning (no linebreaks or whitespace) version of the schema when hashing
---
 CMakeLists.txt | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 560f326..e021c56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,9 +40,19 @@ set(ISMRMRD_VERSION_MAJOR 0)
 set(ISMRMRD_VERSION_MINOR 0)
 set(ISMRMRD_VERSION_PATCH 1) 
 
-set(ISMRMRD_XML_SCHEMA_SHA1 "62d277cee06c9971b08b20974425ccbf34c0a597")
-file(SHA1 ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd ISMRMRD_CURRENT_XML_SCHEMA_SHA1)
+set(ISMRMRD_XML_SCHEMA_SHA1 "6f1ed6b9209075de481c02e66a37913d9a46b772")
 
+#Remove line breaks and white space that does not change the meaning of the schema
+file(STRINGS ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd SCHEMA_STRINGS) #Read all strings from file 
+string(REPLACE ";" "" SCHEMA_NO_BREAKS  ${SCHEMA_STRINGS}) #Concatenate the list of strings
+string(REGEX REPLACE ">[ \t]+<" "><" SCHEMA_NO_SPACE ${SCHEMA_NO_BREAKS}) #Remove spaces and tabs
+string(STRIP ${SCHEMA_NO_SPACE} SCHEMA_NO_SPACE) #Strip any leading/trailing whitespace
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd_no_white_space.xsd ${SCHEMA_NO_SPACE}) #Write to file
+
+#Now hash the cleaned up file
+file(SHA1 ${CMAKE_CURRENT_BINARY_DIR}/ismrmrd_no_white_space.xsd ISMRMRD_CURRENT_XML_SCHEMA_SHA1)
+
+#Compare to last known hash
 if (NOT (${ISMRMRD_XML_SCHEMA_SHA1} STREQUAL ${ISMRMRD_CURRENT_XML_SCHEMA_SHA1}))
   message("")
   message("-----------------------------------------------")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list