From: Martin Quinson Date: Mon, 15 Oct 2018 11:09:19 +0000 (+0200) Subject: Further hack the XML parser to accept the old DTD location X-Git-Tag: v3_22~891 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/eb572c751bc0ccb16398e5bf9df44e36ef5674e9 Further hack the XML parser to accept the old DTD location --- diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 6ab51fd392..628e0786ff 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -1090,6 +1090,7 @@ set(CMAKE_SOURCE_FILES tools/cmake/Modules/FindRngStream.cmake tools/cmake/Modules/FindValgrind.cmake tools/cmake/Option.cmake + tools/cmake/scripts/fixup_simgrid_dtd_l.pl tools/cmake/scripts/my_valgrind.pl tools/cmake/scripts/update_tesh.pl tools/cmake/UnitTesting.cmake diff --git a/tools/cmake/MaintainerMode.cmake b/tools/cmake/MaintainerMode.cmake index 9d746164c4..ead60a71fd 100644 --- a/tools/cmake/MaintainerMode.cmake +++ b/tools/cmake/MaintainerMode.cmake @@ -178,8 +178,8 @@ if(enable_maintainer_mode AND NOT WIN32) #${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid_dtd.l: ${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid.dtd COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_HOME_DIRECTORY}/src/surf/xml COMMAND ${FLEXML_EXE} --root-tags platform -b 1000000 -P surfxml --sysid=https://simgrid.org/simgrid.dtd -S src/surf/xml/simgrid_dtd.l -L src/surf/xml/simgrid.dtd - COMMAND ${SED_EXE} -i ${string14} src/surf/xml/simgrid_dtd.l - COMMAND ${SED_EXE} -i "'s/FAIL(\"Bad declaration %s.\",yytext)/FAIL(\"Bad declaration %s.\\\\nIf your are using a XML v3 file (check the version attribute in ), please update it with tools\\/simgrid_update_xml.pl\",yytext)/'" src/surf/xml/simgrid_dtd.l + COMMAND ${PERL_EXE} ${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/fixup_simgrid_dtd_l.pl < src/surf/xml/simgrid_dtd.l > src/surf/xml/simgrid_dtd.l.tmp + COMMAND mv src/surf/xml/simgrid_dtd.l.tmp src/surf/xml/simgrid_dtd.l COMMAND ${CMAKE_COMMAND} -E echo " Generated src/surf/xml/simgrid_dtd.l" #${CMAKE_HOME_DIRECTORY}/src/simdag/dax_dtd.l: ${CMAKE_HOME_DIRECTORY}/src/simdag/dax.dtd @@ -208,10 +208,6 @@ if(enable_maintainer_mode AND NOT WIN32) COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid_dtd.c COMMAND ${FLEX_EXE} -o src/surf/xml/simgrid_dtd.c -Psurf_parse_ --noline src/surf/xml/simgrid_dtd.l COMMAND ${SED_EXE} -i ${string9} src/surf/xml/simgrid_dtd.c - COMMAND ${SED_EXE} -i 's/int yyl\;/unsigned int yyl\;/' src/surf/xml/simgrid_dtd.c - COMMAND ${SED_EXE} -i 's/int surf_parse_leng\;/unsigned int surf_parse_leng\;/' src/surf/xml/simgrid_dtd.c - COMMAND ${SED_EXE} -i 's/n = 0\; n < max_size/n = 0\; n < (size_t) max_size/' src/surf/xml/simgrid_dtd.c - COMMAND ${SED_EXE} -i "s/register //" src/surf/xml/simgrid_dtd.c COMMAND ${CMAKE_COMMAND} -E echo " Generated surf/xml/simgrid_dtd.c" #simdag/dax_dtd.c: simdag/dax_dtd.l @@ -219,8 +215,6 @@ if(enable_maintainer_mode AND NOT WIN32) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_HOME_DIRECTORY}/src/simdag COMMAND ${FLEX_EXE} -o src/simdag/dax_dtd.c -Pdax_ --noline src/simdag/dax_dtd.l COMMAND ${SED_EXE} -i ${string9} src/simdag/dax_dtd.c - COMMAND ${SED_EXE} -i 's/int yyl\;/unsigned int yyl\;/' src/simdag/dax_dtd.c - COMMAND ${SED_EXE} -i 's/int dax_leng\;/unsigned int dax_leng\;/' src/simdag/dax_dtd.c COMMAND ${CMAKE_COMMAND} -E echo " Generated src/simdag/dax_dtd.c" WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY} diff --git a/tools/cmake/scripts/fixup_simgrid_dtd_l.pl b/tools/cmake/scripts/fixup_simgrid_dtd_l.pl new file mode 100755 index 0000000000..5e2aa770a0 --- /dev/null +++ b/tools/cmake/scripts/fixup_simgrid_dtd_l.pl @@ -0,0 +1,18 @@ +#! /usr/bin/env perl +use strict; + +while (<>) { + # Skip the line " * Generated 2018/10/15 12:32:06." (Reproducible Builds) + next if (m#^ \* Generated [0-9/]* [0-9:]*#); + + # Informative error message for files using a very old DTD + s#"Bad declaration %s."#"Bad declaration %s.\\nIf your are using a XML v3 file (check the version attribute in ), please update it with tools/simgrid_update_xml.pl"#; + + # Accept the alternative DTD location + if (/DOCTYPE.*simgrid.org.simgrid.dtd/) { + print ' "" SET(ROOT_surfxml_platform);'."\n"; + } + + # Actually outputs the resulting line + print; +}