MonetDB: default - improve the set of included headers
Changeset: 8a15be2dc349 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8a15be2dc349 Modified Files: monetdb5/mal/CMakeLists.txt monetdb5/mal/mal_client.h monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_resource.c monetdb5/mal/mal_session.h monetdb5/modules/kernel/alarm.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batMask.c monetdb5/modules/mal/factories.c monetdb5/modules/mal/groupby.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/orderidx.c monetdb5/modules/mal/projectionpath.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/sysmon.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/tracer.c monetdb5/modules/mal/wlc.c monetdb5/scheduler/run_isolate.c monetdb5/scheduler/run_memo.c sql/server/rel_schema.c Branch: default Log Message: improve the set of included headers diffs (268 lines): diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt --- a/monetdb5/mal/CMakeLists.txt +++ b/monetdb5/mal/CMakeLists.txt @@ -15,6 +15,7 @@ set(mal_public_headers ${CMAKE_CURRENT_SOURCE_DIR}/mal_import.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_instruction.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_linker.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_module.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_namespace.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_stack.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_type.h @@ -42,7 +43,7 @@ target_sources(mal mal_dataflow.c mal_dataflow.h mal_linker.c mal_linker.h mal_listing.c mal_listing.h - mal_module.c mal_module.h + mal_module.c mal_namespace.c mal_parser.c mal_parser.h mal_profiler.c mal_profiler.h diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h --- a/monetdb5/mal/mal_client.h +++ b/monetdb5/mal/mal_client.h @@ -11,7 +11,7 @@ #include "mal.h" -#include "mal_resolve.h" +#include "mal_module.h" #define SCENARIO_PROPERTIES 8 diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c --- a/monetdb5/mal/mal_dataflow.c +++ b/monetdb5/mal/mal_dataflow.c @@ -31,6 +31,8 @@ #include "mal_internal.h" #include "mal_runtime.h" #include "mal_resource.h" +#include "mal_exception.h" +#include "mal_function.h" #define DFLOWpending 0 /* runnable */ #define DFLOWrunning 1 /* currently in progress */ diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -19,6 +19,7 @@ #include "mal_type.h" #include "mal_private.h" #include "mal_internal.h" +#include "mal_function.h" static lng qptimeout = 0; /* how often we print still running queries (usec) */ diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c --- a/monetdb5/mal/mal_resource.c +++ b/monetdb5/mal/mal_resource.c @@ -11,6 +11,7 @@ #include "monetdb_config.h" #include "mal_resource.h" #include "mal_private.h" +#include "mal_instruction.h" /* Memory based admission does not seem to have a major impact so far. */ static lng memorypool = 0; /* memory claimed by concurrent threads */ diff --git a/monetdb5/mal/mal_session.h b/monetdb5/mal/mal_session.h --- a/monetdb5/mal/mal_session.h +++ b/monetdb5/mal/mal_session.h @@ -10,6 +10,7 @@ #define _MAL_SESSION_H #include "mal_scenario.h" +#include "mal_resolve.h" mal_export str malBootstrap(char *modules[], int embedded); mal_export str MSserveClient(Client cntxt); diff --git a/monetdb5/modules/kernel/alarm.c b/monetdb5/modules/kernel/alarm.c --- a/monetdb5/modules/kernel/alarm.c +++ b/monetdb5/modules/kernel/alarm.c @@ -25,6 +25,7 @@ #include "mal_client.h" #include "mal_interpreter.h" #include +#include "mal_exception.h" static str ALARMusec(lng *ret) diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -25,6 +25,8 @@ #include "mal_interpreter.h" #include "bat5.h" #include "gdk_time.h" +#include "mal_instruction.h" +#include "mal_exception.h" /* * BAT enhancements diff --git a/monetdb5/modules/mal/batMask.c b/monetdb5/modules/mal/batMask.c --- a/monetdb5/modules/mal/batMask.c +++ b/monetdb5/modules/mal/batMask.c @@ -16,6 +16,7 @@ #include "mal_interpreter.h" #include "bat5.h" #include "gdk_time.h" +#include "mal_exception.h" /* * BAT bitvector enhancements diff --git a/monetdb5/modules/mal/factories.c b/monetdb5/modules/mal/factories.c --- a/monetdb5/modules/mal/factories.c +++ b/monetdb5/modules/mal/factories.c @@ -15,6 +15,7 @@ #include "mal.h" #include "mal_interpreter.h" #include "mal_namespace.h" +#include "mal_exception.h" static str FCTgetPlants(bat *ret, bat *ret2) diff --git a/monetdb5/modules/mal/groupby.c b/monetdb5/modules/mal/groupby.c --- a/monetdb5/modules
MonetDB: default - first version of windows installer using cmake
Changeset: 189cae9f93f7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=189cae9f93f7 Added Files: cmake/Modules/FindCandle.cmake cmake/monetdb-wix-packages.cmake Modified Files: buildtools/conf/CMakeLists.txt clients/NT/CMakeLists.txt cmake/monetdb-custom-targets.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-packages.cmake documentation/source/cmake.rst monetdb5/NT/CMakeLists.txt sql/NT/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: default Log Message: first version of windows installer using cmake diffs (181 lines): diff --git a/buildtools/conf/CMakeLists.txt b/buildtools/conf/CMakeLists.txt --- a/buildtools/conf/CMakeLists.txt +++ b/buildtools/conf/CMakeLists.txt @@ -12,7 +12,7 @@ if(WIN32) license.rtf monetdb.ico website.html -DESTINATION ${CMAKE_INSTALL_PREFIX} +DESTINATION ${CMAKE_INSTALL_DATADIR} COMPONENT server) endif() diff --git a/clients/NT/CMakeLists.txt b/clients/NT/CMakeLists.txt --- a/clients/NT/CMakeLists.txt +++ b/clients/NT/CMakeLists.txt @@ -6,11 +6,15 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] +# These files have to be installed in the root of the project. But you +# cannot use the CMAKE_INSTALL_PREFIX variable, because the WIX +# generator does not allow for absolute install paths. That is why we use +# the "." as a relative path. if(WIN32) install(FILES mclient.bat msqldump.bat -DESTINATION ${CMAKE_INSTALL_PREFIX} +DESTINATION "." COMPONENT server) endif() diff --git a/cmake/Modules/FindCandle.cmake b/cmake/Modules/FindCandle.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindCandle.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(CANDLE_EXECUTABLE NAMES candle + DOC "Create wix packages" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Candle + DEFAULT_MSG + CANDLE_EXECUTABLE +) + +mark_as_advanced(CANDLE_EXECUTABLE) diff --git a/cmake/monetdb-custom-targets.cmake b/cmake/monetdb-custom-targets.cmake --- a/cmake/monetdb-custom-targets.cmake +++ b/cmake/monetdb-custom-targets.cmake @@ -82,3 +82,14 @@ else() COMMAND ${CMAKE_COMMAND} -E echo 'Target not available because \"dpkg-buildpackage\" was not found.') endif() + +if(CANDLE_FOUND) + add_custom_target(create-wix-packages +COMMAND +${CMAKE_CPACK_COMMAND} -G WIX -C Debug +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +else() + add_custom_target(create-wix-packages +COMMAND +${CMAKE_COMMAND} -E echo 'Target not available because \"candle\" was not found.') +endif() diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -115,5 +115,6 @@ find_package(DpkgBuildpackage) find_package(Reprepro) find_package(Semodule) find_package(Awk) +find_package(Candle) # vim: set ts=2:sw=2:et diff --git a/cmake/monetdb-packages.cmake b/cmake/monetdb-packages.cmake --- a/cmake/monetdb-packages.cmake +++ b/cmake/monetdb-packages.cmake @@ -18,6 +18,7 @@ list (APPEND CPACK_SOURCE_IGNORE_FILES " include(monetdb-deb-packages) include(monetdb-rpm-packages) +include(monetdb-wix-packages) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) diff --git a/cmake/monetdb-wix-packages.cmake b/cmake/monetdb-wix-packages.cmake new file mode 100644 --- /dev/null +++ b/cmake/monetdb-wix-packages.cmake @@ -0,0 +1,12 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +set(CPACK_WIX_UPGRADE_GUID "DA9D1C50-3589-44F2-B5DA-FE95D7F3E271") +set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/buildtools/conf/monetdb.ico") +set(CPACK_WIX_LICENSE_RTF "${CMAKE_SOURCE_DIR}/buildtools/conf/license.rtf") +set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/buildtools/conf/banner.bmp") diff --git a/documentation/source/cmake.rst b/documentation/source/cmake.rst --- a/documentation/source/cmake.rst +++ b/documentation/source/cmake.rst @@ -172,3 +172,16 @@ kvm library === The kvm library is only used on \*bsd. We already remove the header detection from cmakelists.txt: "find_path(HAVE_KVM_H "kvm.h")". + +WIX packages + + +You need to install the wixtoolset (with chocolaty): :: + + choco install wixtoolset + +Then you can run the following command from the build directory: :: + + "C:\Program Files (x86)\Microsoft
MonetDB: default - add cmake code to handle selinux configuration
Changeset: b8e5e952ba93 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8e5e952ba93 Added Files: cmake/Modules/FindAwk.cmake misc/selinux/CMakeLists.txt misc/selinux/ChangeLog-Archive misc/selinux/ChangeLog.Jun2020 misc/selinux/monetdb.fc.in misc/selinux/monetdb.if misc/selinux/monetdb.te misc/selinux/post_install_script_file.in misc/selinux/post_uninstall_script_file.in misc/selinux/selinux_types.awk Removed Files: buildtools/selinux/ChangeLog-Archive buildtools/selinux/ChangeLog.Jun2020 Modified Files: CMakeLists.txt cmake/Modules/FindSemodule.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-rpm-packages.cmake documentation/source/cmake.rst misc/CMakeLists.txt Branch: default Log Message: add cmake code to handle selinux configuration diffs (truncated from 496 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,6 @@ include(monetdb-toolchain) monetdb_default_toolchain() #monetdb_default_compiler_options() - include(monetdb-defines) monetdb_hg_revision() diff --git a/cmake/Modules/FindAwk.cmake b/cmake/Modules/FindAwk.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindAwk.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(AWK_EXECUTABLE NAMES awk + DOC "awk" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Awk + DEFAULT_MSG + AWK_EXECUTABLE +) + +mark_as_advanced(AWK_EXECUTABLE) diff --git a/cmake/Modules/FindSemodule.cmake b/cmake/Modules/FindSemodule.cmake --- a/cmake/Modules/FindSemodule.cmake +++ b/cmake/Modules/FindSemodule.cmake @@ -7,7 +7,7 @@ #]] find_program(SEMODULE_EXECUTABLE NAMES semodule - DOC "Manage selinux policy mocules" + DOC "Manage selinux policy modules" ) include(FindPackageHandleStandardArgs) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -114,5 +114,6 @@ find_package(Rpmbuild) find_package(DpkgBuildpackage) find_package(Reprepro) find_package(Semodule) +find_package(Awk) # vim: set ts=2:sw=2:et diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -159,6 +159,7 @@ function(monetdb_cmake_summary) message(STATUS "Dpkg-buildpackage: ${DPKGBUILDPACKAGE_FOUND}") message(STATUS "Reprepro: ${REPREPRO_FOUND}") message(STATUS "Semodule: ${SEMODULE_FOUND}") + message(STATUS "Awk: ${AWK_FOUND}") message(STATUS "flags: ${CMAKE_C_FLAGS}") message(STATUS "-") message(STATUS "") @@ -343,3 +344,27 @@ function(monetdb_debian_extra_files) ${CMAKE_INSTALL_DATAROOTDIR}/doc/monetdb5-server COMPONENT server) endfunction() + +function(find_selinux_types) + # The execute_process does not handle the single quotes around the awk + # command well. That is why we run it from the file. Be careful that the + # awk command is on a single line. Otherwise the output is not on a single + # line, which is needed to convert it to a cmake list. + # If the command fails, or awk is not found, we set a default list. + if(AWK_FOUND) +execute_process(COMMAND ${AWK_EXECUTABLE} "-f" "${CMAKE_SOURCE_DIR}/misc/selinux/selinux_types.awk" "/etc/selinux/config" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE AWK_RETURN_CODE + OUTPUT_VARIABLE AWK_OUTPUT_RES + ERROR_VARIABLE AWK_ERROR_RES + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(AWK_RETURN_CODE EQUAL 0 AND AWK_OUTPUT_RES) + set(SELINUX_TYPES "${AWK_OUTPUT_RES}" PARENT_SCOPE) +else() + message(WARNING "Unable to get selinux types. Using defaults.") + set(SELINUX_TYPES "mls targeted" PARENT_SCOPE) +endif() + else() +set(SELINUX_TYPES "mls targeted" PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/monetdb-rpm-packages.cmake b/cmake/monetdb-rpm-packages.cmake --- a/cmake/monetdb-rpm-packages.cmake +++ b/cmake/monetdb-rpm-packages.cmake @@ -135,6 +135,8 @@ set(CPACK_RPM_selinux_PACKAGE_SUMMARY "S set(CPACK_RPM_selinux_PACKAGE_ARCHITECTURE "noarch") set(CPACK_RPM_selinux_PACKAGE_REQUIRES_POST "MonetDB5-server%{?_isa} = %{version}-%{release}, %{name}-SQL-server5%{?_isa} = %{version}-%{release}, /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles") set(CPACK_RPM_selinux_PACKAGE_REQUIRES_POSTUN "MonetDB5-server%{?_isa} = %{version}-%{release}, %{name}-SQL-server5%{?_isa} = %{version}-%{release}, /usr/sbin/sem
MonetDB: default - use modern cmake for compile options
Changeset: 538effeeb53e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=538effeeb53e Modified Files: CMakeLists.txt cmake/monetdb-functions.cmake cmake/monetdb-toolchain.cmake Branch: default Log Message: use modern cmake for compile options diffs (135 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_APPBUNDLE LAST) include(CheckCSourceCompiles REQUIRED) +include(CheckCCompilerFlag REQUIRED) include(CheckIncludeFile REQUIRED) include(CMakePushCheckState REQUIRED) include(CheckStructHasMember REQUIRED) @@ -52,6 +53,8 @@ include(monetdb-functions) include(monetdb-findpackages) include(monetdb-toolchain) monetdb_default_toolchain() +#monetdb_default_compiler_options() + include(monetdb-defines) monetdb_hg_revision() diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -52,6 +52,15 @@ function(MT_checkCompilerFlag Flag) endif() endfunction() +function(add_option_if_available Flag) + string(REGEX REPLACE "[-/=,]" "" FLAG_TEST "${Flag}") + check_c_compiler_flag(${Flag} ${FLAG_TEST}_FOUND) + set(ISFOUND "${${FLAG_TEST}_FOUND}}") + if(ISFOUND) +add_compile_options("${Flag}") + endif() +endfunction() + function(create_include_object) cmake_parse_arguments( create_prefix @@ -150,6 +159,7 @@ function(monetdb_cmake_summary) message(STATUS "Dpkg-buildpackage: ${DPKGBUILDPACKAGE_FOUND}") message(STATUS "Reprepro: ${REPREPRO_FOUND}") message(STATUS "Semodule: ${SEMODULE_FOUND}") + message(STATUS "flags: ${CMAKE_C_FLAGS}") message(STATUS "-") message(STATUS "") endfunction() diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake --- a/cmake/monetdb-toolchain.cmake +++ b/cmake/monetdb-toolchain.cmake @@ -97,3 +97,84 @@ function(monetdb_default_toolchain) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE) endfunction() + +function(monetdb_default_compiler_options) + if(SANITIZER) +if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") + add_compile_options("-fsanitize=address") + add_compile_options("-fno-omit-frame-pointer") + add_compile_definitions(-DNO_ATOMIC_INSTRUCTIONS) +else() + message(FATAL_ERROR "Sanitizer only supported with GCC") +endif() + endif() + + if(STRICT) +if(${CMAKE_C_COMPILER_ID} MATCHES "^GNU|Clang|AppleClang$") + add_compile_options("-Werror") + add_compile_options("-Wall") + add_compile_options("-Wextra") + add_compile_options("-W") + + add_option_if_available("-Werror-implicit-function-declaration") + add_option_if_available("-Wpointer-arith") + add_option_if_available("-Wundef") + add_option_if_available("-Wformat=2") + add_option_if_available("-Wformat-overflow=1") + add_option_if_available("-Wno-format-truncation") + add_option_if_available("-Wno-format-nonliteral") + #add_option_if_available("-Wformat-signedness") -- numpy messes this up + add_option_if_available("-Wno-cast-function-type") + add_option_if_available("-Winit-self") + add_option_if_available("-Winvalid-pch") + add_option_if_available("-Wmissing-declarations") + add_option_if_available("-Wmissing-format-attribute") + add_option_if_available("-Wmissing-prototypes") + # need this for clang 9.1.0 on Darwin: + add_option_if_available("-Wno-missing-field-initializers") + add_option_if_available("-Wold-style-definition") + add_option_if_available("-Wpacked") + add_option_if_available("-Wunknown-pragmas") + add_option_if_available("-Wvariadic-macros") + add_option_if_available("-Wstack-protector") + add_option_if_available("-fstack-protector-all") + add_option_if_available("-Wstack-protector") + add_option_if_available("-Wpacked-bitfield-compat") + add_option_if_available("-Wsync-nand") + add_option_if_available("-Wjump-misses-init") + add_option_if_available("-Wmissing-include-dirs") + add_option_if_available("-Wlogical-op") + add_option_if_available("-Wduplicated-cond") + add_option_if_available("-Wduplicated-branches") + add_option_if_available("-Wrestrict") + add_option_if_available("-Wnested-externs") + # since we use values of type "int8_t" as subscript, + # and int8_t may be defined as plain "char", we cannot + # allow this warning (part of -Wall) + add_option_if_available("-Wno-char-subscripts") + add_option_if_available("-Wunreachable-code") +elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Intel") + if(WIN32) +add_compile_options("/W3") +add_compile_options("/Wcheck") +add_compile_options("/Werror-all") +add_compile_options("/${INTEL_OPTION_EXTRA}wd2259") + else() +add_compile_options
MonetDB: default - detect more executables
Changeset: 4a4945c3e000 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4a4945c3e000 Added Files: cmake/Modules/FindDpkgBuildpackage.cmake cmake/Modules/FindReprepro.cmake cmake/Modules/FindRpmbuild.cmake cmake/Modules/FindSemodule.cmake Modified Files: cmake/monetdb-custom-targets.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake Branch: default Log Message: detect more executables diffs (188 lines): diff --git a/cmake/Modules/FindDpkgBuildpackage.cmake b/cmake/Modules/FindDpkgBuildpackage.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindDpkgBuildpackage.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(DPKGBUILDPACKAGE_EXECUTABLE NAMES dpkg-buildpackage + DOC "Create deb packages" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(DpkgBuildpackage + DEFAULT_MSG + DPKGBUILDPACKAGE_EXECUTABLE +) + +mark_as_advanced(DPKGBUILDPACKAGE_EXECUTABLE) diff --git a/cmake/Modules/FindReprepro.cmake b/cmake/Modules/FindReprepro.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindReprepro.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(REPREPRO_EXECUTABLE NAMES reprepro + DOC "Create debian package repository" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Reprepro + DEFAULT_MSG + REPREPRO_EXECUTABLE +) + +mark_as_advanced(REPREPRO_EXECUTABLE) diff --git a/cmake/Modules/FindRpmbuild.cmake b/cmake/Modules/FindRpmbuild.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindRpmbuild.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild + DOC "Create rpm packages" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Rpmbuild + DEFAULT_MSG + RPMBUILD_EXECUTABLE +) + +mark_as_advanced(RPMBUILD_EXECUTABLE) diff --git a/cmake/Modules/FindSemodule.cmake b/cmake/Modules/FindSemodule.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindSemodule.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(SEMODULE_EXECUTABLE NAMES semodule + DOC "Manage selinux policy mocules" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Semodule + DEFAULT_MSG + SEMODULE_EXECUTABLE +) + +mark_as_advanced(SEMODULE_EXECUTABLE) diff --git a/cmake/monetdb-custom-targets.cmake b/cmake/monetdb-custom-targets.cmake --- a/cmake/monetdb-custom-targets.cmake +++ b/cmake/monetdb-custom-targets.cmake @@ -30,15 +30,25 @@ else() ${CMAKE_COMMAND} -E echo 'Target not available because \"createrepo\" was not found.') endif() -add_custom_target(create-rpm-packages - COMMAND - ${CMAKE_CPACK_COMMAND} -G RPM - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +if(RPMBUILD_FOUND) + add_custom_target(create-rpm-packages +COMMAND +${CMAKE_CPACK_COMMAND} -G RPM +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_custom_target(create-source-rpm-packages - COMMAND - ${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake -G RPM - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_custom_target(create-source-rpm-packages +COMMAND +${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake -G RPM +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +else() + add_custom_target(create-rpm-packages +COMMAND +${CMAKE_COMMAND} -E echo 'Target not available because \"rpmbuild\" was not found.') + + add_custom_target(create-source-rpm-packages +COMMAND +${CMAKE_COMMAND} -E echo 'Target not available because \"rpmbuild\" was not found.') +endif() add_custom_target(create-rpm-distro COMMAND @@ -52,3 +62,23 @@ add_custom_target(create-rpm-distro COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/repodata" "${CMAKE_BINARY_DIR}/distro/repodata/" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +if(DPKGBUILDPACKAGE_FOUND) + add_custom_target(create-deb-packages
MonetDB: default - handle lz4 version the correct way
Changeset: c0da459faabb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c0da459faabb Modified Files: cmake/Modules/FindLZ4.cmake cmake/monetdb-findpackages.cmake ctest/cmake/detect-fits.cmake ctest/cmake/detect-lz4.cmake ctest/cmake/detect-pthreadkill.cmake ctest/cmake/detect-pthreadsig.cmake ctest/cmake/detect-readline.cmake Branch: default Log Message: handle lz4 version the correct way diffs (117 lines): diff --git a/cmake/Modules/FindLZ4.cmake b/cmake/Modules/FindLZ4.cmake --- a/cmake/Modules/FindLZ4.cmake +++ b/cmake/Modules/FindLZ4.cmake @@ -6,23 +6,26 @@ # LZ4_VERSION - LZ4_VERSION if found # LZ4_FOUND- True if lz4 found. +include(FindPackageHandleStandardArgs) + find_path(LZ4_INCLUDE_DIR NAMES lz4.h) - find_library(LZ4_LIBRARIES NAMES lz4) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LZ4 - DEFAULT_MSG - LZ4_LIBRARIES - LZ4_INCLUDE_DIR) - -if(LZ4_FOUND) +if(LZ4_INCLUDE_DIR AND EXISTS "${LZ4_INCLUDE_DIR}/lz4.h") file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" LZ4_VERSION_LINES REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)") string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" LZ4_VERSION_MAJOR "${LZ4_VERSION_LINES}") string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" LZ4_VERSION_MINOR "${LZ4_VERSION_LINES}") string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" LZ4_VERSION_RELEASE "${LZ4_VERSION_LINES}") set(LZ4_VERSION "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}") +endif() +find_package_handle_standard_args(LZ4 + REQUIRED_VARS + LZ4_LIBRARIES + LZ4_INCLUDE_DIR + VERSION_VAR LZ4_VERSION) + +if(LZ4_FOUND) if(NOT TARGET LZ4::LZ4 AND (EXISTS "${LZ4_LIBRARIES}")) add_library(LZ4::LZ4 UNKNOWN IMPORTED) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -55,10 +55,7 @@ if(WITH_ZLIB) endif() if(WITH_LZ4) - find_package(LZ4) - if (LZ4_FOUND AND LZ4_VERSION VERSION_LESS "1.8.0") -unset(LZ4_FOUND) - endif() + find_package(LZ4 1.8.0) endif() if(WITH_PROJ) diff --git a/ctest/cmake/detect-fits.cmake b/ctest/cmake/detect-fits.cmake --- a/ctest/cmake/detect-fits.cmake +++ b/ctest/cmake/detect-fits.cmake @@ -13,7 +13,7 @@ endif() if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_FITS variablename CFITSIO_FOUND) endif() diff --git a/ctest/cmake/detect-lz4.cmake b/ctest/cmake/detect-lz4.cmake --- a/ctest/cmake/detect-lz4.cmake +++ b/ctest/cmake/detect-lz4.cmake @@ -15,7 +15,7 @@ if (${LINUX_DISTRO} STREQUAL "debian") endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_LIBLZ4 variablename LZ4_FOUND) endif() diff --git a/ctest/cmake/detect-pthreadkill.cmake b/ctest/cmake/detect-pthreadkill.cmake --- a/ctest/cmake/detect-pthreadkill.cmake +++ b/ctest/cmake/detect-pthreadkill.cmake @@ -12,8 +12,8 @@ endif() if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") -set(DETECT "0") -set(UNDETECT "1") +set(DETECT "1") +set(UNDETECT "0") endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") set(DETECT "1") diff --git a/ctest/cmake/detect-pthreadsig.cmake b/ctest/cmake/detect-pthreadsig.cmake --- a/ctest/cmake/detect-pthreadsig.cmake +++ b/ctest/cmake/detect-pthreadsig.cmake @@ -12,8 +12,8 @@ endif() if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") -set(DETECT "0") -set(UNDETECT "1") +set(DETECT "1") +set(UNDETECT "0") endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") set(DETECT "1") diff --git a/ctest/cmake/detect-readline.cmake b/ctest/cmake/detect-readline.cmake --- a/ctest/cmake/detect-readline.cmake +++ b/ctest/cmake/detect-readline.cmake @@ -13,7 +13,7 @@ endif() if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_READLINE variablename READLINE_FOUND) endif() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - set correct expected test results
Changeset: 9cf6b69ef2d0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9cf6b69ef2d0 Modified Files: ctest/cmake/detect-curl.cmake ctest/cmake/detect-gdal.cmake ctest/cmake/detect-geos.cmake ctest/cmake/detect-libr.cmake ctest/cmake/detect-lzma.cmake ctest/cmake/detect-netcdf.cmake ctest/cmake/detect-proj.cmake ctest/cmake/detect-uuid.cmake Branch: default Log Message: set correct expected test results diffs (172 lines): diff --git a/ctest/cmake/detect-curl.cmake b/ctest/cmake/detect-curl.cmake --- a/ctest/cmake/detect-curl.cmake +++ b/ctest/cmake/detect-curl.cmake @@ -9,13 +9,13 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_CURL variablename CURL_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_CURL variablename CURL_FOUND) endif() diff --git a/ctest/cmake/detect-gdal.cmake b/ctest/cmake/detect-gdal.cmake --- a/ctest/cmake/detect-gdal.cmake +++ b/ctest/cmake/detect-gdal.cmake @@ -9,13 +9,13 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_SHP variablename GDAL_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_SHP variablename GDAL_FOUND) endif() diff --git a/ctest/cmake/detect-geos.cmake b/ctest/cmake/detect-geos.cmake --- a/ctest/cmake/detect-geos.cmake +++ b/ctest/cmake/detect-geos.cmake @@ -9,13 +9,13 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_GEOM variablename GEOS_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_GEOM variablename GEOS_FOUND) endif() diff --git a/ctest/cmake/detect-libr.cmake b/ctest/cmake/detect-libr.cmake --- a/ctest/cmake/detect-libr.cmake +++ b/ctest/cmake/detect-libr.cmake @@ -6,20 +6,16 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) -endif() - if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_LIBR variablename LIBR_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_LIBR variablename LIBR_FOUND) endif() diff --git a/ctest/cmake/detect-lzma.cmake b/ctest/cmake/detect-lzma.cmake --- a/ctest/cmake/detect-lzma.cmake +++ b/ctest/cmake/detect-lzma.cmake @@ -9,13 +9,13 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_LIBLZMA variablename LIBLZMA_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_LIBLZMA variablename LIBLZMA_FOUND) endif() diff --git a/ctest/cmake/detect-netcdf.cmake b/ctest/cmake/detect-netcdf.cmake --- a/ctest/cmake/detect-netcdf.cmake +++ b/ctest/cmake/detect-netcdf.cmake @@ -6,26 +6,16 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] -include(os_release_info) - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) -endif() - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) -endif() - if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_NETCDF variablename NETCDF_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_NETCDF variablename NETCDF_FOUND) endif() diff --git a/ctest/cmake/detect-proj.cmake b/ctest/cmake/detect-proj.cmake --- a/ctest/cmake/detect-proj.cmake +++ b/ctest/cmake/detect-proj.cmake @@ -9,13 +9,13 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_PROJ variablename PROJ_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") assert_pac
MonetDB: default - cleanup odbc package detection
Changeset: dbee97e2af88 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dbee97e2af88 Modified Files: cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake Branch: default Log Message: cleanup odbc package detection diffs (69 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -312,6 +312,25 @@ macro(monetdb_configure_sizes) endif() cmake_pop_check_state() endif() + + if(ODBC_FOUND) +cmake_push_check_state() +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${ODBC_INCLUDE_DIR}") +if(WIN32) + set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};Windows.h;sqlext.h;sqltypes.h") + check_include_file("afxres.h" HAVE_AFXRES_H) +else() + set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};sql.h;sqltypes.h") +endif() +check_type_size(SQLLEN _SQLLEN LANGUAGE C) +if(HAVE__SQLLEN) + set(LENP_OR_POINTER_T "SQLLEN *") +else() + set(LENP_OR_POINTER_T "SQLPOINTER") +endif() +check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C) +cmake_pop_check_state() + endif() endmacro() macro(monetdb_configure_misc) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -105,25 +105,6 @@ endif() if(ODBC) find_package(ODBC) - set(HAVE_ODBC "${ODBC_FOUND}") - if(ODBC_FOUND) -cmake_push_check_state() -set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${ODBC_INCLUDE_DIR}") -if(WIN32) - set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};Windows.h;sqlext.h;sqltypes.h") - check_include_file("afxres.h" HAVE_AFXRES_H) -else() - set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};sql.h;sqltypes.h") -endif() -check_type_size(SQLLEN _SQLLEN LANGUAGE C) -if(HAVE__SQLLEN) - set(LENP_OR_POINTER_T "SQLLEN *") -else() - set(LENP_OR_POINTER_T "SQLPOINTER") -endif() -check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C) -cmake_pop_check_state() - endif() endif() if(RINTEGRATION) diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -143,6 +143,7 @@ function(monetdb_cmake_summary) message(STATUS "Netcdf library: ${NETCDF_FOUND}") message(STATUS "Readline library: ${READLINE_FOUND}") message(STATUS "R library: ${LIBR_FOUND}") + message(STATUS "ODBC: ${ODBC_FOUND}") message(STATUS "Sphinx: ${SPHINX_FOUND}") message(STATUS "Createrepo: ${CREATEREPO_FOUND}") message(STATUS "-") ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - move some old documentation
Changeset: cc2af2615835 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc2af2615835 Added Files: documentation/source/intro.rst documentation/source/windowsbuild.rst Removed Files: documentation/old/README.rst Modified Files: cmake/monetdb-packages.cmake ctest/cmake/CMakeLists.txt documentation/index.rst documentation/source/release.rst Branch: default Log Message: move some old documentation diffs (truncated from 311 to 300 lines): diff --git a/cmake/monetdb-packages.cmake b/cmake/monetdb-packages.cmake --- a/cmake/monetdb-packages.cmake +++ b/cmake/monetdb-packages.cmake @@ -27,5 +27,4 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" endif() endif() - include(CPack) diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -8,8 +8,6 @@ # For now these tests only work on special docker containers. -#project(MonetDB-unittest LANGUAGES C) - include(os_release_info) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") diff --git a/documentation/index.rst b/documentation/index.rst --- a/documentation/index.rst +++ b/documentation/index.rst @@ -16,7 +16,9 @@ Welcome to MonetDB's documentation! monetdbe/examples monetdbe/installation monetdbe/monetdbe_api + source/intro source/build + source/windowsbuild source/build-fedora source/build-debian source/clients diff --git a/documentation/old/README.rst b/documentation/old/README.rst deleted file mode 100644 --- a/documentation/old/README.rst +++ /dev/null @@ -1,34 +0,0 @@ -The MonetDB Database System -=== - -The MonetDB database is developed by the CWI database research group -(see https://www.monetdb.org/). - -Via the MonetDB project we have brought the MonetDB system in open source, -where it is accessible at https://www.monetdb.org/Downloads/ - -The MonetDB database system is a high-performance database kernel for -query-intensive applications. The MonetDB source can be found at our `Mercurial -server`__. There is also a `github mirror`__ that is updated once a day. - -.. _MonetDB: https://dev.monetdb.org/hg/MonetDB/ -__ MonetDB_ - -.. _github: https://github.com/MonetDB/MonetDB -__ github_ - -If you got a source distribution, please compile and install MonetDB first, -following the instructions in the file `HowToStart.rst`__ (for Unix) -or `buildtools/doc/windowsbuild.rst`__ (for Windows). - -__ HowToStart.rst -__ buildtools/doc/windowsbuild.rst - -Copyright Notice - - -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. diff --git a/documentation/source/intro.rst b/documentation/source/intro.rst new file mode 100644 --- /dev/null +++ b/documentation/source/intro.rst @@ -0,0 +1,40 @@ +.. This Source Code Form is subject to the terms of the Mozilla Public +.. License, v. 2.0. If a copy of the MPL was not distributed with this +.. file, You can obtain one at http://mozilla.org/MPL/2.0/. +.. +.. Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + +The MonetDB Database System +=== + +The MonetDB database is developed by the CWI database research group +(see https://www.monetdb.org/). + +Via the MonetDB project we have brought the MonetDB system in open source, +where it is accessible at https://www.monetdb.org/Downloads/ + +The MonetDB database system is a high-performance database kernel for +query-intensive applications. The MonetDB source can be found at our `Mercurial +server`__. There is also a `github mirror`__ that is updated once a day. + +.. _MonetDB: https://dev.monetdb.org/hg/MonetDB/ +__ MonetDB_ + +.. _github: https://github.com/MonetDB/MonetDB +__ github_ + +If you got a source distribution, please compile and install MonetDB first, +following the instructions in the file `HowToStart.rst`__ (for Unix) +or `buildtools/doc/windowsbuild.rst`__ (for Windows). + +__ HowToStart.rst +__ buildtools/doc/windowsbuild.rst + +Copyright Notice + + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. diff --git a/documentation/source/release.rst b/documentation/source/release.rst --- a/documentation/source/release.rst +++ b/documentation/source/release.rst @@ -1,7 +1,63 @@ +.. This Source Code Form is subject to the terms of the Mozilla Public +.. License, v. 2.0. If a copy of the MPL was not distributed with this +.. file, You can obtain one at http://mozilla.org/MPL/2.0/. +.. +.. Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + ***
MonetDB: default - start with custom target to generate rpms
Changeset: ce1a9b271295 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ce1a9b271295 Added Files: cmake/Modules/FindCreaterepo.cmake Modified Files: cmake/monetdb-custom-targets.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake Branch: default Log Message: start with custom target to generate rpms diffs (132 lines): diff --git a/cmake/Modules/FindCreaterepo.cmake b/cmake/Modules/FindCreaterepo.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindCreaterepo.cmake @@ -0,0 +1,20 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_program(CREATEREPO_EXECUTABLE NAMES createrepo + DOC "Create rpm repository" +) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Createrepo + DEFAULT_MSG + CREATEREPO_EXECUTABLE +) + +mark_as_advanced(CREATEREPO_EXECUTABLE) diff --git a/cmake/monetdb-custom-targets.cmake b/cmake/monetdb-custom-targets.cmake --- a/cmake/monetdb-custom-targets.cmake +++ b/cmake/monetdb-custom-targets.cmake @@ -14,7 +14,41 @@ endif() if (TESTING) add_custom_target(mtest - COMMAND - ${CMAKE_INSTALL_FULL_BINDIR}/${MONETDB_MTEST_SCRIPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +COMMAND +${CMAKE_INSTALL_FULL_BINDIR}/${MONETDB_MTEST_SCRIPT} +WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +if (CREATEREPO_FOUND) + add_custom_target(create-rpm-repo +COMMAND +${CREATEREPO_EXECUTABLE} ${CMAKE_BINARY_DIR} +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +else() + add_custom_target(create-rpm-repo +COMMAND +${CMAKE_COMMAND} -E echo 'Target not available because \"createrepo\" was not found.') endif() + +add_custom_target(create-rpm-packages + COMMAND + ${CMAKE_CPACK_COMMAND} -G RPM + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_custom_target(create-source-rpm-packages + COMMAND + ${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake -G RPM + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_custom_target(create-rpm-distro + COMMAND + ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/distro" + COMMAND + ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/distro/repodata" + COMMAND + ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/*rpm" "${CMAKE_BINARY_DIR}/distro/" + COMMAND + ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/_CPack_Packages/Linux-Source/RPM/SPECS/monetdb.spec" "${CMAKE_BINARY_DIR}/distro/" + COMMAND + ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/repodata" "${CMAKE_BINARY_DIR}/distro/repodata/" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -35,11 +35,11 @@ if(WITH_PCRE) endif() if(WITH_CRYPTO) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND ${CMAKE_HOST_SYSTEM_VERSION} VERSION_LESS "19.0.0") - find_package(CommonCrypto) - else() - find_package(OpenSSL) - endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND ${CMAKE_HOST_SYSTEM_VERSION} VERSION_LESS "19.0.0") +find_package(CommonCrypto) + else() +find_package(OpenSSL) + endif() endif() if(WITH_BZ2) @@ -56,9 +56,9 @@ endif() if(WITH_LZ4) find_package(LZ4) - if (LZ4_FOUND AND LZ4_VERSION VERSION_LESS "1.8.0") - unset(LZ4_FOUND) - endif() + if (LZ4_FOUND AND LZ4_VERSION VERSION_LESS "1.8.0") +unset(LZ4_FOUND) + endif() endif() if(WITH_PROJ) @@ -131,5 +131,6 @@ if(RINTEGRATION) endif() find_package(Sphinx) +find_package(Createrepo) # vim: set ts=2:sw=2:et diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -108,6 +108,7 @@ function(monetdb_cmake_summary) message(STATUS "Summary of cmake configuration of MonetDB") message(STATUS "-") message(STATUS "System is big endian: ${IS_BIG_ENDIAN}") + message(STATUS "Toolchain file: ${CMAKE_TOOLCHAIN_FILE}") if(${CMAKE_VERSION} VERSION_LESS "3.14.0") message(STATUS "NumPy include dirs: ${NUMPY_INCLUDE_DIRS}") else() @@ -143,6 +144,7 @@ function(monetdb_cmake_summary) message(STATUS "Readline library: ${READLINE_FOUND}") message(STATUS "R library: ${LIBR_FOUND}") message(STATUS "Sphinx: ${SPHINX_FOUND}") + message(STATUS "Createrepo: ${CREATEREPO_FOUND}") message(STATUS "-") message(STATUS "") endfunction() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - use function to define tests
Changeset: 9d779c50efb3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d779c50efb3 Removed Files: ctest/cmake/test_detect_bz2.c.in ctest/cmake/test_detect_commoncrypto.c.in ctest/cmake/test_detect_gdal.c.in ctest/cmake/test_detect_geos.c.in ctest/cmake/test_detect_iconv.c.in ctest/cmake/test_detect_libpy3.c.in ctest/cmake/test_detect_libr.c.in ctest/cmake/test_detect_libz.c.in ctest/cmake/test_detect_lz4.c.in ctest/cmake/test_detect_lzma.c.in ctest/cmake/test_detect_netcdf.c.in ctest/cmake/test_detect_openssl.c.in ctest/cmake/test_detect_pcre.c.in ctest/cmake/test_detect_proj.c.in ctest/cmake/test_detect_readline.c.in ctest/cmake/test_detect_snappy.c.in ctest/cmake/test_detect_uuid.c.in ctest/cmake/test_detect_valgrind.c.in ctest/cmake/test_detect_xml.c.in Modified Files: ctest/cmake/detect-bz2.cmake ctest/cmake/detect-commoncrypto.cmake ctest/cmake/detect-gdal.cmake ctest/cmake/detect-geos.cmake ctest/cmake/detect-iconv.cmake ctest/cmake/detect-libpy3.cmake ctest/cmake/detect-libr.cmake ctest/cmake/detect-libz.cmake ctest/cmake/detect-lz4.cmake ctest/cmake/detect-lzma.cmake ctest/cmake/detect-netcdf.cmake ctest/cmake/detect-openssl.cmake ctest/cmake/detect-pcre.cmake ctest/cmake/detect-proj.cmake ctest/cmake/detect-readline.cmake ctest/cmake/detect-snappy.cmake ctest/cmake/detect-uuid.cmake ctest/cmake/detect-valgrind.cmake ctest/cmake/detect-xml.cmake Branch: default Log Message: use function to define tests diffs (truncated from 2167 to 300 lines): diff --git a/ctest/cmake/detect-bz2.cmake b/ctest/cmake/detect-bz2.cmake --- a/ctest/cmake/detect-bz2.cmake +++ b/ctest/cmake/detect-bz2.cmake @@ -8,53 +8,56 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") -set(DETECT "0") -set(UNDETECT "1") +assert_package_detected( + detect TRUE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") -set(DETECT "0") -set(UNDETECT "1") +assert_package_detected( + detect TRUE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() elseif (${LINUX_DISTRO} STREQUAL "ubuntu") if(${LINUX_DISTRO_VERSION} STREQUAL "18") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "19") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "20") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() elseif(${LINUX_DISTRO} STREQUAL "fedora") if(${LINUX_DISTRO_VERSION} STREQUAL "30") -set(DETECT "0") -set(UNDETECT "1") +assert_package_detected( + detect TRUE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "31") -set(DETECT "0") -set(UNDETECT "1") +assert_package_detected( + detect TRUE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "32") -set(DETECT "0") -set(UNDETECT "1") +assert_package_detected( + detect TRUE + legacyvariable HAVE_LIBBZ2 + variablename BZIP2_FOUND) endif() else() message(ERROR "Linux distro: ${LINUX_DISTRO} not known") message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") endif() - -configure_file(test_detect_bz2.c.in - ${CMAKE_CURRENT_BINARY_DIR}/test_detect_bz2.c - @ONLY) - -add_executable(test_detect_bz2) -target_sources(test_detect_bz2 - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/test_detect_bz2.c) -target_link_libraries(test_detect_bz2 - PRIVATE - monetdb_config_header) -add_test(testDetectBz2 test_detect_bz2) diff --git a/ctest/cmake/detect-commoncrypto.cmake b/ctest/cmake/detect-commoncrypto.cmake --- a/ctest/cmake/detect-commoncrypto.cmake +++ b/ctest/cmake/detect-commoncrypto.cmake @@ -8,53 +8,56 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_COMMONCRYPTO + variablename COMMONCRYPTO_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_COMMONCRYPTO + variablename COMMON
MonetDB: default - add buildrequirments for source rpms
Changeset: 430352698962 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=430352698962 Modified Files: cmake/monetdb-rpm-packages.cmake Branch: default Log Message: add buildrequirments for source rpms diffs (70 lines): diff --git a/cmake/monetdb-rpm-packages.cmake b/cmake/monetdb-rpm-packages.cmake --- a/cmake/monetdb-rpm-packages.cmake +++ b/cmake/monetdb-rpm-packages.cmake @@ -135,3 +135,66 @@ set(CPACK_RPM_selinux_PACKAGE_SUMMARY "S set(CPACK_RPM_selinux_PACKAGE_ARCHITECTURE "noarch") set(CPACK_RPM_selinux_PACKAGE_REQUIRES_POST "MonetDB5-server%{?_isa} = %{version}-%{release}, %{name}-SQL-server5%{?_isa} = %{version}-%{release}, /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles") set(CPACK_RPM_selinux_PACKAGE_REQUIRES_POSTUN "MonetDB5-server%{?_isa} = %{version}-%{release}, %{name}-SQL-server5%{?_isa} = %{version}-%{release}, /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles") + +# Determine the build requires settings for the source build +# This add buildsrequirement based on the packages that are +# found on the machine that generates the packages. This might +# not be what we want when distributing the source rpm, so we +# might change this, or add the option to generate one based +# on the cmake options. +set(buildrequireslist + "gcc" + "bison" + "/usr/bin/python3") + +# RHEL >= 7, and all current Fedora +LIST(APPEND buildrequireslist + "/usr/lib/rpm/macros.d/macros.systemd" + "checkpolicy" + "selinux-policy-devel" + "hardlink") + +if(BZIP2_FOUND) + LIST(APPEND buildrequireslist "bzip2-devel") +endif() + +if(CFITSIO_FOUND) + LIST(APPEND buildrequireslist "pkgconfig(cfitsio)") +endif() + +if(GEOS_FOUND) + LIST(APPEND buildrequireslist "geos-devel > 3.4.0") +endif() + +if(CURL_FOUND) + LIST(APPEND buildrequireslist "pkgconfig(libcurl)") +endif() + +if(LIBLZMA_FOUND) + LIST(APPEND buildrequireslist "pkgconfig(liblzma)") +endif() + +if(READLINE_FOUND) + LIST(APPEND buildrequireslist "readline-devel") +endif() + +if(ODBC_FOUND) + LIST(APPEND buildrequireslist "unixODBC-devel") +endif() + +if(ZLIB_FOUND) + LIST(APPEND buildrequireslist "pkgconfig(zlib)") +endif() + +if(PY3INTEGRATION) + LIST(APPEND buildrequireslist "python3-devel >= 3.5") + LIST(APPEND buildrequireslist "python3-numpy") +endif() + +if(LIBR_FOUND) + LIST(APPEND buildrequireslist "R-core-devel") +endif() + +LIST(JOIN buildrequireslist ", " buildrequires) + +set(CPACK_RPM_BUILDREQUIRES ${buildrequires}) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - only try on linux, not mac
Changeset: 6afecf2850fd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6afecf2850fd Modified Files: cmake/monetdb-packages.cmake Branch: default Log Message: only try on linux, not mac diffs (18 lines): diff --git a/cmake/monetdb-packages.cmake b/cmake/monetdb-packages.cmake --- a/cmake/monetdb-packages.cmake +++ b/cmake/monetdb-packages.cmake @@ -21,10 +21,11 @@ include(monetdb-rpm-packages) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) + + if (${LINUX_DISTRO} STREQUAL "debian") +monetdb_debian_extra_files() + endif() endif() -if (${LINUX_DISTRO} STREQUAL "debian") - monetdb_debian_extra_files() -endif() include(CPack) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - fix most of the cmake code for building deb p...
Changeset: 728e35d1b2f6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=728e35d1b2f6 Added Files: misc/packages/deb/changelog misc/packages/deb/copyright Modified Files: cmake/monetdb-deb-packages.cmake cmake/monetdb-functions.cmake cmake/monetdb-packages.cmake common/stream/CMakeLists.txt Branch: default Log Message: fix most of the cmake code for building deb packages diffs (truncated from 6915 to 300 lines): diff --git a/cmake/monetdb-deb-packages.cmake b/cmake/monetdb-deb-packages.cmake --- a/cmake/monetdb-deb-packages.cmake +++ b/cmake/monetdb-deb-packages.cmake @@ -28,8 +28,7 @@ set(CPACK_COMPONENT_MONETDB_DESCRIPTION single shared library. If you want to use MonetDB, you will certainly need this package, but you will also need at least the monetdb5-server package, and most likely also monetdb5-sql, as well as one or - more client packages. -") + more client packages.") set(CPACK_DEBIAN_MONETDBDEV_PACKAGE_NAME "libmonetdb-dev") set(CPACK_DEBIAN_MONETDBDEV_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}, libmonetdb${GDK_VERSION_MAJOR}, libmonetdb-stream-dev") @@ -40,8 +39,7 @@ set(CPACK_COMPONENT_MONETDBDEV_DESCRIPTI accelerators. It also has an SQL front end. . This package contains files needed to develop extensions to the core - functionality of MonetDB. -") + functionality of MonetDB.") set(CPACK_DEBIAN_STREAM_PACKAGE_NAME "libmonetdb-stream${STREAM_VERSION_MAJOR}") set(CPACK_DEBIAN_STREAM_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}") @@ -52,8 +50,7 @@ set(CPACK_COMPONENT_STREAM_DESCRIPTION " accelerators. It also has an SQL front end. . This package contains a shared library (libstream) which is needed by - various other components. -") + various other components.") set(CPACK_DEBIAN_STREAMDEV_PACKAGE_NAME "libmonetdb-stream-dev") set(CPACK_DEBIAN_STREAMDEV_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}, libmonetdb-stream${STREAM_VERSION_MAJOR} (= \\\${source:Version}") @@ -64,8 +61,7 @@ set(CPACK_COMPONENT_STREAMDEV_DESCRIPTIO accelerators. It also has an SQL front end. . This package contains the files to develop with the - libmonetdb-stream13 library. -") + libmonetdb-stream13 library.") set(CPACK_DEBIAN_CLIENT_PACKAGE_NAME "libmonetdb-client${MAPI_VERSION_MAJOR}") set(CPACK_DEBIAN_CLIENT_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}") @@ -76,8 +72,7 @@ set(CPACK_COMPONENT_CLIENT_DESCRIPTION " accelerators. It also has an SQL front end. . This package contains a shared library (libmapi) which is needed by - various other components. -") + various other components.") set(CPACK_DEBIAN_CLIENTDEV_PACKAGE_NAME "libmonetdb-client-dev") set(CPACK_DEBIAN_CLIENTDEV_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}, libmonetdb-client${MAPI_VERSION_MAJOR} (= \\\${source:Version}") @@ -88,8 +83,7 @@ set(CPACK_COMPONENT_CLIENTDEV_DESCRIPTIO accelerators. It also has an SQL front end. . This package contains the files to develop with the libmonetdb-client12 - library. -") + library.") set(CPACK_DEBIAN_MCLIENT_PACKAGE_NAME "monetdb-client") set(CPACK_DEBIAN_MCLIENT_PACKAGE_RECOMMENDS "monetdb5-sql (= \\\${source:Version}") @@ -103,8 +97,7 @@ set(CPACK_COMPONENT_MCLIENT_DESCRIPTION This package contains mclient, the main client program to communicate with the MonetDB database server, and msqldump, a program to dump the SQL database so that it can be loaded back later. If you want to use - MonetDB, you will very likely need this package. -") + MonetDB, you will very likely need this package.") set(CPACK_DEBIAN_ODBC_PACKAGE_NAME "libmonetdb-client-odbc") set(CPACK_DEBIAN_ODBC_PACKAGE_DEPENDS "\\\${shlibs:Depends}\\\${misc:Depends}") @@ -114,8 +107,7 @@ set(CPACK_COMPONENT_ODBC_DESCRIPTION "Mo automatic index management, extensibility of data types and search accelerators. It also has an SQL front end. . - This package contains the MonetDB ODBC driver. -") + This package contains the MonetDB ODBC driver.") set(CPACK_DEBIAN_CLIENTTEST_PACKAGE_NAME "monetdb-client-testing") set(CPACK_DEBIAN_CLIENTTEST_PACKAGE_DEPENDS "\\\${shlibs:Depends} ,libmonetdb-client-odbc (= \\\${source:Version}), @@ -132,8 +124,7 @@ set(CPACK_COMPONENT_CLIENTTEST_DESCRIPTI . This package contains the sample MAPI programs used for testing other MonetDB packages. You probably don't need this, unless you are a - developer. -") + developer.") set(CPACK_DEBIAN_GEOM_PACKAGE_NAME "libmonetdb5-server-geom") set(CPACK_DEBIAN_GEOM_PACKAGE_DEPENDS "\\\${shlibs:Depends}\\\${misc:Depends}, monetdb5-sql (= \\\${source:Version}") @@ -145,8 +136,7 @@ set(CPACK_COMPONENT_GEOM_DESCRIPTION "Mo accelerators. It also has an SQL front end. . This package contains the GIS (Geographic Information System) - extensions for MonetDB-SQL-server5. -") + extensions for MonetDB-SQL-server5.") set(CPACK_DEBIAN_FITS_PACKAGE_NA
MonetDB: default - fix almost all bugs in the cmake code to gene...
Changeset: da0ee734b4a0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da0ee734b4a0 Added Files: misc/packages/rpm/COPYING misc/packages/rpm/changelog Removed Files: COPYING Modified Files: clients/mapiclient/CMakeLists.txt clients/mapilib/CMakeLists.txt cmake/monetdb-rpm-packages.cmake common/options/CMakeLists.txt ctest/cmake/detect-curl.cmake gdk/CMakeLists.txt monetdb5/tools/CMakeLists.txt sql/CMakeLists.txt testing/CMakeLists.txt tools/merovingian/daemon/CMakeLists.txt tools/merovingian/daemon/config/CMakeLists.txt tools/monetdbe/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: default Log Message: fix almost all bugs in the cmake code to generate rpm packages diffs (truncated from 4783 to 300 lines): diff --git a/clients/mapiclient/CMakeLists.txt b/clients/mapiclient/CMakeLists.txt --- a/clients/mapiclient/CMakeLists.txt +++ b/clients/mapiclient/CMakeLists.txt @@ -28,9 +28,7 @@ target_link_libraries(mcutil mcrypt moptions mapi - stream - #$<$:Iconv::Iconv>) - ) + stream) add_executable(mclient) @@ -103,7 +101,7 @@ install(TARGETS msqldump RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT mclient + COMPONENT client LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -68,6 +68,7 @@ install(TARGETS LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT client + NAMELINK_COMPONENT clientdev ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT client diff --git a/cmake/monetdb-rpm-packages.cmake b/cmake/monetdb-rpm-packages.cmake --- a/cmake/monetdb-rpm-packages.cmake +++ b/cmake/monetdb-rpm-packages.cmake @@ -19,7 +19,7 @@ set(CPACK_RPM_PACKAGE_VENDOR "MonetDB BV set(CPACK_RPM_PACKAGE_LICENSE "MPLv2.0") set(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") set(CPACK_RPM_PACKAGE_URL "https://www.monetdb.org/";) -# set(CPACK_RPM_CHANGELOG_FILE"") +set(CPACK_RPM_CHANGELOG_FILE "${CMAKE_SOURCE_DIR}/misc/packages/rpm/changelog") set(CPACK_RPM_monetdb_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_RPM_monetdb_FILE_NAME "${CMAKE_PROJECT_NAME}-${MONETDB_VERSION}.rpm") diff --git a/common/options/CMakeLists.txt b/common/options/CMakeLists.txt --- a/common/options/CMakeLists.txt +++ b/common/options/CMakeLists.txt @@ -44,4 +44,6 @@ install(TARGETS DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT + monetdbdev) diff --git a/ctest/cmake/detect-curl.cmake b/ctest/cmake/detect-curl.cmake --- a/ctest/cmake/detect-curl.cmake +++ b/ctest/cmake/detect-curl.cmake @@ -53,7 +53,7 @@ elseif(${LINUX_DISTRO} STREQUAL "fedora" endif() if(${LINUX_DISTRO_VERSION} STREQUAL "32") assert_package_detected( - detect FALSE + detect TRUE legacyvariable HAVE_CURL variablename CURL_FOUND) endif() diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -129,6 +129,7 @@ install(TARGETS LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT monetdb + NAMELINK_COMPONENT monetdbdev ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT monetdb diff --git a/COPYING b/misc/packages/rpm/COPYING rename from COPYING rename to misc/packages/rpm/COPYING diff --git a/misc/packages/rpm/changelog b/misc/packages/rpm/changelog new file mode 100644 --- /dev/null +++ b/misc/packages/rpm/changelog @@ -0,0 +1,4561 @@ +* Fri May 29 2020 Sjoerd Mullender - 11.37.7-20200529 +- Rebuilt. + +* Tue May 26 2020 Sjoerd Mullender - 11.37.5-20200526 +- Rebuilt. +- BZ#6864: (I)LIKE with multiple % doen't find matches + +* Mon May 18 2020 Sjoerd Mullender - 11.37.3-20200518 +- Rebuilt. +- BZ#6863: thash files not released upon drop table + +* Mon May 11 2020 Sjoerd Mullender - 11.37.1-20200511 +- Rebuilt. +- BZ#6298: unexpectedly slow execution of SELECT length(fieldname) + FROM tablename LIMIT 1 queries +- BZ#6401: Suspected memory leak in mserver5 when creating/dropping tables +- BZ#6687: Count distinct very slow and use too much the hard drive +- BZ#6731: Add system view to allow querying of available prepared + statements and their parameters +- BZ#6732: Add SQL command to close a specific prepared statement +- BZ#6750: Executing a query on a non-existing column on a remote table + crashes the remote server +- BZ#6785: function sys.isaURL(url) should have been declared as + sys.isaURL(string) +- BZ#6808: reveal the alarm.sleep procedure in SQL +- BZ#6813: function not_uniques(bigint) returns error when called +- BZ#6818: usage of multiple column expressions in where-clause (f(a), + f(b)) in (select a, b)
MonetDB: default - add new test functions
Changeset: abe61c37a2b7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=abe61c37a2b7 Added Files: ctest/cmake/test_detect_legacy_var.c.in ctest/cmake/test_package_detect.c.in Removed Files: ctest/cmake/test_detect_curl.c.in ctest/cmake/test_detect_fits.c.in Modified Files: cmake/monetdb-functions.cmake ctest/cmake/CMakeLists.txt ctest/cmake/detect-curl.cmake ctest/cmake/detect-fits.cmake Branch: default Log Message: add new test functions diffs (truncated from 363 to 300 lines): diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -147,6 +147,7 @@ function(monetdb_cmake_summary) message(STATUS "") endfunction() +# CMake function to test if a variable exists in the cmake code. function(assert_variable_exists assert_variable_variablename) if(NOT ${assert_variable_variablename}) message(FATAL_ERROR "variable ${assert_variable_variablename} not defined") @@ -165,3 +166,63 @@ function(assert_variable_exists assert_v "${CMAKE_CURRENT_BINARY_DIR}/test_${assert_variable_variablename}_var.c") add_test("testDetect${assert_variable_variablename}" "test_${assert_variable_variablename}_var") endfunction() + +# CMake function to test if a cmake variable has a corresponding +# legacy variable defined in the monetdb_config.h header file. +function(assert_legacy_variable_exists) + cmake_parse_arguments( +assert_variable +"dummy" +"variablename;legacy_variablename" +"" +${ARGN}) + if(${${assert_variable_variablename}}) +set(DETECT "0") +set(UNDETECT "1") + else() +set(DETECT "1") +set(UNDETECT "0") + endif() + configure_file(test_detect_legacy_var.c.in + "${CMAKE_CURRENT_BINARY_DIR}/test_${assert_variable_legacy_variablename}_legacy_var.c" +@ONLY) + add_executable("test_${assert_variable_legacy_variablename}_legacy_var") + target_sources("test_${assert_variable_legacy_variablename}_legacy_var" +PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/test_${assert_variable_legacy_variablename}_legacy_var.c") + target_link_libraries("test_${assert_variable_legacy_variablename}_legacy_var" + PRIVATE + monetdb_config_header) + add_test("testDetect${assert_variable_legacy_variablename}Legacy" +"test_${assert_variable_legacy_variablename}_legacy_var") +endfunction() + +# CMake function to test if the package detection gave the +# expected result. +function(assert_package_detected) + cmake_parse_arguments( +assert_package +"dummy" +"variablename;legacyvariable;detect" +"" +${ARGN}) + if(${assert_package_detect}) +set(DETECT "0") +set(UNDETECT "1") + else() +set(DETECT "1") +set(UNDETECT "0") + endif() + configure_file(test_package_detect.c.in + "${CMAKE_CURRENT_BINARY_DIR}/test_${assert_package_variablename}_detect_var.c" +@ONLY) + add_executable("test_${assert_package_variablename}_detect_var") + target_sources("test_${assert_package_variablename}_detect_var" +PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/test_${assert_package_variablename}_detect_var.c") + target_link_libraries("test_${assert_package_variablename}_detect_var" + PRIVATE + monetdb_config_header) + add_test("testDetect${assert_package_variablename}Detect" +"test_${assert_package_variablename}_detect_var") +endfunction() diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -47,3 +47,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dete include(${CMAKE_CURRENT_SOURCE_DIR}/set-dir-vars.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/set-cmake-vars.cmake) + +assert_legacy_variable_exists( + legacy_variablename HAVE_FITS + variablename CFITSIO_FOUND) +assert_legacy_variable_exists( + legacy_variablename HAVE_CURL + variablename CURL_FOUND) diff --git a/ctest/cmake/detect-curl.cmake b/ctest/cmake/detect-curl.cmake --- a/ctest/cmake/detect-curl.cmake +++ b/ctest/cmake/detect-curl.cmake @@ -8,53 +8,56 @@ if (${LINUX_DISTRO} STREQUAL "debian") if(${LINUX_DISTRO_VERSION} STREQUAL "9") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_CURL + variablename CURL_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "10") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_CURL + variablename CURL_FOUND) endif() elseif (${LINUX_DISTRO} STREQUAL "ubuntu") if(${LINUX_DISTRO_VERSION} STREQUAL "18") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable HAVE_CURL + variablename CURL_FOUND) endif() if(${LINUX_DISTRO_VERSION} STREQUAL "19") -set(DETECT "1") -set(UNDETECT "0") +assert_package_detected( + detect FALSE + legacyvariable
MonetDB: default - move some of the cmake unittests into a function
Changeset: f987ff46fc69 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f987ff46fc69 Modified Files: cmake/monetdb-functions.cmake ctest/cmake/set-cmake-vars.cmake ctest/cmake/set-dir-vars.cmake Branch: default Log Message: move some of the cmake unittests into a function diffs (truncated from 315 to 300 lines): diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -146,3 +146,22 @@ function(monetdb_cmake_summary) message(STATUS "-") message(STATUS "") endfunction() + +function(assert_variable_exists assert_variable_variablename) + if(NOT ${assert_variable_variablename}) +message(FATAL_ERROR "variable ${assert_variable_variablename} not defined") +set(DETECT "1") + else() +set(DETECT "0") + endif() + + configure_file(test_cmake_var.c.in +"${CMAKE_CURRENT_BINARY_DIR}/test_${assert_variable_variablename}_var.c" +@ONLY) + + add_executable("test_${assert_variable_variablename}_var") + target_sources("test_${assert_variable_variablename}_var" +PRIVATE +"${CMAKE_CURRENT_BINARY_DIR}/test_${assert_variable_variablename}_var.c") + add_test("testDetect${assert_variable_variablename}" "test_${assert_variable_variablename}_var") +endfunction() diff --git a/ctest/cmake/set-cmake-vars.cmake b/ctest/cmake/set-cmake-vars.cmake --- a/ctest/cmake/set-cmake-vars.cmake +++ b/ctest/cmake/set-cmake-vars.cmake @@ -9,57 +9,12 @@ # Test for the existance of these cmake variables, the source code assumes # that they are set by the buildsystem. -if(NOT DEFINED HAVE_CUDF) - message(FATAL_ERROR "variable HAVE_CUDF not defined") - set(DETECT "1") -else() - set(DETECT "0") -endif() - -configure_file(test_cmake_var.c.in - ${CMAKE_CURRENT_BINARY_DIR}/test_have_cudf_var.c - @ONLY) - -add_executable(test_have_cudf_var) -target_sources(test_have_cudf_var - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/test_have_cudf_var.c) -add_test(testDetectHave_cudf test_have_cudf_var) +assert_variable_exists(HAVE_CUDF) -if(DEFINED HAVE_LIBR) - if(NOT DEFINED RHOME) -message(FATAL_ERROR "variable RHOME not defined") -set(DETECT "1") - else() -set(DETECT "0") - endif() - - configure_file(test_cmake_var.c.in -${CMAKE_CURRENT_BINARY_DIR}/test_rhome_var.c -@ONLY) - - add_executable(test_rhome_var) - target_sources(test_rhome_var -PRIVATE -${CMAKE_CURRENT_BINARY_DIR}/test_rhome_var.c) - add_test(testDetectRhome test_rhome_var) +if(HAVE_LIBR) + assert_variable_exists(RHOME) endif() if(DEFINED HAVE_GETOPT_H) - if(NOT DEFINED HAVE_GETOPT) -message(FATAL_ERROR "variable HAVE_GETOPT not defined") -set(DETECT "1") - else() -set(DETECT "0") - endif() - - configure_file(test_cmake_var.c.in -${CMAKE_CURRENT_BINARY_DIR}/test_have_getopt1_var.c -@ONLY) - - add_executable(test_have_getopt1_var) - target_sources(test_have_getopt1_var -PRIVATE -${CMAKE_CURRENT_BINARY_DIR}/test_have_getopt1_var.c) - add_test(testDetectHave_getopt1 test_have_getopt1_var) + assert_variable_exists(HAVE_GETOPT) endif() diff --git a/ctest/cmake/set-dir-vars.cmake b/ctest/cmake/set-dir-vars.cmake --- a/ctest/cmake/set-dir-vars.cmake +++ b/ctest/cmake/set-dir-vars.cmake @@ -8,210 +8,14 @@ # Test for the existance of these cmake variables, the source code assumes # that they are set by the buildsystem. -#if(NOT DEFINED BIN_DIR) -# message(FATAL_ERROR "variable BIN_DIR not defined") -# set(DETECT "1") -#else() -# set(DETECT "0") -#endif() -#configure_file(test_cmake_var.c.in -# ${CMAKE_CURRENT_BINARY_DIR}/test_bin_dir_var.c -# @ONLY) - -#add_executable(test_bin_dir_var) -#target_sources(test_bin_dir_var -# PRIVATE -# ${CMAKE_CURRENT_BINARY_DIR}/test_bin_dir_var.c) -#add_test(testDetectBin_dir test_bin_dir_var) - -if(NOT DEFINED DIR_SEP) - message(FATAL_ERROR "variable DIR_SEP not defined") - set(DETECT "1") -else() - set(DETECT "0") -endif() - -configure_file(test_cmake_var.c.in - ${CMAKE_CURRENT_BINARY_DIR}/test_dir_sep_var.c - @ONLY) - -add_executable(test_dir_sep_var) -target_sources(test_dir_sep_var - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/test_dir_sep_var.c) -add_test(testDetectDir_sep test_dir_sep_var) - -if(NOT DEFINED PKGCONFIGDIR) - message(FATAL_ERROR "variable PKGCONFIGDIR not defined") - set(DETECT "1") -else() - set(DETECT "0") -endif() - -configure_file(test_cmake_var.c.in - ${CMAKE_CURRENT_BINARY_DIR}/test_pkgconfigdir_var.c - @ONLY) - -add_executable(test_pkgconfigdir_var) -target_sources(test_pkgconfigdir_var - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/test_pkgconfigdir_var.c) -add_test(testDetectPkgconfigdir test_pkgconfigdir_var) - -if(NOT DEFINED BINDIR) - message(FATAL_ERROR "variable BINDIR not defined") - set(DETECT "1") -else() - set(DETECT "0") -endif() - -configure_file(test_cmake_var.c.in - ${CMAKE_CURRENT_BINARY_DIR}/test_bindir_var.c - @ON
MonetDB: default - move python script
Changeset: 942a68bd6263 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=942a68bd6263 Added Files: misc/CMakeLists.txt misc/python/CMakeLists.txt misc/python/create_include_object.py.in misc/python/fixlicense.py Removed Files: buildtools/conf/fixlicense.py create_include_object.py.in Modified Files: CMakeLists.txt cmake/monetdb-functions.cmake Branch: default Log Message: move python script diffs (72 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,11 +140,6 @@ install(FILES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb COMPONENT monetdbdev) -# [TODO]: install created python file -configure_file(create_include_object.py.in - ${CMAKE_CURRENT_BINARY_DIR}/create_include_object.py - @ONLY) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-undefined,dynamic_lookup -Wl,-undefined,dynamic_lookup") endif() @@ -152,6 +147,7 @@ endif() add_subdirectory(common) add_subdirectory(clients) add_subdirectory(gdk) +add_subdirectory(misc) add_subdirectory(monetdb5) add_subdirectory(sql) add_subdirectory(geom) diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -83,7 +83,7 @@ function(create_include_object) foreach(mod_name IN LISTS create_prefix_modules_list) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${mod_name}.${lang_ext}.c - COMMAND ${Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/create_include_object.py ${mod_name} ${lang_ext} ${file_path}/${mod_name}.${lang_ext} ${CMAKE_CURRENT_BINARY_DIR}/${mod_name}.${lang_ext}.c + COMMAND ${Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/misc/python/create_include_object.py ${mod_name} ${lang_ext} ${file_path}/${mod_name}.${lang_ext} ${CMAKE_CURRENT_BINARY_DIR}/${mod_name}.${lang_ext}.c DEPENDS ${file_path}/${mod_name}.${lang_ext} ) list(APPEND include_sources diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/misc/CMakeLists.txt @@ -0,0 +1,9 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +add_subdirectory(python) diff --git a/misc/python/CMakeLists.txt b/misc/python/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/misc/python/CMakeLists.txt @@ -0,0 +1,12 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +# [TODO]: install created python file +configure_file(create_include_object.py.in + ${CMAKE_CURRENT_BINARY_DIR}/create_include_object.py + @ONLY) diff --git a/create_include_object.py.in b/misc/python/create_include_object.py.in rename from create_include_object.py.in rename to misc/python/create_include_object.py.in diff --git a/buildtools/conf/fixlicense.py b/misc/python/fixlicense.py rename from buildtools/conf/fixlicense.py rename to misc/python/fixlicense.py ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - use misc directory to collect all files that ...
Changeset: 3aeb1acf85c3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3aeb1acf85c3 Added Files: misc/AUTHORS misc/ChangeLog misc/ChangeLog-Archive misc/ChangeLog.Jun2020 misc/NEWS Removed Files: buildtools/AUTHORS buildtools/ChangeLog buildtools/ChangeLog-Archive buildtools/ChangeLog.Jun2020 buildtools/NEWS Branch: default Log Message: use misc directory to collect all files that have no obvious place within a source directory diffs (15 lines): diff --git a/buildtools/AUTHORS b/misc/AUTHORS rename from buildtools/AUTHORS rename to misc/AUTHORS diff --git a/buildtools/ChangeLog b/misc/ChangeLog rename from buildtools/ChangeLog rename to misc/ChangeLog diff --git a/buildtools/ChangeLog-Archive b/misc/ChangeLog-Archive rename from buildtools/ChangeLog-Archive rename to misc/ChangeLog-Archive diff --git a/buildtools/ChangeLog.Jun2020 b/misc/ChangeLog.Jun2020 rename from buildtools/ChangeLog.Jun2020 rename to misc/ChangeLog.Jun2020 diff --git a/buildtools/NEWS b/misc/NEWS rename from buildtools/NEWS rename to misc/NEWS ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - improve documentation, add cmake notes
Changeset: 84e2313812b5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=84e2313812b5 Added Files: README documentation/old/HowToRelease.rst documentation/old/HowToStart.rst documentation/old/README.rst documentation/old/windowsbuild.rst documentation/source/cmake.rst Removed Files: HowToStart.rst README.rst buildtools/doc/HowToRelease.rst buildtools/doc/Makefile buildtools/doc/windowsbuild.rst Modified Files: cmake/Modules/FindSphinx.cmake documentation/index.rst Branch: default Log Message: improve documentation, add cmake notes diffs (246 lines): diff --git a/README b/README new file mode 100644 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +The MonetDB Database System + +The MonetDB database is developed by the CWI database research group +(see https://www.monetdb.org/). + +Via the MonetDB project we have brought the MonetDB system in open source, +where it is accessible at https://www.monetdb.org/Downloads/ + +The MonetDB database system is a high-performance database kernel for +query-intensive applications. The MonetDB source can be found at our mercurial server (https://dev.monetdb.org/hg/MonetDB/). There is also a github clone (https://github.com/MonetDB/MonetDB) that is updated once a day. + +If you got a source distribution, please compile and install MonetDB first, +following the instructions in the "documentation" directory. + + +Copyright Notice + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. diff --git a/buildtools/doc/Makefile b/buildtools/doc/Makefile deleted file mode 100644 --- a/buildtools/doc/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: HowToRelease.html windowsbuild.html HowToRelease.pdf windowsbuild.pdf - -HowToRelease.html: HowToRelease.rst - rst2html HowToRelease.rst > HowToRelease.html - -windowsbuild.html: windowsbuild.rst - rst2html windowsbuild.rst > windowsbuild.html - -HowToRelease.pdf: HowToRelease.rst - rst2pdf HowToRelease.rst - -windowsbuild.pdf: windowsbuild.rst - rst2pdf windowsbuild.rst diff --git a/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake --- a/cmake/Modules/FindSphinx.cmake +++ b/cmake/Modules/FindSphinx.cmake @@ -1,14 +1,22 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + find_program(SPHINX_EXECUTABLE NAMES sphinx-build -HINTS -$ENV{SPHINX_DIR} -PATH_SUFFIXES bin -DOC "Sphinx documentation generator" + HINTS + $ENV{SPHINX_DIR} + PATH_SUFFIXES bin + DOC "Sphinx documentation generator" ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sphinx DEFAULT_MSG -SPHINX_EXECUTABLE + SPHINX_EXECUTABLE ) mark_as_advanced(SPHINX_EXECUTABLE) diff --git a/documentation/index.rst b/documentation/index.rst --- a/documentation/index.rst +++ b/documentation/index.rst @@ -24,6 +24,7 @@ Welcome to MonetDB's documentation! source/input source/json source/manual_pages + source/cmake source/release Indices and tables diff --git a/buildtools/doc/HowToRelease.rst b/documentation/old/HowToRelease.rst rename from buildtools/doc/HowToRelease.rst rename to documentation/old/HowToRelease.rst diff --git a/HowToStart.rst b/documentation/old/HowToStart.rst rename from HowToStart.rst rename to documentation/old/HowToStart.rst diff --git a/README.rst b/documentation/old/README.rst rename from README.rst rename to documentation/old/README.rst diff --git a/buildtools/doc/windowsbuild.rst b/documentation/old/windowsbuild.rst rename from buildtools/doc/windowsbuild.rst rename to documentation/old/windowsbuild.rst diff --git a/documentation/source/cmake.rst b/documentation/source/cmake.rst new file mode 100644 --- /dev/null +++ b/documentation/source/cmake.rst @@ -0,0 +1,142 @@ +.. This Source Code Form is subject to the terms of the Mozilla Public +.. License, v. 2.0. If a copy of the MPL was not distributed with this +.. file, You can obtain one at http://mozilla.org/MPL/2.0/. +.. +.. Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + += +CMake += + +``Introduction`` + + +``Packaging`` += +The source packages are located at https://www.monetdb.org/downloads/sources/Apr2019-SP1/ + +RPM +=== + +The source rpm's are located in https://www.monetdb.org/downloads/Fedora/source/ and are shared by all rpm based repositories. The debug packages are located in https://www.monetdb.org/downloads/Fedora/debug/ and https://www.monetdb.org/downloads/epe
MonetDB: default - remove markdown and move to rst
Changeset: 0bd8d9a8378a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0bd8d9a8378a Added Files: documentation/source/build-debian.rst documentation/source/build-fedora.rst documentation/source/build.rst documentation/source/design.rst documentation/source/release.rst Removed Files: README-Debian README-Fedora README.md Release.md Modified Files: documentation/index.rst Branch: default Log Message: remove markdown and move to rst diffs (truncated from 418 to 300 lines): diff --git a/README-Debian b/README-Debian deleted file mode 100644 --- a/README-Debian +++ /dev/null @@ -1,32 +0,0 @@ -The following packages (DEBs) are or can be used by MonetDB. - -These packages are required. - -cmake # version >= 3.12 -bison -gettext -libssl-dev -libxml2-dev -mercurial - -These packages are optional, but required when building the MonetDB -.deb packages. - -libbz2-dev # optional: read and write .bz2 compressed files -libcurl4-gnutls-dev# optional: read remote files with sys.getcontent(url) -libgeos-dev# optional: required for geom module -liblzma-dev# optional: read and write .xz compressed files -libpcre3-dev # optional: use PCRE library, enable some functions -libreadline-dev# optional, enable editing in mclient -python3-dev# optional, needed for Python 3 integration -python3-numpy # optional, needed for Python 3 integration -r-base # optional, needed for R integration -unixodbc-dev # optional, needed for ODBC driver -uuid-dev # optional -zlib1g-dev # optional: read and write .gz compressed files - -These packages are optional. - -libcfitsio-dev # optional: read FITS files -liblz4-dev # optional: compression in new (unused) MAPI protocol, also used to read and write .lz4 compressed files -libsnappy-dev # optional: compression in new (unused) MAPI protocol diff --git a/README-Fedora b/README-Fedora deleted file mode 100644 --- a/README-Fedora +++ /dev/null @@ -1,38 +0,0 @@ -The following packages (RPMs) are or can be used by MonetDB. - -These packages are required. - -cmake # version >= 3.12 -bison -gettext-devel -libxml2-devel -mercurial -openssl-devel - -These packages are optional, but they are required to build RPMs using -the command make rpm. - -bzip2-devel# optional: read and write .bz2 compressed files -bzip2 # optional, required to create a tar ball (make dist) -checkpolicy# optional, required to create RPMs (make rpm) -geos-devel # optional: required for geom module -libcurl-devel # optional: read remote files with sys.getcontent(url) -libuuid-devel # optional -pcre-devel # optional: use PCRE library, enable some functions -python3-devel # optional, needed for Python 3 integration -python3-numpy # optional, needed for Python 3 integration -R-core-devel # optional, needed for R integration -readline-devel # optional, enable editing in mclient -rpm-build # optional, required to create RPMs (make rpm) -selinux-policy-devel # optional, required to create RPMs (make rpm) -unixODBC-devel # optional, needed for ODBC driver - -These packages are optional. - -cfitsio-devel # optional: read FITS files -libasan# optional: --enable-sanitizer configuration (debug) -lz4-devel # optional: compression in new (unused) MAPI protocol, also used to read and write .lz4 compressed files -netcdf-devel # optional: read NetCDF files -proj-devel # optional, only optionally used in geom module -snappy-devel # optional: compression in new (unused) MAPI protocol -valgrind-devel # optional: --with-valgrind configuration (debug) diff --git a/README.md b/README.md deleted file mode 100644 --- a/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Building MonetDB from source - -## Summary - -For cmake, you should always build the code in a separate directory, say "build". This directory should be OUTSIDE of the source code tree. The results of the build are stored in this directory. The location on the filesystem is not important, as long as you have permissions to write in that location. - -Assuming the monetdb source code is checked out in directory "/path/to/monetdb/source". And if you have all the required packages (See below) to build MonetDB, these are the set of commands to build and *install* it from source. Install is one of the predefined targets [install, test, mtest]. When you test monetdb, you will likely not want to install it in the default location, the standard GNU directory structure. So you want to set the install prefix variable when generating the build system, using -DCMAKE_INSTALL_PR
MonetDB: default - improve sphinx setup
Changeset: 97abeeaa52a2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=97abeeaa52a2 Modified Files: cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-options.cmake documentation/CMakeLists.txt Branch: default Log Message: improve sphinx setup diffs (52 lines): diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -128,4 +128,6 @@ if(RINTEGRATION) find_package(LibR) endif() +find_package(Sphinx) + # vim: set ts=2:sw=2:et diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -142,6 +142,7 @@ function(monetdb_cmake_summary) message(STATUS "Netcdf library: ${NETCDF_FOUND}") message(STATUS "Readline library: ${READLINE_FOUND}") message(STATUS "R library: ${LIBR_FOUND}") + message(STATUS "Sphinx: ${SPHINX_FOUND}") message(STATUS "-") message(STATUS "") endfunction() diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake --- a/cmake/monetdb-options.cmake +++ b/cmake/monetdb-options.cmake @@ -18,7 +18,7 @@ else() endif() option(TESTING - "Enable support for testing" + "Enable support for testing" ON) cmake_dependent_option(CINTEGRATION diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -1,6 +1,12 @@ -find_package(Sphinx) - -if(SPHINX_EXECUTABLE) +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(SPHINX_FOUND) if(NOT DEFINED SPHINX_THEME) set(SPHINX_THEME default) endif() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - set path for export target configs
Changeset: ddf02aa51711 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ddf02aa51711 Modified Files: CMakeLists.txt clients/mapilib/CMakeLists.txt common/stream/CMakeLists.txt common/utils/CMakeLists.txt gdk/CMakeLists.txt monetdb5/tools/CMakeLists.txt sql/backends/monet5/CMakeLists.txt tools/monetdbe/CMakeLists.txt Branch: default Log Message: set path for export target configs diffs (117 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,10 @@ monetdb_configure_crypto() monetdb_configure_sizes() include(GNUInstallDirs) +# The documentation is unclear on what is the best location to install +# the configuration for the exported targets, especially when building +# the packages (deb/rpm). For now set the variable to a reasonable value +set(EXPORT_TARGET_PATH "${CMAKE_INSTALL_DATAROOTDIR}/monetdb/cmake") # Define the macro variables after configuring the install directories. # Some variables define additional installation settings. @@ -128,7 +132,7 @@ install(TARGETS install(EXPORT monetdb_config_headerTargets FILE monetdb_config_headerTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT monetdbdev) install(FILES @@ -159,7 +163,7 @@ endif() include(CMakePackageConfigHelpers) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MonetDBConfig.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cmake)" + INSTALL_DESTINATION "${EXPORT_TARGET_PATH}" NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) @@ -170,7 +174,7 @@ write_basic_package_version_file( install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MonetDBConfig.cmake - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT monetdbdev) include(monetdb-packages) diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -79,7 +79,7 @@ install(TARGETS install(EXPORT mapiTargets FILE mapiTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT clientdev) # vim: set ts=2:sw=2:et diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -116,5 +116,5 @@ install(TARGETS install(EXPORT streamTargets FILE streamTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT streamdev) diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/common/utils/CMakeLists.txt +++ b/common/utils/CMakeLists.txt @@ -170,7 +170,7 @@ install(TARGETS install(EXPORT matomicTargets FILE matomicTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT monetdbdev) install(FILES diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -140,5 +140,5 @@ install(TARGETS install(EXPORT gdkTargets FILE gdkTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT monetdbdev) diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt --- a/monetdb5/tools/CMakeLists.txt +++ b/monetdb5/tools/CMakeLists.txt @@ -74,7 +74,7 @@ install(TARGETS install(EXPORT monetdb5Targets FILE monetdb5Targets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT serverdev) # vim: set ts=2:sw=2:et diff --git a/sql/backends/monet5/CMakeLists.txt b/sql/backends/monet5/CMakeLists.txt --- a/sql/backends/monet5/CMakeLists.txt +++ b/sql/backends/monet5/CMakeLists.txt @@ -160,5 +160,5 @@ target_include_directories(sqlembedded install(EXPORT sqlTargets FILE sqlTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT monetdbdev) diff --git a/tools/monetdbe/CMakeLists.txt b/tools/monetdbe/CMakeLists.txt --- a/tools/monetdbe/CMakeLists.txt +++ b/tools/monetdbe/CMakeLists.txt @@ -73,5 +73,5 @@ install(TARGETS install(EXPORT monetdbeTargets FILE monetdbeTargets.cmake NAMESPACE MonetDB:: - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + DESTINATION ${EXPORT_TARGET_PATH} COMPONENT serverdev) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - remove old embedded code
Changeset: 6e2f27fa0a11 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e2f27fa0a11 Removed Files: ctest/tools/embedded/CMakeLists.txt ctest/tools/embedded/backup.c ctest/tools/embedded/example1.c ctest/tools/embedded/example2.c ctest/tools/embedded/example_append.c ctest/tools/embedded/example_blob.c ctest/tools/embedded/example_connections.c ctest/tools/embedded/example_decimals.c ctest/tools/embedded/example_temporal.c ctest/tools/embedded/mapi.c ctest/tools/embedded/mapi.h tools/embedded/CMakeLists.txt tools/embedded/monetdb_embedded.c tools/embedded/monetdb_embedded.h Modified Files: tools/CMakeLists.txt Branch: default Log Message: remove old embedded code diffs (truncated from 2974 to 300 lines): diff --git a/ctest/tools/embedded/CMakeLists.txt b/ctest/tools/embedded/CMakeLists.txt deleted file mode 100644 --- a/ctest/tools/embedded/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -#[[ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. -#]] - -add_executable(example1 example1.c) -target_link_libraries(example1 - PRIVATE -monetdb_config_header -embedded) -add_test(run_example1 example1) - -add_executable(example2 example2.c) -target_link_libraries(example2 - PRIVATE -monetdb_config_header -embedded) -add_test(run_example2 example2) - -add_executable(example_temporal example_temporal.c) -target_link_libraries(example_temporal - PRIVATE -monetdb_config_header -embedded) -add_test(run_example_temporal example_temporal) - -add_executable(example_decimals example_decimals.c) -target_link_libraries(example_decimals - PRIVATE -monetdb_config_header -embedded) -add_test(run_example_decimals example_decimals) - -add_executable(example_blob example_blob.c) -target_link_libraries(example_blob - PRIVATE -monetdb_config_header -embedded) -add_test(run_example_blob example_blob) - -add_executable(example_append example_append.c) -target_link_libraries(example_append - PRIVATE -monetdb_config_header -embedded) -add_test(run_example_append example_append) - -add_executable(backup backup.c mapi.h mapi.c ../../../clients/mapiclient/dump.c) -target_include_directories(backup PUBLIC .) -target_link_libraries(backup - PRIVATE -monetdb_config_header -embedded -stream -matomic) -add_test(run_backup backup) - -add_executable(example_connections example_connections.c) -target_link_libraries(example_connections - PRIVATE -monetdb_config_header -embedded) -add_test(run_example_connections example_connections) - diff --git a/ctest/tools/embedded/backup.c b/ctest/tools/embedded/backup.c deleted file mode 100644 --- a/ctest/tools/embedded/backup.c +++ /dev/null @@ -1,47 +0,0 @@ - -#include "monetdb_config.h" -#include "stream.h" -#include "mstring.h" -#include -#include -#include -#include "mapi.h" -#include - -extern int dump_database(Mapi mid, stream *toConsole, bool describe, bool useInserts); - -#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;} - -int -main(void) -{ - char* err = NULL; - Mapi mid = (Mapi)malloc(sizeof(struct MapiStruct)); - - if ((mid->msg = monetdb_open(&mid->mdbe, NULL)) != NULL) - error(mid->msg); - - if ((err = monetdb_query(mid->mdbe, "CREATE TABLE test (b bool, t tinyint, s smallint, x integer, l bigint, " -#ifdef HAVE_HGE - "h hugeint, " -#else - "h bigint, " -#endif - "f float, d double, y string)", NULL, NULL)) != NULL) - error(err) - if ((err = monetdb_query(mid->mdbe, "INSERT INTO test VALUES (TRUE, 42, 42, 42, 42, 42, 42.42, 42.42, 'Hello'), (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL) - error(err) - - /* open file stream */ - stream *fd = open_wastream("/tmp/backup"); - - if (dump_database(mid, fd, 0, 0)) { - if (mid->msg) - error(mid->msg) - fprintf(stderr, "database backup failed\n"); - } - close_stream(fd); - - if ((mid->msg = monetdb_close(mid->mdbe)) != NULL) - error(mid->msg); -} diff --git a/ctest/tools/embedded/example1.c b/ctest/tools/embedded/example1.c deleted file mode 100644 --- a/ctest/tools/embedded/example1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - */ - -#include "monetdb_embedded.h" -#include
MonetDB: default - find out if the system is big endian
Changeset: 0d818fadb95b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d818fadb95b Modified Files: CMakeLists.txt cmake/monetdb-functions.cmake Branch: default Log Message: find out if the system is big endian diffs (22 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ include(TestBigEndian REQUIRED) if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib) endif() +test_big_endian(IS_BIG_ENDIAN) # Include MonetDB specific functions include(monetdb-functions) diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -107,6 +107,7 @@ function(monetdb_cmake_summary) message(STATUS "") message(STATUS "Summary of cmake configuration of MonetDB") message(STATUS "-") + message(STATUS "System is big endian: ${IS_BIG_ENDIAN}") if(${CMAKE_VERSION} VERSION_LESS "3.14.0") message(STATUS "NumPy include dirs: ${NUMPY_INCLUDE_DIRS}") else() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - change function prefix to monetdbe_
Changeset: 54f9440b6b77 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54f9440b6b77 Modified Files: ctest/tools/monetdbe/backup.c ctest/tools/monetdbe/example1.c ctest/tools/monetdbe/example2.c ctest/tools/monetdbe/example_append.c ctest/tools/monetdbe/example_blob.c ctest/tools/monetdbe/example_connections.c ctest/tools/monetdbe/example_decimals.c ctest/tools/monetdbe/example_temporal.c ctest/tools/monetdbe/mapi.c ctest/tools/monetdbe/mapi.h tools/monetdbe/monetdbe.c tools/monetdbe/monetdbe.h Branch: default Log Message: change function prefix to monetdbe_ diffs (truncated from 2382 to 300 lines): diff --git a/ctest/tools/monetdbe/backup.c b/ctest/tools/monetdbe/backup.c --- a/ctest/tools/monetdbe/backup.c +++ b/ctest/tools/monetdbe/backup.c @@ -18,10 +18,10 @@ main(void) char* err = NULL; Mapi mid = (Mapi)malloc(sizeof(struct MapiStruct)); - if ((mid->msg = monetdb_open(&mid->mdbe, NULL)) != NULL) + if ((mid->msg = monetdbe_open(&mid->mdbe, NULL)) != NULL) error(mid->msg); - if ((err = monetdb_query(mid->mdbe, "CREATE TABLE test (b bool, t tinyint, s smallint, x integer, l bigint, " + if ((err = monetdbe_query(mid->mdbe, "CREATE TABLE test (b bool, t tinyint, s smallint, x integer, l bigint, " #ifdef HAVE_HGE "h hugeint, " #else @@ -29,7 +29,7 @@ main(void) #endif "f float, d double, y string)", NULL, NULL)) != NULL) error(err) - if ((err = monetdb_query(mid->mdbe, "INSERT INTO test VALUES (TRUE, 42, 42, 42, 42, 42, 42.42, 42.42, 'Hello'), (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL) + if ((err = monetdbe_query(mid->mdbe, "INSERT INTO test VALUES (TRUE, 42, 42, 42, 42, 42, 42.42, 42.42, 'Hello'), (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL) error(err) /* open file stream */ @@ -42,6 +42,6 @@ main(void) } close_stream(fd); - if ((mid->msg = monetdb_close(mid->mdbe)) != NULL) + if ((mid->msg = monetdbe_close(mid->mdbe)) != NULL) error(mid->msg); } diff --git a/ctest/tools/monetdbe/example1.c b/ctest/tools/monetdbe/example1.c --- a/ctest/tools/monetdbe/example1.c +++ b/ctest/tools/monetdbe/example1.c @@ -17,28 +17,28 @@ int main(void) { char* err = NULL; - monetdb_database mdbe = NULL; - monetdb_result* result = NULL; + monetdbe_database mdbe = NULL; + monetdbe_result* result = NULL; // second argument is a string for the db directory or NULL for in-memory mode - if ((err = monetdb_open(&mdbe, NULL)) != NULL) + if ((err = monetdbe_open(&mdbe, NULL)) != NULL) error(err) - if ((err = monetdb_query(mdbe, "CREATE TABLE test (x integer, y string)", NULL, NULL)) != NULL) + if ((err = monetdbe_query(mdbe, "CREATE TABLE test (x integer, y string)", NULL, NULL)) != NULL) error(err) - if ((err = monetdb_query(mdbe, "INSERT INTO test VALUES (42, 'Hello'), (NULL, 'World')", NULL, NULL)) != NULL) + if ((err = monetdbe_query(mdbe, "INSERT INTO test VALUES (42, 'Hello'), (NULL, 'World')", NULL, NULL)) != NULL) error(err) - if ((err = monetdb_query(mdbe, "SELECT x, y FROM test; ", &result, NULL)) != NULL) + if ((err = monetdbe_query(mdbe, "SELECT x, y FROM test; ", &result, NULL)) != NULL) error(err) fprintf(stdout, "Query result with %zu cols and %"PRId64" rows\n", result->ncols, result->nrows); for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { - monetdb_column* rcol; - if ((err = monetdb_result_fetch(result, &rcol, c)) != NULL) + monetdbe_column* rcol; + if ((err = monetdbe_result_fetch(result, &rcol, c)) != NULL) error(err) switch (rcol->type) { - case monetdb_int32_t: { - monetdb_column_int32_t * col = (monetdb_column_int32_t *) rcol; + case monetdbe_int32_t: { + monetdbe_column_int32_t * col = (monetdbe_column_int32_t *) rcol; if (col->data[r] == col->null_value) { printf("NULL"); } else { @@ -46,8 +46,8 @@ main(void) } break; } - case monetdb_str: { - monetdb_column_str * col = (monetdb_column_str *) rcol; +
MonetDB: default - also add late changeset to new library
Changeset: 9bb8531aa4bd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9bb8531aa4bd Modified Files: ctest/tools/monetdbe/CMakeLists.txt ctest/tools/monetdbe/example1.c ctest/tools/monetdbe/example2.c ctest/tools/monetdbe/example_append.c ctest/tools/monetdbe/example_blob.c ctest/tools/monetdbe/example_connections.c ctest/tools/monetdbe/example_decimals.c ctest/tools/monetdbe/example_temporal.c ctest/tools/monetdbe/mapi.c tools/monetdbe/monetdbe.c tools/monetdbe/monetdbe.h Branch: default Log Message: also add late changeset to new library diffs (272 lines): diff --git a/ctest/tools/monetdbe/CMakeLists.txt b/ctest/tools/monetdbe/CMakeLists.txt --- a/ctest/tools/monetdbe/CMakeLists.txt +++ b/ctest/tools/monetdbe/CMakeLists.txt @@ -18,7 +18,7 @@ target_link_libraries(example2 PRIVATE monetdb_config_header monetdbe) -add_test(run_example2 example2) +#add_test(run_example2 example2) add_executable(example_temporal example_temporal.c) target_link_libraries(example_temporal diff --git a/ctest/tools/monetdbe/example1.c b/ctest/tools/monetdbe/example1.c --- a/ctest/tools/monetdbe/example1.c +++ b/ctest/tools/monetdbe/example1.c @@ -34,7 +34,7 @@ main(void) for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { monetdb_column* rcol; - if ((err = monetdb_result_fetch(mdbe, result, &rcol, c)) != NULL) + if ((err = monetdb_result_fetch(result, &rcol, c)) != NULL) error(err) switch (rcol->type) { case monetdb_int32_t: { diff --git a/ctest/tools/monetdbe/example2.c b/ctest/tools/monetdbe/example2.c --- a/ctest/tools/monetdbe/example2.c +++ b/ctest/tools/monetdbe/example2.c @@ -40,7 +40,7 @@ main(void) for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { monetdb_column* rcol; - if ((err = monetdb_result_fetch(mdbe, result, &rcol, c)) != NULL) + if ((err = monetdb_result_fetch(result, &rcol, c)) != NULL) error(err) switch (rcol->type) { case monetdb_bool: { @@ -148,7 +148,7 @@ main(void) /* fetching the meta data should work */ for (size_t c = 0; c < result->ncols; c++) { monetdb_column* rcol; - if ((err = monetdb_result_fetch(mdbe, result, &rcol, c)) != NULL) + if ((err = monetdb_result_fetch(result, &rcol, c)) != NULL) error(err) } } diff --git a/ctest/tools/monetdbe/example_append.c b/ctest/tools/monetdbe/example_append.c --- a/ctest/tools/monetdbe/example_append.c +++ b/ctest/tools/monetdbe/example_append.c @@ -34,7 +34,7 @@ main(void) monetdb_column* rcol[2]; for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { - if ((err = monetdb_result_fetch(mdbe, result, rcol+c, c)) != NULL) + if ((err = monetdb_result_fetch(result, rcol+c, c)) != NULL) error(err) switch (rcol[c]->type) { case monetdb_int32_t: { @@ -77,7 +77,7 @@ main(void) fprintf(stdout, "Query result after append with %zu cols and %"PRId64" rows\n", result->ncols, result->nrows); for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { - if ((err = monetdb_result_fetch(mdbe, result, rcol+c, c)) != NULL) + if ((err = monetdb_result_fetch(result, rcol+c, c)) != NULL) error(err) switch (rcol[c]->type) { case monetdb_int32_t: { diff --git a/ctest/tools/monetdbe/example_blob.c b/ctest/tools/monetdbe/example_blob.c --- a/ctest/tools/monetdbe/example_blob.c +++ b/ctest/tools/monetdbe/example_blob.c @@ -36,7 +36,7 @@ main(void) for (int64_t r = 0; r < result->nrows; r++) { for (size_t c = 0; c < result->ncols; c++) { monetdb_column* rcol; - if ((err = monetdb_result_fetch(mdbe, result, &rcol, c)) != NULL) + if ((err = monetdb_result_fetch(result, &rcol, c)) != NULL) error(err) switch (rcol->type) { case monetdb_blob: { diff --git a/ctest/tools/monetdbe/example_connections.c b/ctest/tools/monetdbe/example_connections.c --- a/ctest/tools/monetdbe/example_connections.c +++ b/ct
MonetDB: default - first step in moving to monetdbe
Changeset: 746e70a943ea for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=746e70a943ea Added Files: ctest/tools/monetdbe/CMakeLists.txt ctest/tools/monetdbe/backup.c ctest/tools/monetdbe/example1.c ctest/tools/monetdbe/example2.c ctest/tools/monetdbe/example_append.c ctest/tools/monetdbe/example_blob.c ctest/tools/monetdbe/example_connections.c ctest/tools/monetdbe/example_decimals.c ctest/tools/monetdbe/example_temporal.c ctest/tools/monetdbe/mapi.c ctest/tools/monetdbe/mapi.h tools/monetdbe/CMakeLists.txt tools/monetdbe/monetdbe.c tools/monetdbe/monetdbe.h Modified Files: ctest/tools/CMakeLists.txt tools/CMakeLists.txt Branch: default Log Message: first step in moving to monetdbe diffs (truncated from 2920 to 300 lines): diff --git a/ctest/tools/CMakeLists.txt b/ctest/tools/CMakeLists.txt --- a/ctest/tools/CMakeLists.txt +++ b/ctest/tools/CMakeLists.txt @@ -6,4 +6,5 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] -add_subdirectory(embedded) +#add_subdirectory(embedded) +add_subdirectory(monetdbe) diff --git a/ctest/tools/monetdbe/CMakeLists.txt b/ctest/tools/monetdbe/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/ctest/tools/monetdbe/CMakeLists.txt @@ -0,0 +1,73 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +add_executable(example1 example1.c) +target_link_libraries(example1 + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example1 example1) + +add_executable(example2 example2.c) +target_link_libraries(example2 + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example2 example2) + +add_executable(example_temporal example_temporal.c) +target_link_libraries(example_temporal + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example_temporal example_temporal) + +add_executable(example_decimals example_decimals.c) +target_link_libraries(example_decimals + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example_decimals example_decimals) + +add_executable(example_blob example_blob.c) +target_link_libraries(example_blob + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example_blob example_blob) + +add_executable(example_append example_append.c) +target_link_libraries(example_append + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example_append example_append) + +add_executable(backup + backup.c + mapi.h + mapi.c + ${CMAKE_SOURCE_DIR}/clients/mapiclient/dump.c) +target_include_directories(backup + PRIVATE + ${CMAKE_SOURCE_DIR}/clients/mapilib) +target_link_libraries(backup + PRIVATE +monetdb_config_header +monetdbe +stream +matomic) +add_test(run_backup backup) + +add_executable(example_connections example_connections.c) +target_link_libraries(example_connections + PRIVATE +monetdb_config_header +monetdbe) +add_test(run_example_connections example_connections) + diff --git a/ctest/tools/monetdbe/backup.c b/ctest/tools/monetdbe/backup.c new file mode 100644 --- /dev/null +++ b/ctest/tools/monetdbe/backup.c @@ -0,0 +1,47 @@ + +#include "monetdb_config.h" +#include "stream.h" +#include "mstring.h" +#include +#include +#include +#include "mapi.h" +#include + +extern int dump_database(Mapi mid, stream *toConsole, bool describe, bool useInserts); + +#define error(msg) {fprintf(stderr, "Failure: %s\n", msg); return -1;} + +int +main(void) +{ + char* err = NULL; + Mapi mid = (Mapi)malloc(sizeof(struct MapiStruct)); + + if ((mid->msg = monetdb_open(&mid->mdbe, NULL)) != NULL) + error(mid->msg); + + if ((err = monetdb_query(mid->mdbe, "CREATE TABLE test (b bool, t tinyint, s smallint, x integer, l bigint, " +#ifdef HAVE_HGE + "h hugeint, " +#else + "h bigint, " +#endif + "f float, d double, y string)", NULL, NULL)) != NULL) + error(err) + if ((err = monetdb_query(mid->mdbe, "INSERT INTO test VALUES (TRUE, 42, 42, 42, 42, 42, 42.42, 42.42, 'Hello'), (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'World')", NULL, NULL)) != NULL) + error(err) + + /* open file stream */ + stream *fd = open_wastream("/tmp/backup"); + + if (dump_database(mid, fd, 0, 0)) { + if (mid->msg) + error(mid->msg) + fprintf(stderr, "database backup failed\n"); + } + close_stream(fd); + + if ((mid->msg = monetdb_close(mid->mdbe)) != NULL) + error(mid->msg); +} diff --git a/ctest/tools/monetdbe/example1.c b/ctest/tools/monetdbe/example1.c new file mode 100644 --- /dev/null
MonetDB: default - cleanup public header definitions
Changeset: 71fc4c14752a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71fc4c14752a Modified Files: common/options/CMakeLists.txt common/stream/CMakeLists.txt geom/lib/CMakeLists.txt geom/monetdb5/CMakeLists.txt monetdb5/mal/CMakeLists.txt sql/backends/monet5/CMakeLists.txt Branch: default Log Message: cleanup public header definitions diffs (112 lines): diff --git a/common/options/CMakeLists.txt b/common/options/CMakeLists.txt --- a/common/options/CMakeLists.txt +++ b/common/options/CMakeLists.txt @@ -31,10 +31,6 @@ target_link_libraries(moptions monetdb_config_header $<$:${GETOPT_LIB}>) -#if(WIN32) -# target_compile_definitions(moptions PRIVATE LIBMOPTIONS LIBGDK LIBMAPI) -#endif() - set_target_properties(moptions PROPERTIES POSITION_INDEPENDENT_CODE ON diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -7,10 +7,10 @@ #]] set(stream_public_headers - $/stream.h> - $/stream_socket.h> - $/stream.h> - $/stream_socket.h>) + $ + $ + $ + $) add_library(stream SHARED) diff --git a/geom/lib/CMakeLists.txt b/geom/lib/CMakeLists.txt --- a/geom/lib/CMakeLists.txt +++ b/geom/lib/CMakeLists.txt @@ -30,8 +30,7 @@ if(GEOS_FOUND) set_target_properties(geomlib PROPERTIES -POSITION_INDEPENDENT_CODE ON -PUBLIC_HEADER "${sqlserver_public_headers}") +POSITION_INDEPENDENT_CODE ON) target_compile_definitions(geomlib PRIVATE LIBGEOM) endif() diff --git a/geom/monetdb5/CMakeLists.txt b/geom/monetdb5/CMakeLists.txt --- a/geom/monetdb5/CMakeLists.txt +++ b/geom/monetdb5/CMakeLists.txt @@ -9,18 +9,9 @@ if(GEOS_FOUND) add_library(geomodule MODULE) - #set(include_mal_files - # geom - # geom_funcs) - set(include_sql_files 40_geom) - #create_include_object( - # MAL_LANGUAGE - # name_module "geomodule" - # modules_list ${include_mal_files}) - create_include_object( SQL_LANGUAGE name_module "geomodule" @@ -35,7 +26,6 @@ if(GEOS_FOUND) geom.c geomBulk.c geom_upgrade.c - # ${MONETDB_CURRENT_MAL_SOURCES} ${MONETDB_CURRENT_SQL_SOURCES} PUBLIC ${geomodule_public_headers}) diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt --- a/monetdb5/mal/CMakeLists.txt +++ b/monetdb5/mal/CMakeLists.txt @@ -15,7 +15,9 @@ set(mal_public_headers ${CMAKE_CURRENT_SOURCE_DIR}/mal_type.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_stack.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_namespace.h - ${CMAKE_CURRENT_SOURCE_DIR}/mal_errors.h) + ${CMAKE_CURRENT_SOURCE_DIR}/mal_errors.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_client.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_authorize.h) add_library(mal OBJECT) @@ -53,8 +55,6 @@ target_sources(mal mal_prelude.c mel.h PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/mal_client.h - ${CMAKE_CURRENT_SOURCE_DIR}/mal_authorize.h ${mal_public_headers}) target_include_directories(mal diff --git a/sql/backends/monet5/CMakeLists.txt b/sql/backends/monet5/CMakeLists.txt --- a/sql/backends/monet5/CMakeLists.txt +++ b/sql/backends/monet5/CMakeLists.txt @@ -7,8 +7,8 @@ #]] set(sql_public_headers - $/sql_import.h> - $/sql_import.h>) + $ + $) #add_library(sql MODULE) add_library(sql SHARED) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - improve generating pkgconfig files
Changeset: 44c0c6c89201 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44c0c6c89201 Modified Files: clients/mapilib/monetdb-mapi.pc.in common/stream/CMakeLists.txt common/stream/monetdb-stream.pc.in gdk/monetdb-gdk.pc.in monetdb5/tools/CMakeLists.txt monetdb5/tools/monetdb5.pc.in Branch: default Log Message: improve generating pkgconfig files diffs (121 lines): diff --git a/clients/mapilib/monetdb-mapi.pc.in b/clients/mapilib/monetdb-mapi.pc.in --- a/clients/mapilib/monetdb-mapi.pc.in +++ b/clients/mapilib/monetdb-mapi.pc.in @@ -4,15 +4,10 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${exec_prefix} -libdir=${libdir} -includedir=${includedir} - Name: monetdb-mapi Description: MonetDB MAPI C-client libary Version: @MONETDB_VERSION@ Requires: monetdb-stream openssl -Libs: -L${libdir} -lmapi -Cflags: -I${includedir}/monetdb +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmapi +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -79,7 +79,7 @@ if (NOT WIN32) set(PKG_SNAPPY "snappy") endif() - if(ICONV_FOUND AND NOT ICONV_IS_BUILT_IN) + if(ICONV_FOUND AND NOT Iconv_IS_BUILT_IN) get_filename_component(ICONV_LIBRARIES_PATH "${ICONV_LIBRARIES}" DIRECTORY) diff --git a/common/stream/monetdb-stream.pc.in b/common/stream/monetdb-stream.pc.in --- a/common/stream/monetdb-stream.pc.in +++ b/common/stream/monetdb-stream.pc.in @@ -4,15 +4,10 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${exec_prefix} -libdir=${libdir} -includedir=${includedir} - Name: monetdb-stream Description: MonetDB streams libary Version: @MONETDB_VERSION@ Requires: @PKG_ZLIB@ @PKG_BZIP2@ @PKG_CURL@ @PKG_LZMA@ @PKG_SNAPPY@ -Libs: -L${libdir} -lstream @PKG_LIBICONV@ -Cflags: -I${includedir}/monetdb +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lstream @SOCKET_LIBS@ @PKG_LIBICONV@ +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb diff --git a/gdk/monetdb-gdk.pc.in b/gdk/monetdb-gdk.pc.in --- a/gdk/monetdb-gdk.pc.in +++ b/gdk/monetdb-gdk.pc.in @@ -4,15 +4,10 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${exec_prefix} -libdir=${libdir} -includedir=${includedir} - Name: monetdb-gdk Description: MonetDB GDK libary Version: @MONETDB_VERSION@ Requires: monetdb-stream -Libs: -L${libdir} -lbat -lm @CMAKE_THREAD_LIBS_INIT@ @CMAKE_DL_LIBS@ -Cflags: -I${includedir}/monetdb +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lbat -lm @CMAKE_THREAD_LIBS_INIT@ -l@CMAKE_DL_LIBS@ +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt --- a/monetdb5/tools/CMakeLists.txt +++ b/monetdb5/tools/CMakeLists.txt @@ -32,17 +32,18 @@ set_target_properties(monetdb5 SOVERSION ${MONETDB5_VERSION_MAJOR}) if (NOT WIN32) - if(XML2_FOUND) + if(LibXml2_FOUND) set(PKG_LIBXML2 "libxml-2.0") endif() if(OPENSSL_FOUND) -# In OpenSSL case, we link only to the crypto library, so it will be always one library to link to +# In OpenSSL case, we link only to the crypto library, so it will be +# always one library to link to get_filename_component(CRYPTO_LIBRARIES_PATH "${CRYPTO_LIBRARIES}" DIRECTORY) set(PKG_CRYPTO "-L${CRYPTO_LIBRARIES_PATH} -lcrypto") endif() - if(HAVE_LIBPCRE) + if(PCRE_FOUND) get_filename_component(PCRE_LIBRARIES_PATH "${PCRE_LIBRARIES}" DIRECTORY) set(PKG_PCRE "-L${PCRE_LIBRARIES_PATH} -lpcre") endif() diff --git a/monetdb5/tools/monetdb5.pc.in b/monetdb5/tools/monetdb5.pc.in --- a/monetdb5/tools/monetdb5.pc.in +++ b/monetdb5/tools/monetdb5.pc.in @@ -4,15 +4,10 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${exec_prefix} -libdir=${libdir} -includedir=${includedir} - Name: monetdb5 Description: MonetDB5 Version: @MONETDB_VERSION@ Requires: monetdb-gdk monetdb-stream @PKG_LIBXML2@ -Libs: -L${libdir} -lmonetdb5 @PKG_CRYPTO@ @PKG_PCRE@ -Cflags: -I${includedir}/monetdb +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmonetdb5 @PKG_CRYPTO@ @PKG_PCRE@ +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - partial cleanup of public headers definitions
Changeset: 1d638385ea90 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d638385ea90 Modified Files: gdk/CMakeLists.txt tools/embedded/CMakeLists.txt Branch: default Log Message: partial cleanup of public headers definitions diffs (68 lines): diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -7,28 +7,28 @@ #]] set(gdk_public_headers - $/gdk.h> - $/gdk_system.h> - $/gdk_posix.h> - $/gdk_atoms.h> - $/gdk_tracer.h> - $/gdk_delta.h> - $/gdk_hash.h> - $/gdk_bbp.h> - $/gdk_utils.h> - $/gdk_cand.h> - $/gdk_calc.h> - $/gdk.h> - $/gdk_system.h> - $/gdk_posix.h> - $/gdk_atoms.h> - $/gdk_tracer.h> - $/gdk_delta.h> - $/gdk_hash.h> - $/gdk_bbp.h> - $/gdk_utils.h> - $/gdk_calc.h> - $/gdk_cand.h>) + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) add_library(gdk SHARED) diff --git a/tools/embedded/CMakeLists.txt b/tools/embedded/CMakeLists.txt --- a/tools/embedded/CMakeLists.txt +++ b/tools/embedded/CMakeLists.txt @@ -7,8 +7,8 @@ #]] set(embedded_public_headers - $/monetdb_embedded.h> - $/monetdb_embedded.h>) + $ + $) add_library(embedded SHARED) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mbedded - port debian control and monetdb.spec to cpack
Changeset: 5dbd6d598148 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5dbd6d598148 Modified Files: CMakeLists.txt cmake/monetdb-deb-packages.cmake cmake/monetdb-rpm-packages.cmake cmake/monetdb-versions.cmake ctest/cmake/CMakeLists.txt monetdb5/extras/mal_optimizer_template/CMakeLists.txt sql/backends/monet5/CMakeLists.txt sql/backends/monet5/vaults/fits/CMakeLists.txt Branch: mbedded Log Message: port debian control and monetdb.spec to cpack diffs (truncated from 641 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ include(CMakeDependentOption REQUIRED) include(monetdb-options) include(monetdb-versions) project(MonetDB VERSION "${MONETDB_VERSION}" LANGUAGES C) +set(CMAKE_PROJECT_HOMEPAGE_URL "https://www.monetdb.org/";) set(C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 99) diff --git a/cmake/monetdb-deb-packages.cmake b/cmake/monetdb-deb-packages.cmake --- a/cmake/monetdb-deb-packages.cmake +++ b/cmake/monetdb-deb-packages.cmake @@ -6,74 +6,188 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "unknown") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "MonetDB BV ") set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_SECTION "misc") +set(CPACK_DEBIAN_PACKAGE_SOURCE "monetdb") +# set(CPACK_DEBIAN_PACKAGE_DEPENDS "") -# Use 3 backslashes to make the variable a literal string -#set(CPACK_DEBIAN_PACKAGE_DEPENDS "\\\${misc:Depends}") -#set(CPACK_DEBIAN_PACKAGE_SECTION "misc") -#set(CPACK_COMPONENTS_IGNORE_GROUPS 1) - -set(CPACK_DEBIAN_PACKAGE_monetdb_NAME "${CMAKE_PROJECT_NAME}-18") -set(CPACK_DEBIAN_PACKAGE_monetdb_ARCH "any") -set(CPACK_DEBIAN_PACKAGE_monetdb_VERSION "0.4.12") -set(CPACK_DEBIAN_PACKAGE_monetdb_CONFLICTS +set(CPACK_DEBIAN_MONETDB_PACKAGE_NAME "libmonetdb${GDK_VERSION_MAJOR}") +set(CPACK_DEBIAN_MONETDB_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}") +set(CPACK_DEBIAN_MONETDB_PACKAGE_CONFLICTS "libmonetdb5-server-geom (<< \\\${source:Version})") -set(CPACK_DEBIAN_PACKAGE_monetdb_DESRCIPTION "MonetDB core library") -set(CPACK_DEBIAN_PACKAGE_monetdb_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}") +set(CPACK_COMPONENT_MONETDB_DESCRIPTION "MonetDB core library + MonetDB is a database management system that is developed from a + main-memory perspective with use of a fully decomposed storage model, + automatic index management, extensibility of data types and search + accelerators. It also has an SQL front end. + . + This package contains the core components of MonetDB in the form of a + single shared library. If you want to use MonetDB, you will certainly + need this package, but you will also need at least the monetdb5-server + package, and most likely also monetdb5-sql, as well as one or + more client packages. +") + +set(CPACK_DEBIAN_MONETDBDEV_PACKAGE_NAME "libmonetdb-dev") +set(CPACK_DEBIAN_MONETDBDEV_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}, libmonetdb${GDK_VERSION_MAJOR}, libmonetdb-stream-dev") +set(CPACK_COMPONENT_MONETDBDEV_DESCRIPTION "MonetDB development files + MonetDB is a database management system that is developed from a + main-memory perspective with use of a fully decomposed storage model, + automatic index management, extensibility of data types and search + accelerators. It also has an SQL front end. + . + This package contains files needed to develop extensions to the core + functionality of MonetDB. +") -set(CPACK_DEBIAN_PACKAGE_monetdbdev_NAME "${CMAKE_PROJECT_NAME}-monetdb-dev") -set(CPACK_DEBIAN_PACKAGE_monetdbev_ARCH "any") -set(CPACK_DEBIAN_PACKAGE_monetdbdev_VERSION "0.4.12") -set(CPACK_DEBIAN_PACKAGE_monetdbdev_DEPENDS "libmonetdb18, libmonetdb-stream-dev") -set(CPACK_DEBIAN_PACKAGE_monetdbdev_DESRCIPTION "MonetDB development files") -set(CPACK_DEBIAN_PACKAGE_streamdev_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}") +set(CPACK_DEBIAN_STREAM_PACKAGE_NAME "libmonetdb-stream${STREAM_VERSION_MAJOR}") +set(CPACK_DEBIAN_STREAM_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}") +set(CPACK_COMPONENT_STREAM_DESCRIPTION "MonetDB stream library + MonetDB is a database management system that is developed from a + main-memory perspective with use of a fully decomposed storage model, + automatic index management, extensibility of data types and search + accelerators. It also has an SQL front end. + . + This package contains a shared library (libstream) which is needed by + various other components. +") + +set(CPACK_DEBIAN_STREAMDEV_PACKAGE_NAME "libmonetdb-stream-dev") +set(CPACK_DEBIAN_STREAMDEV_PACKAGE_DEPENDS "\\\${shlibs:Depends}, \\\${misc:Depends}, libmonetdb-stream${STREAM_VERSION_MAJOR} (= \\\${source:Version}") +set(CPACK_COMPONENT_STREAMDEV_DESCRIPTION "MonetDB stream library development files + Mon
MonetDB: mbedded - more cmake code cleanup and testing
Changeset: 8fe4fd6137d7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8fe4fd6137d7 Added Files: ctest/cmake/detect-gdal.cmake ctest/cmake/detect-geos.cmake ctest/cmake/detect-libpy3.cmake ctest/cmake/detect-uuid.cmake ctest/cmake/detect-valgrind.cmake ctest/cmake/test_detect_gdal.c.in ctest/cmake/test_detect_geos.c.in ctest/cmake/test_detect_libpy3.c.in ctest/cmake/test_detect_uuid.c.in ctest/cmake/test_detect_valgrind.c.in Modified Files: clients/odbc/CMakeLists.txt cmake/Modules/FindNumPy.cmake cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-options.cmake ctest/cmake/CMakeLists.txt ctest/cmake/set-cmake-vars.cmake ctest/cmake/set-dir-vars.cmake geom/monetdb5/CMakeLists.txt monetdb_config.h.in monetdb_config_win32.h.in sql/backends/monet5/vaults/fits/CMakeLists.txt sql/backends/monet5/vaults/lidar/CMakeLists.txt testing/CMakeLists.txt Branch: mbedded Log Message: more cmake code cleanup and testing diffs (truncated from 837 to 300 lines): diff --git a/clients/odbc/CMakeLists.txt b/clients/odbc/CMakeLists.txt --- a/clients/odbc/CMakeLists.txt +++ b/clients/odbc/CMakeLists.txt @@ -6,7 +6,7 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] -if(HAVE_ODBC) +if(ODBC_FOUND) if(WIN32) add_subdirectory(winsetup) else() @@ -14,4 +14,4 @@ if(HAVE_ODBC) endif() add_subdirectory(driver) add_subdirectory(samples) -endif(HAVE_ODBC) +endif() diff --git a/cmake/Modules/FindNumPy.cmake b/cmake/Modules/FindNumPy.cmake --- a/cmake/Modules/FindNumPy.cmake +++ b/cmake/Modules/FindNumPy.cmake @@ -86,4 +86,7 @@ else() "${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}") set(NUMPY_FOUND TRUE) +if(NUMPY_FOUND) + set(Python3_NumPy_FOUND 1) +endif() endif() diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -49,6 +49,7 @@ function(monetdb_configure_defines) find_path(HAVE_GETOPT_H "getopt.h") check_include_file("stdatomic.h" HAVE_STDATOMIC_H) + find_library(GETOPT_LIB "getopt.lib") check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H) @@ -114,9 +115,7 @@ function(monetdb_configure_defines) check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) - if(HAVE_GETOPT_H) -set(HAVE_GETOPT 1 PARENT_SCOPE) - endif() + check_symbol_exists("regcomp" "regex.h" HAVE_POSIX_REGEX) endfunction() macro(monetdb_macro_variables) @@ -144,6 +143,17 @@ macro(monetdb_macro_variables) set(HAVE_READLINE ${READLINE_FOUND}) set(HAVE_LIBR ${LIBR_FOUND}) set(RHOME "${LIBR_HOME}") + set(HAVE_GEOM ${GEOS_FOUND}) + set(HAVE_SHP ${GDAL_FOUND}) + + if(PY3INTEGRATION) +set(HAVE_LIBPY3 "${Python3_NumPy_FOUND}") + else() +message(STATUS "Disable Py3integration, because required NumPy is missing") + endif() + if(Python3_Interpreter_FOUND) +set(Python_EXECUTABLE "${Python3_EXECUTABLE}") + endif() set(SOCKET_LIBRARIES "") if (WIN32) @@ -161,6 +171,22 @@ macro(monetdb_macro_variables) CACHE INTERNAL "C udfs extension is available") + if(HAVE_GETOPT_H) +set(HAVE_GETOPT 1) + endif() + # Check with STATIC_CODE_ANALYSIS + # compiler options, profiling (google perf tools), valgrind + set(ENABLE_STATIC_ANALYSIS +"NO" +CACHE +STRING +"Configure for static code analysis (use only if you know what you are doing)") + # Check that posix regex is available when pcre is not found + # "monetdb5/module/mal/pcre.c" assumes the regex library is available + # as an alternative without checking this in the C code. + if(NOT PCRE_FOUND AND NOT HAVE_POSIX_REGEX) +message(FATAL_ERROR "PCRE library or GNU regex library not found but required for MonetDB5") + endif() set(DIR_SEP "/") set(PATH_SEP ":") diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -14,26 +14,8 @@ find_package(Threads) if(${CMAKE_VERSION} VERSION_LESS "3.14.0") find_package(Python3 COMPONENTS Interpreter Development) find_package(NumPy) - if(Python3_Interpreter_FOUND) -set(Python_EXECUTABLE "${Python3_EXECUTABLE}") - endif(Python3_Interpreter_FOUND) - if(NumPy_FOUND) -set(Python3_NumPy_FOUND 1) - endif(NumPy_FOUND) else() find_package(Python3 COMPONENTS Interpreter Development NumPy) - if(Python3_Interpreter_FOUND) -set(Python_EXECUTABLE "${Python3_EXECUTABLE}") - endif(Python3_Interpreter_FOUND) -endif() -if(PY3INTEGRATIO
MonetDB: mbedded - cleanup cmake code, add tests and fix bugs
Changeset: 063b05bb3840 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=063b05bb3840 Added Files: ctest/cmake/detect-fits.cmake ctest/cmake/detect-libr.cmake ctest/cmake/detect-snappy.cmake ctest/cmake/set-cmake-vars.cmake ctest/cmake/test_detect_fits.c.in ctest/cmake/test_detect_libr.c.in ctest/cmake/test_detect_snappy.c.in Modified Files: cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-options.cmake ctest/cmake/CMakeLists.txt ctest/cmake/detect-curl.cmake monetdb5/extras/rapi/CMakeLists.txt monetdb_config.h.in monetdb_config_win32.h.in sql/backends/monet5/UDF/capi/CMakeLists.txt Branch: mbedded Log Message: cleanup cmake code, add tests and fix bugs diffs (truncated from 577 to 300 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -137,10 +137,13 @@ macro(monetdb_macro_variables) set(HAVE_LIBLZ4 ${LZ4_FOUND}) set(HAVE_PROJ ${PROJ_FOUND}) set(HAVE_SNAPPY ${SNAPPY_FOUND}) + set(HAVE_FITS ${CFITSIO_FOUND}) set(HAVE_UUID ${HAVE_UUID_GENERATE}) set(HAVE_VALGRIND ${VALGRIND_FOUND}) set(HAVE_NETCDF ${NETCDF_FOUND}) set(HAVE_READLINE ${READLINE_FOUND}) + set(HAVE_LIBR ${LIBR_FOUND}) + set(RHOME "${LIBR_HOME}") set(SOCKET_LIBRARIES "") if (WIN32) @@ -153,6 +156,11 @@ macro(monetdb_macro_variables) if(WIN_GETADDRINFO) set(HAVE_GETADDRINFO 1) endif() + set(HAVE_CUDF +${CINTEGRATION} +CACHE +INTERNAL +"C udfs extension is available") set(DIR_SEP "/") set(PATH_SEP ":") diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -64,7 +64,7 @@ if(WITH_BZ2) endif() if(WITH_CURL) - find_package(CURL CONFIG) + find_package(CURL) endif() if(WITH_ZLIB) @@ -80,7 +80,7 @@ if(WITH_PROJ) endif() if(WITH_SNAPPY) - find_package(Snappy CONFIG) + find_package(Snappy) endif() if(WITH_UUID) @@ -99,10 +99,6 @@ if(FITS) find_package(CFitsIO) endif() -if(CINTEGRATION) - set(HAVE_CUDF ON CACHE INTERNAL "C udfs extension is available") -endif() - if(NETCDF) find_package(NetCDF) endif() @@ -150,8 +146,6 @@ endif(ODBC) if(RINTEGRATION) find_package(LibR) - set(HAVE_LIBR "${LIBR_FOUND}") - set(RHOME "${LIBR_HOME}") endif() # vim: set ts=2:sw=2:et diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -131,12 +131,14 @@ function(monetdb_cmake_summary) message(STATUS "Zlib library: ${ZLIB_FOUND}") message(STATUS "Lz4 library: ${LZ4_FOUND}") message(STATUS "Proj library: ${PROJ_FOUND}") + message(STATUS "Snappy library: ${SNAPPY_FOUND}") message(STATUS "Geos library: ${GEOS_FOUND}") message(STATUS "Gdal library: ${GDAL_FOUND}") message(STATUS "Cfitsio library: ${CFITSIO_FOUND}") message(STATUS "Kvm library: ${KVM_FOUND}") message(STATUS "Netcdf library: ${NETCDF_FOUND}") message(STATUS "Readline library: ${READLINE_FOUND}") + message(STATUS "R library: ${LIBR_FOUND}") message(STATUS "-") message(STATUS "") endfunction() diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake --- a/cmake/monetdb-options.cmake +++ b/cmake/monetdb-options.cmake @@ -69,8 +69,6 @@ cmake_dependent_option(SHP GEOM ON) -set(ENABLE_MAPI "YES" CACHE STRING "Enable MAPI (default=YES)") # Check with HAVE_MAPI - option(SANITIZER "Enable support for the GCC address sanitizer (default=OFF)" OFF) diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -30,6 +30,9 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dete include(${CMAKE_CURRENT_SOURCE_DIR}/detect-proj.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-netcdf.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-readline.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-libr.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-snappy.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-fits.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-unixgetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-wingetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-getaddrinfo.cmake) @@ -38,3 +41,4 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dete include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadsig.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/set-dir-vars.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/set-cmake-vars.cmake) diff --git a/ctest/cmake/detect-curl.cmake b/ctest/cmake/detect-curl.cmake --- a/ctest/cmake/detect-curl.cmake +++ b/ctest/cmake/detect-curl.cmake @@ -30,16 +30,16 @@ elseif (${LINUX_DISTRO} STREQUAL "ubun
MonetDB: mbedded - more code reorganization
Changeset: f718f3f0bf91 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f718f3f0bf91 Modified Files: CMakeLists.txt cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message: more code reorganization diffs (truncated from 384 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,13 @@ include(TestBigEndian REQUIRED) if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib) endif() + # Include MonetDB specific functions include(monetdb-functions) include(monetdb-findpackages) +include(monetdb-toolchain) +monetdb_default_toolchain() + include(monetdb-defines) monetdb_hg_revision() @@ -58,66 +62,27 @@ endif() monetdb_configure_defines() -# On C99, but we have to calculate the size -check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) -set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) if(HAVE_NETDB_H) set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") endif() if(HAVE_WINSOCK_H) set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") endif() -check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C) - set(CMAKE_REQUIRED_INCLUDES "/usr/include") monetdb_configure_crypto() - -check_type_size(ssize_t SIZEOF_SSIZE_T LANGUAGE C) -if(NOT HAVE_SIZEOF_SSIZE_T) - # Set a default value - if(CMAKE_SIZEOF_VOID_P EQUAL 8) -set(ssize_t "int64_t") - else() -set(ssize_t "int32_t") - endif() - set(SIZEOF_SSIZE_T ${CMAKE_SIZEOF_VOID_P}) -endif() -check_type_size(char SIZEOF_CHAR LANGUAGE C) -check_type_size(short SIZEOF_SHORT LANGUAGE C) -check_type_size(int SIZEOF_INT LANGUAGE C) -check_type_size(long SIZEOF_LONG LANGUAGE C) -check_type_size(wchar_t SIZEOF_WCHAR_T LANGUAGE C) - -if(MSVC) - set(_Noreturn "__declspec(noreturn)") - # C99 feature not present in MSVC - set(restrict "__restrict") - # C99 feature only available on C++ compiler in MSVC - # https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=vs-2015 - set(inline "__inline") -endif() +monetdb_configure_sizes() include(GNUInstallDirs) # Define the macro variables after configuring the install directories. # Some variables define additional installation settings. monetdb_macro_variables() +monetdb_configure_misc() # Define custom target after the install directories variables. # Some custom target will need these setting. include(monetdb-custom-targets) -# Used for installing testing python module (don't pass a location, else we need to strip this again) -execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,''))" - RESULT_VARIABLE PY3_LIBDIR_CODE - OUTPUT_VARIABLE PYTHON3_SITEDIR - OUTPUT_STRIP_TRAILING_WHITESPACE) -if (PY3_LIBDIR_CODE) - message(WARNING "Could not determine MonetDB Python3 site-packages instalation directory") -endif() -set(PYTHON3_LIBDIR "${PYTHON3_SITEDIR}") -set(PYTHON "${Python3_EXECUTABLE}") - SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") @@ -133,21 +98,6 @@ set(PROGRAM_PERMISSIONS_DEFAULT WORLD_READ WORLD_EXECUTE) -# Set host information -string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER) -string(TOLOWER "${CMAKE_SYSTEM_NAME}" CMAKE_SYSTEM_NAME_LOWER) -string(TOLOWER "${CMAKE_C_COMPILER_ID}" CMAKE_C_COMPILER_ID_LOWER) -set("HOST" "${CMAKE_SYSTEM_PROCESSOR_LOWER}-pc-${CMAKE_SYSTEM_NAME_LOWER}-${CMAKE_C_COMPILER_ID_LOWER}") - -# Password hash algorithm -set(PASSWORD_BACKEND "SHA512" - CACHE STRING - "Password hash algorithm, one of MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512, defaults to SHA512") - -if(NOT ${PASSWORD_BACKEND} MATCHES "^MD5|SHA1|RIPEMD160|SHA224|SHA256|SHA384|SHA512$") - message(FATAL_ERROR "PASSWORD_BACKEND invalid, choose one of MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512") -endif() - find_program(BASH NAMES bash DOC "bash interpreter fullpath") if(WIN32) diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -234,3 +234,80 @@ macro(monetdb_configure_crypto) endif() cmake_pop_check_state() endmacro() + +macro(monetdb_configure_sizes) + # On C99, but we have to calculate the size + check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) + set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) + check_type_size(ssize_t SIZEOF_SSIZE_T LANGUAGE C) + if(NOT HAVE_SIZEOF_SSIZE_T) +# Set a default value +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ssize_t "int64_t") +else() + set(ssize_t "int32_t") +endif() +set(SIZEOF_SSIZE_T ${CMAKE_SIZEOF_VOID_P}) + endif() + check_type_size(char SIZEOF_CHAR LANGUAGE C) + check_type_size(short SIZEOF_SHORT LANGUAGE C) + check_type_size(int SIZEOF_INT LANGUAGE C) +
MonetDB: mbedded - reorganize code, match order of detection and...
Changeset: 03669e73a54b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03669e73a54b Modified Files: cmake/monetdb-defines.cmake monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message: reorganize code, match order of detection and definition diffs (truncated from 437 to 300 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -11,6 +11,7 @@ # additional variables, for example for legacy defines, do this # in the "monetdb_macro_variables" macro. function(monetdb_configure_defines) + find_path(HAVE_SYS_TYPES_H "sys/types.h") find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h") find_path(HAVE_DLFCN_H "dlfcn.h") find_path(HAVE_FCNTL_H "fcntl.h") @@ -31,7 +32,7 @@ function(monetdb_configure_defines) find_path(HAVE_STROPTS_H "stropts.h") find_path(HAVE_SYS_FILE_H "sys/file.h") find_path(HAVE_SYS_IOCTL_H "sys/ioctl.h") - find_path(HAVE_SYS_IOCTL_H "sys/sysctl.h") + find_path(HAVE_SYS_SYSCTL_H "sys/sysctl.h") find_path(HAVE_SYS_MMAN_H "sys/mman.h") find_path(HAVE_SYS_PARAM_H "sys/param.h") find_path(HAVE_SYS_RESOURCE_H "sys/resource.h") @@ -44,7 +45,6 @@ function(monetdb_configure_defines) find_path(HAVE_UNISTD_H "unistd.h") find_path(HAVE_UUID_UUID_H "uuid/uuid.h") find_path(HAVE_WINSOCK_H "winsock2.h") - find_path(HAVE_SYS_TYPES_H "sys/types.h") find_path(HAVE_SEMAPHORE_H "semaphore.h") find_path(HAVE_GETOPT_H "getopt.h") diff --git a/monetdb_config.h.in b/monetdb_config.h.in --- a/monetdb_config.h.in +++ b/monetdb_config.h.in @@ -26,7 +26,7 @@ #include #include -#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ +// Section: monetdb configure defines #cmakedefine HAVE_DISPATCH_DISPATCH_H @HAVE_DISPATCH_DISPATCH_H@ #cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ #cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@ @@ -52,9 +52,7 @@ #cmakedefine HAVE_SYS_MMAN_H @HAVE_SYS_MMAN_H@ #cmakedefine HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@ #cmakedefine HAVE_SYS_RESOURCE_H @HAVE_SYS_RESOURCE_H@ -#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@ #cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@ -#cmakedefine HAVE_GETTIMEOFDAY @HAVE_SYS_TIME_H@ #cmakedefine HAVE_SYS_TIMES_H @HAVE_SYS_TIMES_H@ #cmakedefine HAVE_SYS_UIO_H @HAVE_SYS_UIO_H@ #cmakedefine HAVE_SYS_UN_H @HAVE_SYS_UN_H@ @@ -64,49 +62,18 @@ #cmakedefine HAVE_UNISTD_H 1 #cmakedefine HAVE_UUID_UUID_H @HAVE_UUID_UUID_H@ #cmakedefine HAVE_WINSOCK_H @HAVE_WINSOCK_H@ - #cmakedefine HAVE_SEMAPHORE_H @HAVE_SEMAPHORE_H@ - -#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ -#cmakedefine HAVE_GETADDRINFO @HAVE_GETADDRINFO@ +#cmakedefine HAVE_GETOPT_H @HAVE_GETOPT_H@ -#define ICONV_CONST -#cmakedefine HAVE_PTHREAD_KILL @HAVE_PTHREAD_KILL@ -#cmakedefine HAVE_PTHREAD_SIGMASK @HAVE_PTHREAD_SIGMASK@ -#cmakedefine HAVE_LOCALTIME_R @HAVE_LOCALTIME_R@ -#cmakedefine HAVE_STRERROR_R @HAVE_STRERROR_R@ - -// Section: monetdb configure defines #cmakedefine HAVE_STDATOMIC_H @HAVE_STDATOMIC_H@ -#cmakedefine HAVE_GETOPT_H @HAVE_GETOPT_H@ -#cmakedefine HAVE_GETOPT @HAVE_GETOPT@ -// End Section: monetdb configure defines -// Section: monetdb macro variables -#cmakedefine HAVE_ICONV @HAVE_ICONV@ -#cmakedefine HAVE_PTHREAD_H @HAVE_PTHREAD_H@ -#cmakedefine HAVE_LIBPCRE @HAVE_LIBPCRE@ -#cmakedefine HAVE_OPENSSL @HAVE_OPENSSL@ -#cmakedefine HAVE_COMMONCRYPTO @HAVE_COMMONCRYPTO@ -#cmakedefine HAVE_LIBBZ2 @HAVE_LIBBZ2@ -#cmakedefine HAVE_CURL @HAVE_CURL@ -#cmakedefine HAVE_LIBLZMA @HAVE_LIBLZMA@ -#cmakedefine HAVE_LIBXML @HAVE_LIBXML@ -#cmakedefine HAVE_LIBZ @HAVE_LIBZ@ -#cmakedefine HAVE_LIBLZ4 @HAVE_LIBLZ4@ -#cmakedefine HAVE_PROJ @HAVE_PROJ@ -#cmakedefine HAVE_SNAPPY @HAVE_SNAPPY@ -#cmakedefine HAVE_UUID @HAVE_UUID@ -#cmakedefine HAVE_VALGRIND @HAVE_VALGRIND@ -#cmakedefine HAVE_NETCDF @HAVE_NETCDF@ -#cmakedefine HAVE_READLINE @HAVE_READLINE@ -// End Section: monetdb macro variables - -#define FLEXIBLE_ARRAY_MEMBER - +#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ +#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@ +#cmakedefine HAVE_GETTIMEOFDAY @HAVE_SYS_TIME_H@ +#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ +#cmakedefine HAVE_FDATASYNC @HAVE_FDATASYNC@ #cmakedefine HAVE_ACCEPT4 @HAVE_ACCEPT4@ #cmakedefine HAVE_ASCTIME_R @HAVE_ASCTIME_R@ -#define HAVE_CBRT 1 #cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@ #cmakedefine HAVE_CTIME_R @HAVE_CTIME_R@ #cmakedefine HAVE_DISPATCH_SEMAPHORE_CREATE @HAVE_DISPATCH_SEMAPHORE_CREATE@ @@ -123,6 +90,7 @@ #cmakedefine HAVE_GETUID @HAVE_GETUID@ #cmakedefine HAVE_GMTIME_R @HAVE_GMTIME_R@ #cmakedefine HAVE_LOCALTIME_R @HAVE_LOCALTIME_R@ +#cmakedefine HAVE_STRERROR_R @HAVE_STRERROR_R@ #cmakedefine HAVE_LOCKF @HAVE_LOCKF@ #cmakedefine HAVE_MADVISE @HAVE_MADVISE@ #cmakedefine HAVE_MREMAP @HAVE_MREMAP@ @@ -148,10 +116,36 @@ #cmakedefine HAVE_TASK_INFO @HAVE_TASK_INFO@ #cmakedefine HAVE_TIMES @HAVE_TIMES@ #cmakedefine HAVE_UNAME @HAVE_UNAME@ +//
MonetDB: mbedded - fix bugs in library detection and add tests
Changeset: 7389e7d623d7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7389e7d623d7 Added Files: ctest/cmake/detect-bz2.cmake ctest/cmake/detect-commoncrypto.cmake ctest/cmake/detect-curl.cmake ctest/cmake/detect-iconv.cmake ctest/cmake/detect-libz.cmake ctest/cmake/detect-lz4.cmake ctest/cmake/detect-openssl.cmake ctest/cmake/detect-pcre.cmake ctest/cmake/detect-proj.cmake ctest/cmake/detect-xml.cmake ctest/cmake/test_detect_bz2.c.in ctest/cmake/test_detect_commoncrypto.c.in ctest/cmake/test_detect_curl.c.in ctest/cmake/test_detect_iconv.c.in ctest/cmake/test_detect_libz.c.in ctest/cmake/test_detect_lz4.c.in ctest/cmake/test_detect_openssl.c.in ctest/cmake/test_detect_pcre.c.in ctest/cmake/test_detect_proj.c.in ctest/cmake/test_detect_xml.c.in Removed Files: ctest/cmake/test_detect.c ctest/cmake/test_detect_bz2.c ctest/cmake/test_detect_curl.c ctest/cmake/test_detect_libz.c ctest/cmake/test_detect_lz4.c ctest/cmake/test_detect_pcre.c ctest/cmake/test_detect_proj.c Modified Files: cmake/monetdb-functions.cmake ctest/cmake/CMakeLists.txt monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message: fix bugs in library detection and add tests diffs (truncated from 1143 to 300 lines): diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -119,18 +119,22 @@ function(monetdb_cmake_summary) message(STATUS "Linux distro: ${LINUX_DISTRO}") message(STATUS "Linux distro version: ${LINUX_DISTRO_VERSION}") endif() + message(STATUS "Iconv library: ${Iconv_FOUND}") + message(STATUS "Pthread library: ${CMAKE_USE_PTHREADS_INIT}") + message(STATUS "Pcre library: ${PCRE_FOUND}") + message(STATUS "Openssl library: ${OPENSSL_FOUND}") + message(STATUS "Commoncrypto library: ${COMMONCRYPTO_FOUND}") + message(STATUS "Bz2 library: ${BZIP2_FOUND}") + message(STATUS "Curl library: ${CURL_FOUND}") + message(STATUS "Lzma library: ${LIBLZMA_FOUND}") + message(STATUS "Libxml2 library: ${LIBXML2_FOUND}") + message(STATUS "Zlib library: ${ZLIB_FOUND}") + message(STATUS "Lz4 library: ${LZ4_FOUND}") + message(STATUS "Proj library: ${PROJ_FOUND}") message(STATUS "Geos library: ${GEOS_FOUND}") message(STATUS "Gdal library: ${GDAL_FOUND}") - message(STATUS "Lzma library: ${LZMA_FOUND}") - message(STATUS "Libxml2 library: ${LIBXML2_FOUND}") - message(STATUS "Curl library: ${CURL_FOUND}") - message(STATUS "Bz2 library: ${BZ2_FOUND}") - message(STATUS "Zlib library: ${LIBZ_FOUND}") - message(STATUS "Proj library: ${PROJ_FOUND}") - message(STATUS "Lz4 library: ${LZ4_FOUND}") message(STATUS "Cfitsio library: ${CFITSIO_FOUND}") message(STATUS "Kvm library: ${KVM_FOUND}") - message(STATUS "Pcre library: ${PCRE_FOUND}") message(STATUS "Netcdf library: ${NETCDF_FOUND}") message(STATUS "Readline library: ${READLINE_FOUND}") message(STATUS "-") diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -16,55 +16,23 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) endif() -add_executable(test_detect test_detect.c) -target_link_libraries(test_detect - PRIVATE - monetdb_config_header) -add_test(testDetect test_detect) - -add_executable(test_detect_pcre test_detect_pcre.c) -target_link_libraries(test_detect_pcre - PRIVATE - monetdb_config_header) -add_test(testDetectPcre test_detect_pcre) - -add_executable(test_detect_bz2 test_detect_bz2.c) -target_link_libraries(test_detect_bz2 - PRIVATE - monetdb_config_header) -add_test(testDetectBz2 test_detect_bz2) - -add_executable(test_detect_curl test_detect_curl.c) -target_link_libraries(test_detect_curl - PRIVATE - monetdb_config_header) -add_test(testDetectCurl test_detect_curl) - -add_executable(test_detect_libz test_detect_libz.c) -target_link_libraries(test_detect_libz - PRIVATE - monetdb_config_header) -add_test(testDetectLibz test_detect_libz) - -add_executable(test_detect_lz4 test_detect_lz4.c) -target_link_libraries(test_detect_lz4 - PRIVATE - monetdb_config_header) -add_test(testDetectLz4 test_detect_lz4) - -add_executable(test_detect_proj test_detect_proj.c) -target_link_libraries(test_detect_proj - PRIVATE - monetdb_config_header) -add_test(testDetectProj test_detect_proj) - +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-iconv.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadh.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pcre.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-openssl.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-commoncrypto.cmake) +include(${CMAKE_CURR
MonetDB: mbedded - test pthread detection
Changeset: 2c84f02f3687 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c84f02f3687 Added Files: ctest/cmake/detect-pthreadh.cmake ctest/cmake/detect-pthreadinit.cmake ctest/cmake/detect-pthreadkill.cmake ctest/cmake/detect-pthreadsig.cmake ctest/cmake/test_detect_pthreadh.c.in ctest/cmake/test_detect_pthreadinit.c.in ctest/cmake/test_detect_pthreadkill.c.in ctest/cmake/test_detect_pthreadsig.c.in Modified Files: CMakeLists.txt cmake/monetdb-defines.cmake ctest/cmake/CMakeLists.txt Branch: mbedded Log Message: test pthread detection diffs (truncated from 434 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,10 +41,10 @@ include(CheckFunctionExists REQUIRED) include(CheckTypeSize REQUIRED) include(TestBigEndian REQUIRED) -# Include MonetDB specific functions if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib) endif() +# Include MonetDB specific functions include(monetdb-functions) include(monetdb-findpackages) include(monetdb-defines) @@ -100,6 +100,8 @@ endif() include(GNUInstallDirs) +# Define the macro variables after configuring the install directories. +# Some variables define additional installation settings. monetdb_macro_variables() # Define custom target after the install directories variables. # Some custom target will need these setting. diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -112,10 +112,8 @@ function(monetdb_configure_defines) check_function_exists("uname" HAVE_UNAME) # Some libc versions on Linux distributions don't have it check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) - if(HAVE_PTHREAD_H) -check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) -check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) - endif() + check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) + check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) if(HAVE_GETOPT_H) set(HAVE_GETOPT 1 PARENT_SCOPE) endif() @@ -125,7 +123,7 @@ macro(monetdb_macro_variables) # Set variables to define C macro's # These are related to the detected packages # These names are legacy. When the code is changed to use the cmake - # variables, they can be removed. + # variables, then they can be removed. set(HAVE_ICONV ${Iconv_FOUND}) set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) set(HAVE_LIBPCRE ${PCRE_FOUND}) diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -64,5 +64,9 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dete include(${CMAKE_CURRENT_SOURCE_DIR}/detect-unixgetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-wingetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-getaddrinfo.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadh.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadinit.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadkill.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadsig.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/set-dir-vars.cmake) diff --git a/ctest/cmake/detect-pthreadh.cmake b/ctest/cmake/detect-pthreadh.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-pthreadh.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") +set(DETECT "0") +set(UNDETECT "1") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "19") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "20") +set(DETECT "0") +set(UNDETECT "1") + endif() +elseif(${LINUX_DISTRO} STREQUAL "fedora") + if(${LINUX_DISTRO_VERSION} STREQUAL "30") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "31") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "32") +set(DETECT "0") +set(UNDETECT "1") + endif() +else() + message(ERROR "Linux distro: ${LINUX_DISTRO} not known") + message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") +endif() + +configur
MonetDB: mbedded - improve getaddrinfo detection, fix bug and ad...
Changeset: 2d6202baf6fb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d6202baf6fb Added Files: ctest/cmake/detect-getaddrinfo.cmake ctest/cmake/detect-unixgetaddrinfo.cmake ctest/cmake/detect-wingetaddrinfo.cmake ctest/cmake/test_detect_getaddrinfo.c.in ctest/cmake/test_detect_unixgetaddrinfo.c.in ctest/cmake/test_detect_wingetaddrinfo.c.in Modified Files: cmake/monetdb-defines.cmake ctest/cmake/CMakeLists.txt ctest/cmake/detect-lzma.cmake ctest/cmake/detect-readline.cmake Branch: mbedded Log Message: improve getaddrinfo detection, fix bug and add tests diffs (truncated from 361 to 300 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -6,6 +6,10 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] +# This function should only run find functions. The resulting +# variables will have the correct scope. If you need to set +# additional variables, for example for legacy defines, do this +# in the "monetdb_macro_variables" macro. function(monetdb_configure_defines) find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h") find_path(HAVE_DLFCN_H "dlfcn.h") @@ -54,13 +58,6 @@ function(monetdb_configure_defines) check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H) check_symbol_exists("getaddrinfo" "netdb.h" UNIX_GETADDRINFO) check_symbol_exists("getaddrinfo" "ws2tcpip.h" WIN_GETADDRINFO) - if(UNIX_GETADDRINF) -set(HAVE_GETADDRINFO 1 PARENT_SCOPE) - endif() - if(WIN_GETADDRINF) -set(HAVE_GETADDRINFO 1 PARENT_SCOPE) - endif() - #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H) check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC) # Some libc versions on Linux distributions don't have it @@ -152,6 +149,13 @@ macro(monetdb_macro_variables) set(SOCKET_LIBRARIES "ws2_32") endif() + if(UNIX_GETADDRINFO) +set(HAVE_GETADDRINFO 1) + endif() + if(WIN_GETADDRINFO) +set(HAVE_GETADDRINFO 1) + endif() + set(DIR_SEP "/") set(PATH_SEP ":") set(DIR_SEP_STR "/") diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -61,5 +61,8 @@ add_test(testDetectProj test_detect_proj include(${CMAKE_CURRENT_SOURCE_DIR}/detect-netcdf.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-lzma.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-readline.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-unixgetaddrinfo.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-wingetaddrinfo.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-getaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/set-dir-vars.cmake) diff --git a/ctest/cmake/detect-getaddrinfo.cmake b/ctest/cmake/detect-getaddrinfo.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-getaddrinfo.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") +set(DETECT "0") +set(UNDETECT "1") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "19") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "20") +set(DETECT "0") +set(UNDETECT "1") + endif() +elseif(${LINUX_DISTRO} STREQUAL "fedora") + if(${LINUX_DISTRO_VERSION} STREQUAL "30") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "31") +set(DETECT "0") +set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "32") +set(DETECT "0") +set(UNDETECT "1") + endif() +else() + message(ERROR "Linux distro: ${LINUX_DISTRO} not known") + message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") +endif() + +configure_file(test_detect_getaddrinfo.c.in + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_getaddrinfo.c + @ONLY) + +add_executable(test_detect_getaddrinfo) +target_sources(test_detect_getaddrinfo + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_getaddrinfo.c) +target_link_libraries(test_detect_getaddrinfo + PRIVATE + monetdb_config_header) +add_test(testDetectGetaddrinfo test_detect_getaddrinfo) diff --git a/ctest/cmake/detect-lzma.cmake b/ctest/cmake/detect-lzma.cmake --- a/ctest/cmake/detect-lzma.cmake +++
MonetDB: mbedded - add components for testing
Changeset: 0081bddbe535 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0081bddbe535 Modified Files: CMakeLists.txt testing/CMakeLists.txt Branch: mbedded Log Message: add components for testing diffs (77 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,7 +216,8 @@ write_basic_package_version_file( install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MonetDBConfig.cmake - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake + COMPONENT monetdbdev) include(monetdb-packages) @@ -226,3 +227,5 @@ add_subdirectory(ctest) if(CMAKE_SUMMARY) monetdb_cmake_summary() endif() + +# vim: set ts=2:sw=2:et diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -98,7 +98,8 @@ target_link_libraries(Mdiff install(TARGETS Mdiff - DESTINATION ${CMAKE_INSTALL_BINDIR}) + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT testing) configure_file(Mtest.py.in ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py @@ -111,7 +112,8 @@ configure_file(listexports.py.in install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} - DESTINATION ${CMAKE_INSTALL_BINDIR}) + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT pytesting) if(PYTHON3_LIBDIR) install(FILES @@ -122,7 +124,8 @@ if(PYTHON3_LIBDIR) exportutils.py malcheck.py sqllogictest.py -DESTINATION ${PYTHON3_LIBDIR}/MonetDBtesting) +DESTINATION ${PYTHON3_LIBDIR}/MonetDBtesting +COMPONENT pytesting) endif() if(WIN32) @@ -157,16 +160,21 @@ else() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mlog PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} -DESTINATION ${CMAKE_INSTALL_BINDIR}) +DESTINATION ${CMAKE_INSTALL_BINDIR} +COMPONENT testing) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb_mtest.sh PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} -DESTINATION ${CMAKE_INSTALL_BINDIR}) +DESTINATION ${CMAKE_INSTALL_BINDIR} +COMPONENT pytesting) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} DESTINATION ${CMAKE_INSTALL_BINDIR} -RENAME Mapprove.py) +RENAME Mapprove.py +COMPONENT pytesting) endif() + +# vim: set ts=2:sw=2:et ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mbedded - more install improvements
Changeset: 01cca09c61b5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=01cca09c61b5 Modified Files: clients/examples/C/CMakeLists.txt clients/examples/perl/CMakeLists.txt clients/examples/php/CMakeLists.txt clients/mapiclient/CMakeLists.txt clients/mapilib/CMakeLists.txt clients/odbc/driver/CMakeLists.txt clients/odbc/samples/CMakeLists.txt clients/odbc/setup/CMakeLists.txt clients/odbc/winsetup/CMakeLists.txt monetdb5/tools/CMakeLists.txt tools/merovingian/client/CMakeLists.txt tools/merovingian/daemon/CMakeLists.txt tools/merovingian/daemon/config/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: mbedded Log Message: more install improvements diffs (truncated from 303 to 300 lines): diff --git a/clients/examples/C/CMakeLists.txt b/clients/examples/C/CMakeLists.txt --- a/clients/examples/C/CMakeLists.txt +++ b/clients/examples/C/CMakeLists.txt @@ -45,5 +45,8 @@ if(TESTING) smack01 RUNTIME DESTINATION -${CMAKE_INSTALL_BINDIR}) +${CMAKE_INSTALL_BINDIR} +COMPONENT clienttest) endif() + +# vim: set ts=2:sw=2:et diff --git a/clients/examples/perl/CMakeLists.txt b/clients/examples/perl/CMakeLists.txt --- a/clients/examples/perl/CMakeLists.txt +++ b/clients/examples/perl/CMakeLists.txt @@ -10,10 +10,14 @@ if(TESTING) install(FILES sqlsample.pl PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} -DESTINATION ${CMAKE_INSTALL_BINDIR}) +DESTINATION ${CMAKE_INSTALL_BINDIR} +COMPONENT clienttest) install(FILES malsample.pl PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} -DESTINATION ${CMAKE_INSTALL_BINDIR}) +DESTINATION ${CMAKE_INSTALL_BINDIR} +COMPONENT clienttest) endif() + +# vim: set ts=2:sw=2:et diff --git a/clients/examples/php/CMakeLists.txt b/clients/examples/php/CMakeLists.txt --- a/clients/examples/php/CMakeLists.txt +++ b/clients/examples/php/CMakeLists.txt @@ -10,5 +10,8 @@ if(TESTING) install(FILES sqlsample.php PERMISSIONS ${PROGRAM_PERMISSIONS_DEFAULT} -DESTINATION ${CMAKE_INSTALL_BINDIR}) +DESTINATION ${CMAKE_INSTALL_BINDIR} +COMPONENT clienttest) endif() + +# vim: set ts=2:sw=2:et diff --git a/clients/mapiclient/CMakeLists.txt b/clients/mapiclient/CMakeLists.txt --- a/clients/mapiclient/CMakeLists.txt +++ b/clients/mapiclient/CMakeLists.txt @@ -128,4 +128,7 @@ install(TARGETS install(FILES mclient.1 msqldump.1 - DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + COMPONENT mclient) + +# vim: set ts=2:sw=2:et diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -47,8 +47,7 @@ set_target_properties(mapi PROPERTIES VERSION ${MAPI_VERSION} SOVERSION ${MAPI_VERSION_MAJOR} - PUBLIC_HEADER mapi.h - PUBLIC_HEADER mapi_querytype.h) + PUBLIC_HEADER mapi.h) if (NOT WIN32) configure_file(monetdb-mapi.pc.in @@ -82,3 +81,5 @@ install(EXPORT mapiTargets NAMESPACE MonetDB:: DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cmake COMPONENT clientdev) + +# vim: set ts=2:sw=2:et diff --git a/clients/odbc/driver/CMakeLists.txt b/clients/odbc/driver/CMakeLists.txt --- a/clients/odbc/driver/CMakeLists.txt +++ b/clients/odbc/driver/CMakeLists.txt @@ -117,21 +117,21 @@ target_compile_definitions(MonetODBC target_link_libraries(MonetODBC PRIVATE monetdb_config_header - mutils - mapi - ODBC::ODBC) + mutils + mapi + ODBC::ODBC) install(TARGETS MonetODBC RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT client + COMPONENT odbc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT client + COMPONENT odbc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT client + COMPONENT odbc PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb COMPONENT clientdev diff --git a/clients/odbc/samples/CMakeLists.txt b/clients/odbc/samples/CMakeLists.txt --- a/clients/odbc/samples/CMakeLists.txt +++ b/clients/odbc/samples/CMakeLists.txt @@ -43,5 +43,8 @@ if(TESTING) testStmtAttr RUNTIME DESTINATION -${CMAKE_INSTALL_BINDIR}) +${CMAKE_INSTALL_BINDIR} +COMPONENT clienttest) endif() + +# vim: set ts=2:sw=2:et diff --git a/clients/odbc/setup/CMakeLists.txt b/clients/odbc/setup/CMakeLists.txt --- a/clients/odbc/setup/CMakeLists.txt +++ b/clients/odbc/setup/CMakeLists.txt @@ -32,14 +32,16 @@ install(TARGETS MonetODBCs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT client + COMPONENT odbc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT client + COMPONENT odbc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT client + COMPONENT odbc PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb COMPONENT clientdev INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +# vim: set ts=2:s
MonetDB: mbedded - cleanup cmake code, improving installs
Changeset: b1075af7fe08 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b1075af7fe08 Modified Files: clients/examples/C/CMakeLists.txt clients/mapiclient/CMakeLists.txt clients/mapilib/CMakeLists.txt clients/odbc/samples/CMakeLists.txt cmake/monetdb-defines.cmake common/stream/CMakeLists.txt gdk/CMakeLists.txt monetdb5/mal/CMakeLists.txt monetdb5/tools/CMakeLists.txt tools/merovingian/client/CMakeLists.txt tools/merovingian/daemon/CMakeLists.txt tools/merovingian/daemon/config/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: mbedded Log Message: cleanup cmake code, improving installs diffs (247 lines): diff --git a/clients/examples/C/CMakeLists.txt b/clients/examples/C/CMakeLists.txt --- a/clients/examples/C/CMakeLists.txt +++ b/clients/examples/C/CMakeLists.txt @@ -7,16 +7,43 @@ #]] if(TESTING) - add_executable(sample0 sample0.c) - target_link_libraries(sample0 PRIVATE mapi) - add_executable(sample1 sample1.c) - target_link_libraries(sample1 PRIVATE mapi) - add_executable(sample4 sample4.c) - target_link_libraries(sample4 PRIVATE mapi) - add_executable(smack00 smack00.c) - target_link_libraries(smack00 PRIVATE mapi) - add_executable(smack01 smack01.c) - target_link_libraries(smack01 PRIVATE mapi) + add_executable(sample0 +sample0.c) + + target_link_libraries(sample0 +PRIVATE mapi) + + add_executable(sample1 +sample1.c) + + target_link_libraries(sample1 +PRIVATE mapi) + + add_executable(sample4 +sample4.c) + + target_link_libraries(sample4 +PRIVATE mapi) - install(TARGETS sample0 sample1 sample4 smack00 smack01 DESTINATION ${BINDIR}) + add_executable(smack00 +smack00.c) + + target_link_libraries(smack00 +PRIVATE mapi) + + add_executable(smack01 +smack01.c) + + target_link_libraries(smack01 +PRIVATE mapi) + + install(TARGETS +sample0 +sample1 +sample4 +smack00 +smack01 +RUNTIME +DESTINATION +${CMAKE_INSTALL_BINDIR}) endif() diff --git a/clients/mapiclient/CMakeLists.txt b/clients/mapiclient/CMakeLists.txt --- a/clients/mapiclient/CMakeLists.txt +++ b/clients/mapiclient/CMakeLists.txt @@ -128,4 +128,4 @@ install(TARGETS install(FILES mclient.1 msqldump.1 - DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1) + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -56,16 +56,8 @@ if (NOT WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-mapi.pc -DESTINATION ${PKGCONFIGDIR}) -endif() - -if (NOT WIN32) - configure_file(monetdb-mapi.pc.in -${CMAKE_CURRENT_BINARY_DIR}/monetdb-mapi.pc @ONLY) - - install(FILES -${CMAKE_CURRENT_BINARY_DIR}/monetdb-mapi.pc -DESTINATION ${PKGCONFIGDIR}) +DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +COMPONENT clientdev) endif() install(TARGETS diff --git a/clients/odbc/samples/CMakeLists.txt b/clients/odbc/samples/CMakeLists.txt --- a/clients/odbc/samples/CMakeLists.txt +++ b/clients/odbc/samples/CMakeLists.txt @@ -41,6 +41,7 @@ if(TESTING) testgetinfo arraytest testStmtAttr +RUNTIME DESTINATION -${BINDIR}) +${CMAKE_INSTALL_BINDIR}) endif() diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -55,10 +55,10 @@ function(monetdb_configure_defines) check_symbol_exists("getaddrinfo" "netdb.h" UNIX_GETADDRINFO) check_symbol_exists("getaddrinfo" "ws2tcpip.h" WIN_GETADDRINFO) if(UNIX_GETADDRINF) - set(HAVE_GETADDRINFO 1 PARENT_SCOPE) +set(HAVE_GETADDRINFO 1 PARENT_SCOPE) endif() if(WIN_GETADDRINF) - set(HAVE_GETADDRINFO 1 PARENT_SCOPE) +set(HAVE_GETADDRINFO 1 PARENT_SCOPE) endif() #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H) diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -91,7 +91,8 @@ if (NOT WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-stream.pc -DESTINATION ${PKGCONFIGDIR}) +DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +COMPONENT streamdev) endif() install(TARGETS diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -115,7 +115,8 @@ if (NOT WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/monetdb-gdk.pc -DESTINATION ${PKGCONFIGDIR}) +DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +COMPONENT monetdbdev) endif() install(TARGETS diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt --- a/monetdb5/mal/CMakeLists.txt +++ b/monetdb5/mal/CMakeLists.txt @@ -94,4 +94,5 @@ install(TARGETS DESTINATION ${CMAKE_I
MonetDB: mbedded - small changes to cleanup code a little bit
Changeset: 233b4e5c3b0b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=233b4e5c3b0b Modified Files: cmake/monetdb-defines.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake Branch: mbedded Log Message: small changes to cleanup code a little bit diffs (162 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -7,7 +7,6 @@ #]] function(monetdb_configure_defines) - check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h") find_path(HAVE_DLFCN_H "dlfcn.h") find_path(HAVE_FCNTL_H "fcntl.h") @@ -20,7 +19,6 @@ function(monetdb_configure_defines) find_path(HAVE_MACH_MACH_INIT_H "mach/mach_init.h") find_path(HAVE_MACH_TASK_H "mach/task.h") find_path(HAVE_MACH_O_DYLD_H "mach-o/dyld.h") - check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H) find_path(HAVE_NETINET_IN_H "netinet/in.h") find_path(HAVE_POLL_H "poll.h") find_path(HAVE_PROCFS_H "procfs.h") @@ -33,8 +31,6 @@ function(monetdb_configure_defines) find_path(HAVE_SYS_MMAN_H "sys/mman.h") find_path(HAVE_SYS_PARAM_H "sys/param.h") find_path(HAVE_SYS_RESOURCE_H "sys/resource.h") - check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H) - check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H) find_path(HAVE_SYS_TIMES_H "sys/times.h") find_path(HAVE_SYS_UIO_H "sys/uio.h") find_path(HAVE_SYS_UN_H "sys/un.h") @@ -44,29 +40,32 @@ function(monetdb_configure_defines) find_path(HAVE_UNISTD_H "unistd.h") find_path(HAVE_UUID_UUID_H "uuid/uuid.h") find_path(HAVE_WINSOCK_H "winsock2.h") - find_path(HAVE_SYS_TYPES_H "sys/types.h") find_path(HAVE_SEMAPHORE_H "semaphore.h") find_path(HAVE_GETOPT_H "getopt.h") - if(HAVE_GETOPT_H) -set(HAVE_GETOPT 1) - endif() check_include_file("stdatomic.h" HAVE_STDATOMIC_H) + check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) + check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H) + check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H) + check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H) # Linux specific, in the future, it might be ported to other platforms check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H) check_symbol_exists("getaddrinfo" "netdb.h" HAVE_GETADDRINFO) check_symbol_exists("getaddrinfo" "ws2tcpip.h" HAVE_GETADDRINFO) #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H) check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC) - - check_symbol_exists("accept4" "sys/types.h;sys/socket.h" HAVE_ACCEPT4) # Some libc versions on Linux distributions don't have it + # Some libc versions on Linux distributions don't have it + check_symbol_exists("accept4" +"sys/types.h;sys/socket.h" HAVE_ACCEPT4) check_symbol_exists("asctime_r" "time.h" HAVE_ASCTIME_R) check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME) check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R) - check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h" HAVE_DISPATCH_SEMAPHORE_CREATE) - check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE) # Linux specific, in the future, it might be ported to other platforms + check_symbol_exists("dispatch_semaphore_create" +"dispatch/dispatch.h" HAVE_DISPATCH_SEMAPHORE_CREATE) + # Linux specific, in the future, it might be ported to other platforms + check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE) check_function_exists("fcntl" HAVE_FCNTL) check_symbol_exists("fork" "unistd.h" HAVE_FORK) check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC) @@ -86,31 +85,36 @@ function(monetdb_configure_defines) check_function_exists("nanosleep" HAVE_NANOSLEEP) check_function_exists("nl_langinfo" HAVE_NL_LANGINFO) check_function_exists("_NSGetExecutablePath" HAVE__NSGETEXECUTABLEPATH) - check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2) # Some libc versions on Linux distributions don't have it - check_function_exists("poll" HAVE_POLL) + # Some libc versions on Linux distributions don't have it + check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2) + check_function_exists("poll" HAVE_POLL) check_symbol_exists("popen" "stdio.h" HAVE_POPEN) - check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE) - check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE) # Some POSIX systems don't have it (e.g. Macos) + check_symbol_exists("posix_fadvise" "fcntl.h" HAVE_POSIX_FADVISE) + # Some POSIX systems don't have it (e.g. Macos) + check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE) check_symbol_exists("posix_madvise" "sys/mman.h" HAVE_POSIX_MADVISE) - check_function_exists("putenv" HAVE_PUTENV) - check_function_exists("setsid" HAVE_SETSID) - check_function_exists("shutdown" HAVE_SHUTDOWN) - check_function_exist
MonetDB: mbedded - reorganize code, add tests and fix bugs
Changeset: ec759a9b3068 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ec759a9b3068 Added Files: ctest/cmake/set-dir-vars.cmake ctest/cmake/test_cmake_var.c.in Modified Files: CMakeLists.txt clients/odbc/samples/CMakeLists.txt cmake/monetdb-defines.cmake ctest/cmake/CMakeLists.txt ctest/cmake/detect-netcdf.cmake ctest/cmake/detect-readline.cmake monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message: reorganize code, add tests and fix bugs diffs (truncated from 609 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,11 +36,9 @@ include(CheckCSourceCompiles REQUIRED) include(CheckIncludeFile REQUIRED) include(CMakePushCheckState REQUIRED) include(CheckStructHasMember REQUIRED) - include(CheckSymbolExists REQUIRED) include(CheckFunctionExists REQUIRED) include(CheckTypeSize REQUIRED) - include(TestBigEndian REQUIRED) # Include MonetDB specific functions @@ -57,12 +55,6 @@ endif() monetdb_configure_defines() -# Likely unused, because it contained typo's -if(HAVE_PTHREAD_H) - check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) - check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) -endif() - # On C99, but we have to calculate the size check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) @@ -76,71 +68,7 @@ check_type_size(socklen_t HAVE_SOCKLEN_T set(CMAKE_REQUIRED_INCLUDES "/usr/include") -# Set variables to define C macro's -# These are related to the detected packages -# These names are legacy. When the code is changed to use the cmake -# variables, they can be removed. -set(HAVE_ICONV ${Iconv_FOUND}) -set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) -set(HAVE_LIBPCRE ${PCRE_FOUND}) -set(HAVE_OPENSSL ${OPENSSL_FOUND}) -set(HAVE_COMMONCRYPTO ${COMMONCRYPTO_FOUND}) -set(HAVE_LIBBZ2 ${BZIP2_FOUND}) -set(HAVE_CURL ${CURL_FOUND}) -set(HAVE_LIBLZMA ${LIBLZMA_FOUND}) -set(HAVE_LIBXML ${LibXml2_FOUND}) -set(HAVE_LIBZ ${ZLIB_FOUND}) -set(HAVE_LIBLZ4 ${LZ4_FOUND}) -set(HAVE_PROJ ${PROJ_FOUND}) -set(HAVE_SNAPPY ${SNAPPY_FOUND}) -set(HAVE_UUID ${HAVE_UUID_GENERATE}) -set(HAVE_VALGRIND ${VALGRIND_FOUND}) -set(HAVE_NETCDF ${NETCDF_FOUND}) -set(HAVE_READLINE ${READLINE_FOUND}) - -set(SOCKET_LIBRARIES "") -if (WIN32) - set(SOCKET_LIBRARIES "ws2_32") -endif() - -cmake_push_check_state() -if(COMMONCRYPTO_FOUND) - #set(CMAKE_REQUIRED_INCLUDES "${COMMONCRYPTO_INCUDE_DIR}") - set(CMAKE_REQUIRED_LIBRARIES "${COMMONCRYPTO_LIBRARIES}") - - check_symbol_exists("CC_MD5_Update" "CommonCrypto/CommonDigest.h" HAVE_MD5_UPDATE) - check_symbol_exists("CC_SHA1_Update" "CommonCrypto/CommonDigest.h" HAVE_SHA1_UPDATE) - check_symbol_exists("CC_SHA224_Update" "CommonCrypto/CommonDigest.h" HAVE_SHA224_UPDATE) - check_symbol_exists("CC_SHA256_Update" "CommonCrypto/CommonDigest.h" HAVE_SHA256_UPDATE) - check_symbol_exists("CC_SHA384_Update" "CommonCrypto/CommonDigest.h" HAVE_SHA384_UPDATE) - check_symbol_exists("CC_SHA512_Update" "CommonCrypto/CommonDigest.h" HAVE_SHA512_UPDATE) - - add_library(OpenSSL::Crypto UNKNOWN IMPORTED) - set_target_properties(OpenSSL::Crypto PROPERTIES -INTERFACE_INCLUDE_DIRECTORIES "${COMMONCRYPTO_INCLUDE_DIR}") - set_target_properties(OpenSSL::Crypto PROPERTIES -IMPORTED_LINK_INTERFACE_LANGUAGES "C" -IMPORTED_LOCATION "${COMMONCRYPTO_LIBRARIES}") -endif() -if(OPENSSL_FOUND) - #set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCUDE_DIR}") - #set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}") - - set(HAVE_OPENSSL ON CACHE INTERNAL "OpenSSL is available") - set(CRYPTO_INCLUDE_DIR "${OPENSSL_INCLUDE_DIR}" CACHE INTERNAL "crypto include directory") - set(CRYPTO_LIBRARIES "${OPENSSL_CRYPTO_LIBRARY}" CACHE INTERNAL "crypto libraries to link") - set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${CRYPTO_INCLUDE_DIR}") - set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${CRYPTO_LIBRARIES}") - - check_symbol_exists("MD5_Update" "openssl/md5.h" HAVE_MD5_UPDATE) - check_symbol_exists("RIPEMD160_Update" "openssl/ripemd.h" HAVE_RIPEMD160_UPDATE) - check_symbol_exists("SHA1_Update" "openssl/sha.h" HAVE_SHA1_UPDATE) - check_symbol_exists("SHA224_Update" "openssl/sha.h" HAVE_SHA224_UPDATE) - check_symbol_exists("SHA256_Update" "openssl/sha.h" HAVE_SHA256_UPDATE) - check_symbol_exists("SHA384_Update" "openssl/sha.h" HAVE_SHA384_UPDATE) - check_symbol_exists("SHA512_Update" "openssl/sha.h" HAVE_SHA512_UPDATE) -endif() -cmake_pop_check_state() +monetdb_configure_crypto() check_type_size(ssize_t SIZEOF_SSIZE_T LANGUAGE C) if(NOT HAVE_SIZEOF_SSIZE_T) @@ -167,47 +95,9 @@ if(MSVC) set(inline "__inline") endif() -set(DIR_SEP "/") -set(PATH_SEP ":") -set(DIR_SEP_STR "/") -set(SO_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") -set(SO_EXT "${CMAKE_SHARED_LIBRARY_SUFFIX}") - include(GNUInstallDirs) -set(BINDIR "${CMAKE_INSTALL_FUL
MonetDB: mbedded - reorganize before starting to cleanup
Changeset: 62c2cc77b7bb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=62c2cc77b7bb Added Files: cmake/monetdb-defines.cmake cmake/monetdb-toolchain.cmake Modified Files: CMakeLists.txt cmake/monetdb-findpackages.cmake Branch: mbedded Log Message: reorganize before starting to cleanup diffs (truncated from 447 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ set(CMAKE_MODULE_PATH INTERNAL "Location of custom CMake modules.") - include(CMakeDependentOption REQUIRED) include(monetdb-options) @@ -44,114 +43,19 @@ include(CheckTypeSize REQUIRED) include(TestBigEndian REQUIRED) +# Include MonetDB specific functions include(monetdb-functions) include(monetdb-findpackages) +include(monetdb-defines) monetdb_hg_revision() -check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) -find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h") -find_path(HAVE_DLFCN_H "dlfcn.h") -find_path(HAVE_FCNTL_H "fcntl.h") -find_path(HAVE_ICONV_H "iconv.h") -find_path(HAVE_IO_H "io.h") -find_path(HAVE_KVM_H "kvm.h") -find_path(HAVE_LANGINFO_H "langinfo.h") -find_path(HAVE_LIBGEN_H "libgen.h") -find_path(HAVE_LIBINTL_H "libintl.h") -find_path(HAVE_MACH_MACH_INIT_H "mach/mach_init.h") -find_path(HAVE_MACH_TASK_H "mach/task.h") -find_path(HAVE_MACH_O_DYLD_H "mach-o/dyld.h") -check_symbol_exists("gethostbyname" "netdb.h" HAVE_NETDB_H) -find_path(HAVE_NETINET_IN_H "netinet/in.h") -find_path(HAVE_POLL_H "poll.h") -find_path(HAVE_PROCFS_H "procfs.h") -find_path(HAVE_PWD_H "pwd.h") -find_path(HAVE_STRINGS_H "strings.h") -find_path(HAVE_STROPTS_H "stropts.h") -find_path(HAVE_SYS_FILE_H "sys/file.h") -find_path(HAVE_SYS_IOCTL_H "sys/ioctl.h") -find_path(HAVE_SYS_IOCTL_H "sys/sysctl.h") -find_path(HAVE_SYS_MMAN_H "sys/mman.h") -find_path(HAVE_SYS_PARAM_H "sys/param.h") -find_path(HAVE_SYS_RESOURCE_H "sys/resource.h") -check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H) -check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H) -find_path(HAVE_SYS_TIMES_H "sys/times.h") -find_path(HAVE_SYS_UIO_H "sys/uio.h") -find_path(HAVE_SYS_UN_H "sys/un.h") -find_path(HAVE_SYS_UTIME_H "sys/utime.h") -find_path(HAVE_SYS_WAIT_H "sys/wait.h") -find_path(HAVE_TERMIOS_H "sys/termios.h") -find_path(HAVE_UNISTD_H "unistd.h") -find_path(HAVE_UUID_UUID_H "uuid/uuid.h") -find_path(HAVE_WINSOCK_H "winsock2.h") - -find_path(HAVE_SYS_TYPES_H "sys/types.h") -find_path(HAVE_SEMAPHORE_H "semaphore.h") -find_path(HAVE_GETOPT_H "getopt.h") -if(HAVE_GETOPT_H) - set(HAVE_GETOPT 1) -endif() - -check_include_file("stdatomic.h" HAVE_STDATOMIC_H) - +# required for symbol existance tests if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-D_XOPEN_SOURCE -D_GNU_SOURCE) - set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") # required for symbol existance tests + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") endif() -# Linux specific, in the future, it might be ported to other platforms -check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H) -check_symbol_exists("getaddrinfo" "netdb.h" HAVE_GETADDRINFO) -#check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H) -check_symbol_exists("fdatasync" "unistd.h" HAVE_FDATASYNC) - -check_symbol_exists("accept4" "sys/types.h;sys/socket.h" HAVE_ACCEPT4) # Some libc versions on Linux distributions don't have it -check_symbol_exists("asctime_r" "time.h" HAVE_ASCTIME_R) -check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME) -check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R) -check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h" HAVE_DISPATCH_SEMAPHORE_CREATE) -check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE) # Linux specific, in the future, it might be ported to other platforms -check_function_exists("fcntl" HAVE_FCNTL) -check_symbol_exists("fork" "unistd.h" HAVE_FORK) -check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC) -check_symbol_exists("ftime" "sys/timeb.h" HAVE_FTIME) -check_function_exists("getexecname" HAVE_GETEXECNAME) -check_function_exists("getlogin" HAVE_GETLOGIN) -check_symbol_exists("getopt_long" "getopt.h" HAVE_GETOPT_LONG) -check_function_exists("getrlimit" HAVE_GETRLIMIT) -check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) -check_function_exists("getuid" HAVE_GETUID) -check_symbol_exists("gmtime_r" "time.h" HAVE_GMTIME_R) -check_symbol_exists("localtime_r" "time.h" HAVE_LOCALTIME_R) -check_symbol_exists("strerror_r" "string.h" HAVE_STRERROR_R) -check_function_exists("lockf" HAVE_LOCKF) -check_symbol_exists("madvise" "sys/mman.h" HAVE_MADVISE) -check_symbol_exists("mremap" "sys/mman.h" HAVE_MREMAP) -check_function_exists("nanosleep" HAVE_NANOSLEEP) -check_function_exists("nl_langinfo" HAVE_NL_LANGINFO) -check_function_exists("_NSGetExecutablePath" HAVE__NSGETEXECUTABLEPATH) -check_symbol_exists("pipe2" "fcntl.h;unistd.h" HAVE_PIPE2) #
MonetDB: mbedded - next round of cmake cleanup
Changeset: 9d0b76e61cf3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d0b76e61cf3 Added Files: cmake/Modules/FindLidar.cmake cmake/Modules/FindLzma.cmake cmake/Toolchains/linux-gnu.cmake ctest/cmake/detect-lzma.cmake ctest/cmake/detect-readline.cmake ctest/cmake/test_detect_readline.c.in Modified Files: CMakeLists.txt cmake/Modules/FindNetCDF.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake ctest/cmake/CMakeLists.txt Branch: mbedded Log Message: next round of cmake cleanup diffs (truncated from 437 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ find_path(HAVE_SYS_TYPES_H "sys/types.h" find_path(HAVE_SEMAPHORE_H "semaphore.h") find_path(HAVE_GETOPT_H "getopt.h") if(HAVE_GETOPT_H) - set(HAVE_GETOPT 1) + set(HAVE_GETOPT 1) endif() check_include_file("stdatomic.h" HAVE_STDATOMIC_H) @@ -185,6 +185,7 @@ set(HAVE_SNAPPY ${SNAPPY_FOUND}) set(HAVE_UUID ${HAVE_UUID_GENERATE}) set(HAVE_VALGRIND ${VALGRIND_FOUND}) set(HAVE_NETCDF ${NETCDF_FOUND}) +set(HAVE_READLINE "${READLINE_FOUND}") set(SOCKET_LIBRARIES "") if (WIN32) diff --git a/cmake/Modules/FindLidar.cmake b/cmake/Modules/FindLidar.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindLidar.cmake @@ -0,0 +1,17 @@ + #include(/usr/share/cmake/libLAS/liblas-config.cmake) + #include(/usr/share/cmake/libLAS/liblas-config-version.cmake) + + #if(LIBLAS_FOUND) + #set(LIBLAS_VERSION_REQUIRED_MIN "1.8.0") + #if(LIBLAS_VERSION VERSION_LESS "${LIBLAS_MINIMUM_VERSION}") + ##if(${WITH_LIBLAS} STREQUAL "YES") + ## message(FATAL_ERROR "liblas library found, but the version is too old: ${LIBLAS_VERSION} < ${LIBLAS_MINIMUM_VERSION}") + ##else() + #message(STATUS "liblas library found, but the version is too old: ${LIBLAS_VERSION} < ${LIBLAS_MINIMUM_VERSION}") + ##endif() + #else() + #set(HAVE_LIDAR "${LIBLAS_FOUND}") + #endif() + ##else() + ## message(FATAL_ERROR "liblas library required for lidar module") + #endif() diff --git a/cmake/Modules/FindLzma.cmake b/cmake/Modules/FindLzma.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindLzma.cmake @@ -0,0 +1,19 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +find_package(LibLZMA) + +if (LIBLZMA_FOUND) + if(NOT TARGET LibLZMA::LibLZMA) +add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED) +set_target_properties(LibLZMA::LibLZMA PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR} + IMPORTED_LINK_INTERFACE_LANGUAGES C + IMPORTED_LOCATION ${LIBLZMA_LIBRARY}) + endif() +endif () diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake --- a/cmake/Modules/FindNetCDF.cmake +++ b/cmake/Modules/FindNetCDF.cmake @@ -33,8 +33,8 @@ if(NETCDF_FOUND) if(NETCDF_VERSION VERSION_LESS "${NETCDF_MINIMUM_VERSION}") message(STATUS "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") set(NETCDF_FOUND FALSE) -endif() endif() +endif() if(NETCDF_FOUND) add_library(NetCDF::NetCDF UNKNOWN IMPORTED) diff --git a/cmake/Toolchains/linux-gnu.cmake b/cmake/Toolchains/linux-gnu.cmake new file mode 100644 --- /dev/null +++ b/cmake/Toolchains/linux-gnu.cmake @@ -0,0 +1,35 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +# Our code is not (yet?) up to these: +# MT_checkCompilerFlag("-pedantic-errors") +# MT_checkCompilerFlag("-Wno-long-long") +# MT_checkCompilerFlag("-Waggregate-return") +# MT_checkCompilerFlag("-Wbad-function-cast") +# MT_checkCompilerFlag("-Wcast-qual") +# MT_checkCompilerFlag("-Wconversion") +# MT_checkCompilerFlag("-Wdisabled-optimization") +# MT_checkCompilerFlag("-Wfloat-equal") +# MT_checkCompilerFlag("-Winline") +# MT_checkCompilerFlag("-Wmissing-noreturn") +# MT_checkCompilerFlag("-Wpadded") +# MT_checkCompilerFlag("-Wredundant-decls") +# MT_checkCompilerFlag("-Wshadow") +# MT_checkCompilerFlag("-Wstrict-prototypes") +# MT_checkCompilerFlag("-Wswitch-default") +# MT_checkCompilerFlag("-Wswitch-enum") +# MT_checkCompilerFlag("-Wtraditional") +# MT_checkCompilerFlag("-Wtraditional-conversion") +# MT_checkCompilerFlag("-Wwrite-strings") +# MT_checkCompilerFlag("-Wc++-compat") +# MT_ch
MonetDB: mbedded - cleanup cmake code and add test
Changeset: c8662d5e2493 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8662d5e2493 Added Files: ctest/cmake/detect-netcdf.cmake ctest/cmake/test_detect_netcdf.c.in Modified Files: CMakeLists.txt README.md cmake/Modules/FindNetCDF.cmake cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/os_release_info.cmake ctest/cmake/CMakeLists.txt sql/backends/monet5/vaults/netcdf/CMakeLists.txt Branch: mbedded Log Message: cleanup cmake code and add test diffs (245 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,7 @@ set(HAVE_PROJ ${PROJ_FOUND}) set(HAVE_SNAPPY ${SNAPPY_FOUND}) set(HAVE_UUID ${HAVE_UUID_GENERATE}) set(HAVE_VALGRIND ${VALGRIND_FOUND}) +set(HAVE_NETCDF ${NETCDF_FOUND}) set(SOCKET_LIBRARIES "") if (WIN32) diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -19,15 +19,16 @@ PATH settings: None ROle of clients?? How to install ## Testing -For testing, you likely don't want to install in the default location, so you need to add the installation prefix parameter to the cmake command. - -But you do not need any configuration to run mtest (on Linux). Just run the command: +For testing, you likely don't want to install in the default location, so you need to add the installation prefix parameter to the cmake command. But you do not need any configuration to run mtest (on Linux). Just run the command: ``` cmake --build . --target mtest ``` ## Configuration options + +The way options interact with building of the MonetDB source has fundamentally changed from the way this was done using the autotools buildsystem. Now almost all options are on by default. And these options mostly control library detection. In the old system, it was possible to build a subset of the codebase. For example, you could choose not to build the sql part. Now the every part of the code is build, as long as the dependent libraries are detected. And by default, the system would try to detect all dependent libraries. If your system does not have a required library, that section of the code will not be build. Only if you want to prevent the build of a certain section, you could use the option to prevent that a dependency is detected. + Evidently there are several options to control as illustrated in $SOURCE/cmake/monetdb-options.cmake The important once to choose from are -DCMAKE\_BUILD\_TYPE, which takes the value Release or Debug. @@ -38,7 +39,6 @@ are being checked. Other relevant properties are also -DASSERT=ON and DSTRICT=ON, used in combination with a Debug build, e.g. - ``` CONFIGURE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DASSERT=ON -DSTRICT=ON" mkdir build @@ -48,7 +48,6 @@ cmake --build . cmake --build . --target install ``` - Explain the role of cmake --build . --target mtest In particular how to call it from anywhere in the tree diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake --- a/cmake/Modules/FindNetCDF.cmake +++ b/cmake/Modules/FindNetCDF.cmake @@ -12,7 +12,8 @@ find_path(NETCDF_INCLUDE_DIR NAMES netcd # Look for the library. find_library(NETCDF_LIBRARIES NAMES netcdf) -# Handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if all listed variables are TRUE. +# Handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND +# to TRUE if all listed variables are TRUE. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIR) @@ -28,6 +29,14 @@ endif() mark_as_advanced(NETCDF_INCLUDE_DIR NETCDF_LIBRARIES NETCDF_VERSION) if(NETCDF_FOUND) + set(NETCDF_MINIMUM_VERSION "4.2") + if(NETCDF_VERSION VERSION_LESS "${NETCDF_MINIMUM_VERSION}") +message(STATUS "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") +set(NETCDF_FOUND FALSE) +endif() + endif() + +if(NETCDF_FOUND) add_library(NetCDF::NetCDF UNKNOWN IMPORTED) set_target_properties(NetCDF::NetCDF PROPERTIES @@ -37,4 +46,3 @@ if(NETCDF_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${NETCDF_LIBRARIES}") endif() - diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -111,20 +111,6 @@ endif() if(NETCDF) find_package(NetCDF) - if(NETCDF_FOUND) -set(NETCDF_MINIMUM_VERSION "4.2") -if(NETCDF_VERSION VERSION_LESS "${NETCDF_MINIMUM_VERSION}") - if(${WITH_NETCDF} STREQUAL "YES") - message(FATAL_ERROR "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") - else() - message(STATUS "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") - endif() -else() - set(HAVE_NETC
MonetDB: mbedded - fix readme
Changeset: 4c1a99ae760b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c1a99ae760b Modified Files: CMakeLists.txt README.md cmake/monetdb-options.cmake ctest/cmake/CMakeLists.txt Branch: mbedded Log Message: fix readme diffs (127 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,9 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUA cmake_policy(SET CMP0076 OLD) endif() -set(CMAKE_FIND_FRAMEWORK LAST) # We give precedence to UNIX include directories over OS X Frameworks directories +# We give precedence to UNIX include directories over +# OS X Frameworks directories +set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_APPBUNDLE LAST) include(CheckCSourceCompiles REQUIRED) @@ -143,8 +145,8 @@ check_symbol_exists("sysconf" "unistd.h" check_function_exists("task_info" HAVE_TASK_INFO) check_function_exists("times" HAVE_TIMES) check_function_exists("uname" HAVE_UNAME) - -check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) # Some libc versions on Linux distributions don't have it +# Some libc versions on Linux distributions don't have it +check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) # Likely unused, because it contained typo's if(HAVE_PTHREAD_H) @@ -266,11 +268,13 @@ set(DATADIR "${CMAKE_INSTALL_FULL_DATADI set(DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}") set(LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}") if(WIN32) - string(REPLACE "/" "" QXLOCALSTATEDIR "${LOCALSTATEDIR}") # Fix cmake conversions + # Fix cmake conversions + string(REPLACE "/" "" QXLOCALSTATEDIR "${LOCALSTATEDIR}") endif() set(MONETDB_PREFIX "${CMAKE_INSTALL_PREFIX}") if(WIN32) - string(REPLACE "/" "" MONETDB_PREFIX "${CMAKE_INSTALL_PREFIX}") # Fix cmake conversions + # Fix cmake conversions + string(REPLACE "/" "" MONETDB_PREFIX "${CMAKE_INSTALL_PREFIX}") endif() set(DATAROOTDIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}") diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -2,34 +2,32 @@ ## Summary -For cmake, you should always build the code in a separate directory, say ${SOURCE}. -The results of the build are stored in a location designated by ${PREFIX}, a full path -to the location you want the binaries to be stored. -Make sure you have these environment variables set and you have write permissions to the ${PREFIX} location +For cmake, you should always build the code in a separate directory, say "build". This directory should be OUTSIDE of the source code tree. The results of the build are stored in this directory. The location on the filesystem is not important, as long as you have permissions to write in that location. -Assuming the monetdb source code is checked out in directory ${SOURCE}. -And if you have all the required packages(See below) to build MonetDB, these are the set of commands -to build and *install* it from source. Install is one of the predefined commands [install, test, mtest] +Assuming the monetdb source code is checked out in directory "/path/to/monetdb/source". And if you have all the required packages (See below) to build MonetDB, these are the set of commands to build and *install* it from source. Install is one of the predefined targets [install, test, mtest]. When you test monetdb, you will likely not want to install it in the default location, the standard GNU directory structure. So you want to set the install prefix variable when generating the build system, using -DCMAKE_INSTALL_PREFIX ``` mkdir build cd build -cmake -DCMAKE_INSTALL_PREFIX=$PREFIX ${SOURCE} +cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/monetdb /path/to/monetdb/source cmake --build . cmake --build . --target install ``` ## Prerequisites -PATH settings ??? +PATH settings: None ROle of clients?? How to install ## Testing -For testing, you likely don't want to install in the default location, so you need to add a parameter to the cmake command. +For testing, you likely don't want to install in the default location, so you need to add the installation prefix parameter to the cmake command. + +But you do not need any configuration to run mtest (on Linux). Just run the command: -The MonetDB Mtest.py program is installed in $PREFIX/lib/python3.7/site-packages/. -You have to set or extend the environment variable $PYTHON3PATH to include this location for Mtest. +``` +cmake --build . --target mtest +``` -##Configuration options +## Configuration options Evidently there are several options to control as illustrated in $SOURCE/cmake/monetdb-options.cmake The important once to choose from are -DCMAKE\_BUILD\_TYPE, which takes the value Release or Debug. @@ -45,7 +43,7 @@ Other relevant properties are also -DAS CONFIGURE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DASSERT=ON -DSTRICT=ON" mkdir build cd build -cmake $CONFIGURE_OPTIONS -DCMAKE_INSTALL_PREFIX=$PREFI
MonetDB: mbedded - start new readme
Changeset: c95de53b805a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c95de53b805a Added Files: README.md Branch: mbedded Log Message: start new readme diffs (28 lines): diff --git a/README.md b/README.md new file mode 100644 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# MonetDB + +## Summary + +For cmake, you should always build the code in a separete directory. For testing, you will likely don't want to install in the default location, so you need to add a parameter to the cmake command. Assuming the monetdb source code is checked out in "~/hg/MonetDB". And if you have all the required packages to build MonetDB, these are the set of commands to build and install it from source. + +``` +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=/tmp/monetdb ~/hg/MonetDB/ +cmake --build . +cmake --build . --target install +``` + +## Debian + +## Fedora + +## Windows + +## MacOS + +## How to start ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mbedded - add option and disable cmake unittests by def...
Changeset: cdbc5b6125a9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cdbc5b6125a9 Modified Files: cmake/monetdb-options.cmake ctest/CMakeLists.txt ctest/cmake/CMakeLists.txt Branch: mbedded Log Message: add option and disable cmake unittests by default diffs (37 lines): diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake --- a/cmake/monetdb-options.cmake +++ b/cmake/monetdb-options.cmake @@ -141,3 +141,7 @@ option(WITH_ZLIB option(CMAKE_SUMMARY "Show a summary of the cmake configuration (for debug purposes)" OFF) + +option(CMAKE_UNITTESTS + "Build and run the unittest for the build system" + OFF) diff --git a/ctest/CMakeLists.txt b/ctest/CMakeLists.txt --- a/ctest/CMakeLists.txt +++ b/ctest/CMakeLists.txt @@ -10,7 +10,9 @@ if(BUILD_TESTING) add_test(NAME TestEcho COMMAND ${CMAKE_COMMAND} -E echo 'MonetDB Testing') - add_subdirectory(cmake) + if(CMAKE_UNITTESTS) +add_subdirectory(cmake) + endif() add_subdirectory(monetdb5) add_subdirectory(tools) endif() diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -6,6 +6,8 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] +# For now these tests only work on special docker containers. + project(MonetDB-unittest LANGUAGES C) include(os_release_info) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mbedded - add unittests for cmake library detection
Changeset: c76d7e10d9c6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c76d7e10d9c6 Added Files: cmake/os_release_info.cmake ctest/cmake/CMakeLists.txt ctest/cmake/test_detect.c ctest/cmake/test_detect_bz2.c ctest/cmake/test_detect_curl.c ctest/cmake/test_detect_libz.c ctest/cmake/test_detect_lz4.c ctest/cmake/test_detect_lzma.c.in ctest/cmake/test_detect_pcre.c ctest/cmake/test_detect_proj.c Modified Files: cmake/monetdb-functions.cmake ctest/CMakeLists.txt Branch: mbedded Log Message: add unittests for cmake library detection diffs (truncated from 524 to 300 lines): diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -102,6 +102,8 @@ function(create_include_object) endfunction() function(monetdb_cmake_summary) + include(os_release_info) + message("Summary of cmake configuration of MonetDB") message("-") if(${CMAKE_VERSION} VERSION_LESS "3.14.0") @@ -109,6 +111,13 @@ function(monetdb_cmake_summary) else() message("Numpy target: ") endif() + message(STATUS "System name: ${CMAKE_SYSTEM_NAME}") + message(STATUS "System version: ${CMAKE_SYSTEM_VERSION}") + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +message(STATUS "Linux distro: ${LINUX_DISTRO}") +message(STATUS "Linux distro version: ${LINUX_DISTRO_VERSION}") + endif() message(STATUS "Geos library: ${GEOS_FOUND}") message(STATUS "Gdal library: ${GDAL_FOUND}") message(STATUS "Lzma library: ${LZMA_FOUND}") diff --git a/cmake/os_release_info.cmake b/cmake/os_release_info.cmake new file mode 100644 --- /dev/null +++ b/cmake/os_release_info.cmake @@ -0,0 +1,169 @@ +# Copyright (c) 2018, Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + + +if(NOT DEFINED _os_release_info) +set(_os_release_info TRUE) + + +# os_release_info.cmake - Function to dump OS name and version + +# This file has no dependencies on other files (e.g., functions or definitions) +# of the local cmake environment. + +# Set cmake policies for at least this level: +cmake_minimum_required(VERSION 2.8.12) + + +# Function get_os_release_info - Determine and return OS name and version +# +# Args: +# 1. the name of a variable to receive os_name +# 2. the name of a variable to receive os_version +# +# Return values: (Quotation marks are always stripped). +# Upon failure, return values are null strings. +# +# Examples: +# os_name os_version +# ----- +# clear-linux-os21180 (Changes twice daily) +# ubuntu12.04 16.04 17.10 18.04 +# fedora27 +# centos6.9 7.4.1708 +# +# Potential sources are tried (in order of preference) until a +# suitable one is found. + +# Implementation documentation: +# +# The potential sources, in order, are as follows. +# - /etc/centos-release +# Centos 7 also has /etc/os-release. File /etc/os-release is less +# precise about the Centos version (e.g., "7" instead of "7.4.1708"). +# For that reason, this file is checked first. +# Examples: +# CentOS release 6.9 (Final) +# CentOS Linux release 7.4.1708 (Core) +# - /usr/lib/os-release +# Present for Clear Linux, modern Fedora, and Ubuntu since some time +# between 14.04 and 16.04. The ID and VERSION_ID values are used. +# Examples: +# ID=clear-linux-os VERSION_ID=21180 +# ID=fedora VERSION_ID=27 +# ID=ubuntu VERSION_ID="14.04" +# ID=ubuntu VERSION_ID="16.04" +# ID="ubuntu"VERSION_ID="17.10" +# - /etc/os-release - Same form as (sometimes a link to) /usr/lib/os-release +# ID="Ubuntu"VERSION_ID="12.04" +#
MonetDB: mbedded - cleanup cmake code, part 1 of many
Changeset: 79ed2e0c7556 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=79ed2e0c7556 Modified Files: CMakeLists.txt Release.md cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message: cleanup cmake code, part 1 of many diffs (truncated from 602 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,8 +42,8 @@ include(CheckTypeSize REQUIRED) include(TestBigEndian REQUIRED) +include(monetdb-functions) include(monetdb-findpackages) -include(monetdb-functions) monetdb_hg_revision() check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) @@ -146,19 +146,20 @@ check_function_exists("uname" HAVE_UNAME check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) # Some libc versions on Linux distributions don't have it +# Likely unused, because it contained typo's if(HAVE_PTHREAD_H) - check_function_exits("pthread_kill" HAVE_PTHREAD_KILL) - check_function_exits("pthread_sigmask" HAVE_PTHREAD_SIGMASK) + check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) + check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) endif() # On C99, but we have to calculate the size check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) if(HAVE_NETDB_H) - set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") + set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") endif() if(HAVE_WINSOCK_H) - set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") + set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") endif() check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C) @@ -184,7 +185,7 @@ set(HAVE_VALGRIND ${VALGRIND_FOUND}) set(SOCKET_LIBRARIES "") if (WIN32) - set(SOCKET_LIBRARIES "ws2_32") + set(SOCKET_LIBRARIES "ws2_32") endif() cmake_push_check_state() @@ -201,10 +202,10 @@ if(COMMONCRYPTO_FOUND) add_library(OpenSSL::Crypto UNKNOWN IMPORTED) set_target_properties(OpenSSL::Crypto PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${COMMONCRYPTO_INCLUDE_DIR}") +INTERFACE_INCLUDE_DIRECTORIES "${COMMONCRYPTO_INCLUDE_DIR}") set_target_properties(OpenSSL::Crypto PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${COMMONCRYPTO_LIBRARIES}") +IMPORTED_LINK_INTERFACE_LANGUAGES "C" +IMPORTED_LOCATION "${COMMONCRYPTO_LIBRARIES}") endif() if(OPENSSL_FOUND) #set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCUDE_DIR}") diff --git a/Release.md b/Release.md --- a/Release.md +++ b/Release.md @@ -11,7 +11,7 @@ There are 3 different sets of versions: - The monetdb version number - The monetb libraries version numbers -The version description is "unreleased", unless there is an actual release. Than is contains the name, for example "Nov2019-SP3". The monetdb version number is the version of the entire application, previously managed with vertoo. It contains three parts, a major, minor and release number. The release number is even during development and incremented to even for the actual release version. +The version description is "unreleased", unless there is an actual release. Than it contains the name, for example "Nov2019-SP3". The monetdb version number is the version of the entire application, previously managed with vertoo. It contains three parts, a major, minor and release number. The release number is even during development and incremented to even for the actual release version. ## Building a release When doing a release build, the only extra thing to do is to add the "-DRELEASE_VERSION=ON" parameter to the cmake command. This will make sure that the build will use the required version string and numbers. After building a successful release the final step is to tag the current version of the code in the release branch. Then you can start the next release by incrementing the "release" number of the monetdb version by 2. Or if necessary, create a new release branch. diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -6,7 +6,10 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] +# Detect required packages find_package(BISON REQUIRED) +find_package(Iconv) +find_package(Threads) if(${CMAKE_VERSION} VERSION_LESS "3.14.0") find_package(Python3 COMPONENTS Interpreter Development) @@ -28,8 +31,6 @@ if(WIN32) find_library(GETOPT_LIB "getopt.lib") endif() -find_package(Iconv) - if(WITH_LZMA) find_package(LibLZMA) @@ -41,24 +42,20 @@ if(WITH_LZMA) IMPORTED_LINK_INTERFACE_LANGUAGES C IMPORTED_LOCATION ${LIBLZMA_LIBRARY}) endif() -set(HAVE_LIBLZMA "${LZMA_FOUND}") endif () - endif() if(WITH_XML2) find_package(LibXml2) - set(HAVE_LIBXML "
MonetDB: mbedded - remove most of the old build system
Changeset: 9ca4009432ed for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9ca4009432ed Removed Files: Makefile.ag bootstrap buildtools/Makefile.ag buildtools/conf/Makefile.ag clients/Makefile.ag clients/NT/Makefile.ag clients/examples/C/Makefile.ag clients/examples/Makefile.ag clients/examples/perl/Makefile.ag clients/examples/php/Makefile.ag clients/mapiclient/Makefile.ag clients/mapilib/Makefile.ag clients/odbc/Makefile.ag clients/odbc/driver/Makefile.ag clients/odbc/samples/Makefile.ag clients/odbc/setup/Makefile.ag clients/odbc/winsetup/Makefile.ag common/Makefile.ag common/options/Makefile.ag common/stream/Makefile.ag common/utils/Makefile.ag configure.ag de-bootstrap gdk/Makefile.ag geom/Makefile.ag geom/lib/Makefile.ag geom/monetdb5/Makefile.ag geom/sql/Makefile.ag libversions monetdb5/Makefile.ag monetdb5/NT/Makefile.ag monetdb5/extras/Makefile.ag monetdb5/extras/mal_optimizer_template/Makefile.ag monetdb5/extras/rapi/Makefile.ag monetdb5/mal/Makefile.ag monetdb5/modules/Makefile.ag monetdb5/modules/atoms/Makefile.ag monetdb5/modules/kernel/Makefile.ag monetdb5/modules/mal/Makefile.ag monetdb5/optimizer/Makefile.ag monetdb5/scheduler/Makefile.ag monetdb5/tools/Makefile.ag sql/Makefile.ag sql/NT/Makefile.ag sql/backends/Makefile.ag sql/backends/monet5/Makefile.ag sql/backends/monet5/UDF/Makefile.ag sql/backends/monet5/UDF/capi/Makefile.ag sql/backends/monet5/UDF/pyapi3/Makefile.ag sql/backends/monet5/UDF/udf/Makefile.ag sql/backends/monet5/generator/Makefile.ag sql/backends/monet5/vaults/Makefile.ag sql/backends/monet5/vaults/fits/Makefile.ag sql/backends/monet5/vaults/lidar/Makefile.ag sql/backends/monet5/vaults/netcdf/Makefile.ag sql/backends/monet5/vaults/shp/Makefile.ag sql/common/Makefile.ag sql/include/Makefile.ag sql/scripts/Makefile.ag sql/server/Makefile.ag sql/storage/Makefile.ag sql/storage/bat/Makefile.ag testing/Makefile.ag tools/Makefile.ag tools/merovingian/Makefile.ag tools/merovingian/client/Makefile.ag tools/merovingian/daemon/Makefile.ag tools/merovingian/daemon/config/Makefile.ag tools/merovingian/utils/Makefile.ag tools/mserver/Makefile.ag vertoo.config vertoo.data Branch: mbedded Log Message: remove most of the old build system diffs (truncated from 5544 to 300 lines): diff --git a/Makefile.ag b/Makefile.ag deleted file mode 100644 --- a/Makefile.ag +++ /dev/null @@ -1,25 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - -SUBDIRS = buildtools common clients \ - gdk \ - monetdb5 \ - sql \ - HAVE_GEOM?geom \ - tools \ - HAVE_TESTING?testing \ - -EXTRA_DIST = bootstrap configure configure.ac configure.ag libversions \ - MonetDB.spec rpm.mk.in COPYING README.rst license.txt HowToStart.rst \ - README-Fedora README-Debian - -EXTRA_DIST_DIR = NT debian MacOSX documentation - -headers_config = { - DIR = includedir/monetdb - HEADERS = h - SOURCES = monetdb_config.h -} diff --git a/bootstrap b/bootstrap deleted file mode 100755 --- a/bootstrap +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - -# NOTE: if you happen to have bootstrap failures due to missing M4 -# macros, export M4DIRS as a space separated list of directories where -# aclocal should look in your environment. - -PYTHONPATH=${PWD:-$(pwd)}/buildtools/autogen${PYTHONPATH:+:$PYTHONPATH} -export PYTHONPATH - -# cope with systems where libtool is not GNU libtool, e.g. Darwin -if type -P glibtoolize > /dev/null; then -libtoolize=glibtoolize -else -libtoolize=libtoolize -fi - -# cope with systems where aclocal is known as aclocal-1.10 (and -# automake as automake-1.10), e.g. OpenIndiana -amv= -if ! type -P aclocal > /dev/null; then -if type -P aclocal-1.11 > /dev/null; then - amv=-1.11 -elif type -P aclocal-1.10 > /dev/null; then - amv=-1.10 -fi -fi - -_m4_extra_dirs= -if [[ -n ${M4DIRS} ]] ; then - for d in ${M4DIRS} ; do -
MonetDB: mbedded - fix geom/gdal
Changeset: f6c2eda9bac2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f6c2eda9bac2 Modified Files: cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-options.cmake common/utils/matomic.h create_include_object.py.in geom/lib/CMakeLists.txt geom/monetdb5/CMakeLists.txt geom/sql/40_geom.sql monetdb_config.h.in monetdb_config_win32.h.in sql/backends/monet5/vaults/shp/CMakeLists.txt sql/backends/monet5/vaults/shp/shp.c sql/backends/monet5/vaults/shp/shp.h Branch: mbedded Log Message: fix geom/gdal diffs (293 lines): diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -7,6 +7,7 @@ #]] find_package(BISON REQUIRED) + if(${CMAKE_VERSION} VERSION_LESS "3.14.0") find_package(Python3 COMPONENTS Interpreter Development) find_package(NumPy) @@ -26,7 +27,9 @@ endif(PY3INTEGRATION) if(WIN32) find_library(GETOPT_LIB "getopt.lib") endif() + find_package(Iconv) + if(WITH_LZMA) find_package(LibLZMA) @@ -42,6 +45,7 @@ if(WITH_LZMA) endif () endif() + if(WITH_XML2) find_package(LibXml2) set(HAVE_LIBXML "${LIBXML2_FOUND}") @@ -123,27 +127,19 @@ if(NETCDF) endif() endif() -if(GEOM) - find_package(Geos) - set(HAVE_GEOM "${GEOS_FOUND}") -endif() - find_package(KVM) set(HAVE_KVM "${KVM_FOUND}") -if(SHP) - if(NOT HAVE_GEOM) - #message(FATAL_ERROR "geom module required for ESRI Shapefile vault") - message(STATUS "geom module required for ESRI Shapefile vault") - else() - find_package(GDAL) +if(GEOM) + find_package(Geos) +endif() - if(GDAL_FOUND) - set(HAVE_SHP "${GDAL_FOUND}") - #else() - #message(FATAL_ERROR "gdal library required for ESRI Shapefile vault") - endif() - endif() +if(SHP) + if(NOT GEOS_FOUND) +message(STATUS "Disable SHP, geom module required for ESRI Shapefile vault") + else() +find_package(GDAL) + endif() endif() if(LIDAR) diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake --- a/cmake/monetdb-functions.cmake +++ b/cmake/monetdb-functions.cmake @@ -86,5 +86,7 @@ function(monetdb_cmake_summary) else() message("Numpy target: ") endif() + message(STATUS "Geos library: ${GEOS_FOUND}") + message(STATUS "Gdal library: ${GDAL_FOUND}") message("-") endfunction() diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake --- a/cmake/monetdb-options.cmake +++ b/cmake/monetdb-options.cmake @@ -63,9 +63,10 @@ option(ODBC "Compile the MonetDB ODBC driver (default=ON)" ON) -# needs gdal -option(SHP +cmake_dependent_option(SHP "Enable support for ESRI Shapefiles (default=ON)" + ON + GEOM ON) set(ENABLE_MAPI "YES" CACHE STRING "Enable MAPI (default=YES)") # Check with HAVE_MAPI diff --git a/common/utils/matomic.h b/common/utils/matomic.h --- a/common/utils/matomic.h +++ b/common/utils/matomic.h @@ -241,7 +241,7 @@ typedef volatile int ATOMIC_FLAG; /* the new way of doing this according to GCC (the old way, using * __sync_* primitives is not supported) */ -#if SIZEOF_SSIZE_T == 8 +#if SIZEOF_SIZE_T == 8 typedef int64_t ATOMIC_BASE_TYPE; typedef volatile int64_t ATOMIC_TYPE; #else diff --git a/create_include_object.py.in b/create_include_object.py.in --- a/create_include_object.py.in +++ b/create_include_object.py.in @@ -12,9 +12,16 @@ import argparse def open_convert_file(srcfile): -with open(srcfile, 'r') as f: -content = f.read() -return content +if os.path.isfile(srcfile): +with open(srcfile, 'r') as f: +try: +content = f.read() +except UnicodeDecodeError as err: +print("Conversion error: {0}".format(err)) +sys.exit(1) +return content +else: +raise FileNotFoundError def write_c_file(module_name, language, buffer_as_string, c_filename): @@ -156,10 +163,13 @@ def main(): parser.add_argument("c_filename", help="The name of the c file to output") args=parser.parse_args() -create_c_sourcefile(args.filename, -args.language, -args.name, -args.c_filename) +try: +create_c_sourcefile(args.filename, +args.language, +args.name, +args.c_filename) +except FileNotFoundError: +print("Source file {0} not found.".format(args.name)) if __name__ == '__main__': diff --git a/geom/lib/CMakeLists.txt b/geom/lib/CMakeLists.txt --- a/geom/lib/CMakeLists.txt +++ b/geom/lib/CMakeLists.txt @@ -6,7 +6,7 @@ # Copyright 1997 - July
MonetDB: mbedded - add numpy detection for older cmake
Changeset: 26462780501d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=26462780501d Added Files: cmake/Modules/FindNumPy.cmake Modified Files: CMakeLists.txt cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake cmake/monetdb-options.cmake sql/backends/monet5/UDF/pyapi3/CMakeLists.txt Branch: mbedded Log Message: add numpy detection for older cmake diffs (187 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ project(MonetDB VERSION "${MONETDB_VERSI set(C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 99) -if(NOT WIN32) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0") cmake_policy(SET CMP0076 OLD) endif() @@ -416,3 +416,7 @@ include(monetdb-packages) include(CTest) add_subdirectory(ctest) + +if(CMAKE_SUMMARY) + monetdb_cmake_summary() +endif() diff --git a/cmake/Modules/FindNumPy.cmake b/cmake/Modules/FindNumPy.cmake new file mode 100644 --- /dev/null +++ b/cmake/Modules/FindNumPy.cmake @@ -0,0 +1,89 @@ +# - Find the NumPy libraries +# This module finds if NumPy is installed, and sets the following variables +# indicating where it is. +# +# TODO: Update to provide the libraries and paths for linking npymath lib. +# +# NUMPY_FOUND - was NumPy found +# NUMPY_VERSION - the version of NumPy found as a string +# NUMPY_VERSION_MAJOR - the major version number of NumPy +# NUMPY_VERSION_MINOR - the minor version number of NumPy +# NUMPY_VERSION_PATCH - the patch version number of NumPy +# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601 +# NUMPY_INCLUDE_DIRS- path to the NumPy include files + +# +# Copyright 2012 Continuum Analytics, Inc. +# +# MIT License +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# + +# Finding NumPy involves calling the Python interpreter +if(NumPy_FIND_REQUIRED) +find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +else() + find_package(Python3 COMPONENTS Interpreter Development) +endif() + +if(NOT PYTHONINTERP_FOUND) +set(NUMPY_FOUND FALSE) +endif() + +execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" +"import numpy as n; print(n.__version__); print(n.get_include());" +RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS +OUTPUT_VARIABLE _NUMPY_VALUES +ERROR_VARIABLE _NUMPY_ERROR_VALUE +OUTPUT_STRIP_TRAILING_WHITESPACE) + +if(NOT _NUMPY_SEARCH_SUCCESS MATCHES 0) +if(NumPy_FIND_REQUIRED) +message(FATAL_ERROR +"NumPy import failure:\n${_NUMPY_ERROR_VALUE}") +endif() +set(NUMPY_FOUND FALSE) +endif() + +# Convert the process output into a list +string(REGEX REPLACE ";" ";" _NUMPY_VALUES ${_NUMPY_VALUES}) +string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES}) +list(GET _NUMPY_VALUES 0 NUMPY_VERSION) +list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS) + +# Make sure all directory separators are '/' +string(REGEX REPLACE "" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS}) + +# Get the major and minor version numbers +string(REGEX REPLACE "\\." ";" _NUMPY_VERSION_LIST ${NUMPY_VERSION}) +list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR) +list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR) +list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH) +string(REGEX MATCH "[0-9]*" NUMPY_VERSION_PATCH ${NUMPY_VERSION_PATCH}) +math(EXPR NUMPY_VERSION_DECIMAL +"(${NUMPY_VERSION_MAJOR} * 1) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}") + +find_package_message(NUMPY +"Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}" +"${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}") + +set(NUMPY_FOUND TRUE) diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/c
MonetDB: mbedded - do not package tests
Changeset: 0863b325bb11 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0863b325bb11 Modified Files: cmake/monetdb-packages.cmake Branch: mbedded Log Message: do not package tests diffs (12 lines): diff --git a/cmake/monetdb-packages.cmake b/cmake/monetdb-packages.cmake --- a/cmake/monetdb-packages.cmake +++ b/cmake/monetdb-packages.cmake @@ -11,7 +11,7 @@ set(CPACK_GENERATOR "TGZ;ZIP") list (APPEND CPACK_SOURCE_IGNORE_FILES "Tests") list (APPEND CPACK_SOURCE_IGNORE_FILES ".hg") -list (APPEND CPACK_SOURCE_IGNORE_FILES "^test") +list (APPEND CPACK_SOURCE_IGNORE_FILES "/test/") list (APPEND CPACK_SOURCE_IGNORE_FILES "benchmarks") include(monetdb-deb-packages) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - remove settings related to jsonstore
Changeset: 4831ff29cbc1 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4831ff29cbc1 Modified Files: MonetDB.spec NT/monetdb_config.h.in NT/rules.msc monetdb5/mal/mal.c testing/Mtest.py.in Branch: default Log Message: remove settings related to jsonstore diffs (73 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -909,7 +909,6 @@ developer, but if you do want to test, t --enable-gsl=yes \ --enable-instrument=no \ --enable-jdbc=no \ - --enable-jsonstore=no \ --enable-merocontrol=no \ --enable-microhttpd=no \ --enable-monetdb5=yes \ diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -221,9 +221,6 @@ #define HAVE_ISINF 1 #endif -/* Define that you want to build the jsonstore library */ -/* #undef HAVE_JSONSTORE */ - /* Define to 1 if you have the `kill' function. */ /* #undef HAVE_KILL */ diff --git a/NT/rules.msc b/NT/rules.msc --- a/NT/rules.msc +++ b/NT/rules.msc @@ -423,11 +423,6 @@ create_winconfig_conds_new_py: !ELSE $(ECHO) HAVE_SQL_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" !ENDIF -!IFDEF HAVE_JSONSTORE - $(ECHO) HAVE_JSONSTORE_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" -!ELSE - $(ECHO) HAVE_JSONSTORE_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" -!ENDIF !IFDEF HAVE_TESTING $(ECHO) HAVE_TESTING_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" !ELSE diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c --- a/monetdb5/mal/mal.c +++ b/monetdb5/mal/mal.c @@ -91,9 +91,6 @@ int mal_init(void){ initParser(); initHeartbeat(); initResource(); -#ifdef HAVE_JSONSTORE - startHttpdaemon(); -#endif RECYCLEinit(); if( malBootstrap() == 0) return -1; @@ -140,9 +137,6 @@ void mal_exit(void){ } #endif setHeartbeat(0); -#ifdef HAVE_JSONSTORE - stopHttpdaemon(); -#endif stopMALdataflow(); stopProfiler(); RECYCLEdrop(mal_clients); /* remove any left over intermediates */ diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -303,7 +303,6 @@ CONDITIONALS = { 'HAVE_JAVA': "@HAVE_JAVA_FALSE@", 'HAVE_JAVAJDBC': "@HAVE_JAVAJDBC_FALSE@", 'HAVE_JAVAMEROCONTROL' : "@HAVE_JAVAMEROCONTROL_FALSE@", -'HAVE_JSONSTORE' : "@HAVE_JSONSTORE_FALSE@", 'HAVE_LIBBZ2' : "@HAVE_LIBBZ2_FALSE@", 'HAVE_LIBR': "@HAVE_LIBR_FALSE@", 'HAVE_LIBZ': "@HAVE_LIBZ_FALSE@", ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merge after rebase
Changeset: bea2309038bc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bea2309038bc Modified Files: clients/Tests/All Branch: default Log Message: merge after rebase diffs (9 lines): diff --git a/clients/Tests/All b/clients/Tests/All --- a/clients/Tests/All +++ b/clients/Tests/All @@ -1,4 +1,4 @@ exports -HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&HAVE_SAMTOOLS&HAVE_SPHINXCLIENT&!HAVE_JSONSTORE?MAL-signatures_all +HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&HAVE_SAMTOOLS&HAVE_SPHINXCLIENT?MAL-signatures_all HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_SAMTOOLS&!BITS32?SQL-dump_all MERCURIAL?malcheck ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - remove jsonstore code we do not need for the ...
Changeset: e6f13746b75b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e6f13746b75b Removed Files: sql/backends/monet5/rest/73_jsonstore.mal sql/backends/monet5/rest/Makefile.ag sql/backends/monet5/rest/Tests/All sql/backends/monet5/rest/Tests/jsonstore00.sql sql/backends/monet5/rest/Tests/jsonstore00.stable.err sql/backends/monet5/rest/Tests/jsonstore00.stable.out sql/backends/monet5/rest/Tests/jsonstore01.sql sql/backends/monet5/rest/Tests/jsonstore01.stable.err sql/backends/monet5/rest/Tests/jsonstore01.stable.out sql/backends/monet5/rest/jsonstore.mal sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Modified Files: configure.ag monetdb5/mal/Makefile.ag monetdb5/mal/mal_http_daemon.c sql/backends/monet5/Makefile.ag Branch: default Log Message: remove jsonstore code we do not need for the next feature release diffs (truncated from 2238 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -188,30 +188,13 @@ no-auto) ;; esac -dft_jsonstore=no -AC_ARG_ENABLE(jsonstore, - AS_HELP_STRING([--enable-jsonstore], - [enable support for MonetDB/jsonstore (default=no)]), - enable_jsonstore=$enableval, - enable_jsonstore=$dft_jsonstore) - -dft_microhttpd=$enable_jsonstore +dft_microhttpd=no AC_ARG_ENABLE(microhttpd, AS_HELP_STRING([--enable-microhttpd], - [enable support for the builtin MircoHTTPD daemon (default: implied by --enable-jsonstore)]), + [enable support for the builtin MircoHTTPD daemon]), enable_microhttpd=$enableval, enable_microhttpd=$dft_microhttpd) -case "$enable_jsonstore-$enable_microhttpd" in -yes-no) - AC_MSG_ERROR([jsonstore require microhttpd]) - ;; -auto-no) - enable_jsonstore=no - disable_jsonstore="(jsonstore requires microhttpd)" - ;; -esac - dft_gsl=auto AC_ARG_ENABLE(gsl, AS_HELP_STRING([--enable-gsl], @@ -2508,7 +2491,7 @@ if test x"$have_atomic_ops" = x"yes" ; t fi dnl MicroHTTPD library -dnl required for MonetDB5 SQL jsonstore, optional otherwise +dnl optional org_have_libmicrohttpd=auto have_libmicrohttpd=$org_have_libmicrohttpd if test "x$enable_microhttpd" != xno; then @@ -2526,24 +2509,6 @@ if test x$enable_microhttpd != xno; then AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if the microhttpd server is to be enabled]) fi -org_have_liburiparser=auto -have_liburiparser=$org_have_liburiparser -if test "x$enable_jsonstore" != xno; then - dnl Uriparser library - dnl required for MonetDB5 SQL jsonstore, optional otherwise - PKG_CHECK_MODULES([liburiparser], [liburiparser], - [have_liburiparser=yes], - [have_liburiparser=no; disable_jsonstore="(liburiparser not found)"; if test "x$enable_jsonstore" = xyes; then AC_MSG_ERROR([LibUriParser library not found but required for jsonstore]); fi]) - - if test "$have_libmicrohttpd-$have_liburiparser" = yes-yes; then - AC_DEFINE(HAVE_JSONSTORE, 1, [Define that you want to build the jsonstore library]) - elif test "x$enable_jsonstore" = xyes; then - AC_MSG_ERROR([cannot enable jsonstore $why_have_libmicrohttpd$why_have_liburiparser]) - else - enable_jsonstore=no - fi -fi - dnl Check for gsl library for statistical functions org_have_gsl=no have_gsl=$org_have_gsl @@ -2920,7 +2885,6 @@ AM_CONDITIONAL(HAVE_GDK, test "x$enable_ AM_CONDITIONAL(HAVE_MONETDB5, test "x$enable_monetdb5" = xyes -o "x$enable_monetdb5" = xauto) AM_CONDITIONAL(HAVE_SQL, test "x$enable_sql" = xyes -o "x$enable_sql" = xauto) AM_CONDITIONAL(HAVE_GEOM, test "x$enable_geom" = xyes -o "x$enable_geom" = xauto) -AM_CONDITIONAL(HAVE_JSONSTORE, test "x$enable_jsonstore" = xyes -o "x$enable_jsonstore" = xauto) AM_CONDITIONAL(HAVE_TESTING, test "x$enable_testing" = xyes -o "x$enable_testing" = xauto) AM_CONDITIONAL(HAVE_DEVELOPER, test "x$enable_developer" = xyes) @@ -3277,7 +3241,6 @@ for comp in \ 'console ' \ 'gsl ' \ 'fits' \ - 'jsonstore ' \ 'microhttpd ' \ 'rintegration' \ 'odbc' \ diff --git a/monetdb5/mal/Makefile.ag b/monetdb5/mal/Makefile.ag --- a/monetdb5/mal/Makefile.ag +++ b/monetdb5/mal/Makefile.ag @@ -9,7 +9,6 @@ INCLUDES = ../../common/options \ ../../common/utils \ ../../clients/mapilib \ ../../gdk \ - #../../sql/backends/monet5/rest \ $(READLINE_INCS) \ $(libmicrohttpd_CFLAGS) MTSAFE diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_dae
MonetDB: default - fix problem with corner case in json aggregate
Changeset: cd7456707103 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cd7456707103 Modified Files: monetdb5/modules/atoms/json.c Branch: default Log Message: fix problem with corner case in json aggregate diffs (32 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1809,10 +1809,24 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, break; } if (!v||strNil(v)) { - if (skip_nils) - continue; - strncpy(buf, str_nil, buflen); - isnil = 1; + if (skip_nils) { + /* +* if q is 1 and the value is +* null, then we need to fill +* in a value. Otherwise +* BATproject will fail. +*/ + if ((p == 0 ) && (q == 1)) { + strncpy(buf, "[ null ]", maxlen - buflen); + buflen += strlen("[ null ]"); + isnil = 1; + } else { + continue; + } + } else { + strncpy(buf, str_nil, buflen); + isnil = 1; + } } else { len = strlen(v); if (len >= maxlen - buflen) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - indent and approve test output
Changeset: 881793198b59 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=881793198b59 Modified Files: monetdb5/modules/atoms/json.c sql/test/json/Tests/aggregate01.stable.out Branch: default Log Message: indent and approve test output diffs (162 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1793,57 +1793,57 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, map = (const oid *) Tloc(t2, BUNfirst(t2)); } if (g && BATtdense(g)) { - for (p = 0, q = BATcount(g); p < q; p++) { - switch(b->ttype) { + for (p = 0, q = BATcount(g); p < q; p++) { + switch(b->ttype) { case TYPE_str: - v = (const char *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); - break; - case TYPE_dbl: - val = (const double *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); - if (*val != dbl_nil) { - snprintf(temp, sizeof(temp), "%f", *val); - v = (const char *)temp; - } else { - v = NULL; + v = (const char *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); + break; + case TYPE_dbl: + val = (const double *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); + if (*val != dbl_nil) { + snprintf(temp, sizeof(temp), "%f", *val); + v = (const char *)temp; + } else { + v = NULL; + } + break; } - break; - } - if (!v||strNil(v)) { - if (skip_nils) - continue; - strncpy(buf, str_nil, buflen); - isnil = 1; - } else { - len = strlen(v); - if (len >= maxlen - buflen) { - maxlen += len + BUFSIZ; - buf = GDKrealloc(buf, maxlen); - if (buf == NULL) { - err = MAL_MALLOC_FAIL; - goto bunins_failed; + if (!v||strNil(v)) { + if (skip_nils) + continue; + strncpy(buf, str_nil, buflen); + isnil = 1; + } else { + len = strlen(v); + if (len >= maxlen - buflen) { + maxlen += len + BUFSIZ; + buf = GDKrealloc(buf, maxlen); + if (buf == NULL) { + err = MAL_MALLOC_FAIL; + goto bunins_failed; + } + } + switch (b->ttype) { + case TYPE_str: + len = snprintf(buf + buflen, maxlen - buflen, "[ \"%s\" ]", v); + buflen += len; + break; + case TYPE_dbl: + len = snprintf(buf + buflen, maxlen - buflen, "[ %s ]", v); + buflen += len; + break; } } - switch (b->ttype) { - case TYPE_str: - len = snprintf(buf + buflen, maxlen - buflen, "[ \"%s\" ]", v); - buflen += len; -
MonetDB: default - improve partial implementation of tojsonarry ...
Changeset: a8aabbf7b564 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a8aabbf7b564 Modified Files: monetdb5/modules/atoms/json.c sql/test/json/Tests/aggregate01.sql Branch: default Log Message: improve partial implementation of tojsonarry aggregate diffs (148 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1802,8 +1802,12 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, prev = grps[0]; isnil = 0; for (p = 0, q = BATcount(g); p <= q; p++) { + if (p == 0) { + strncpy(buf + buflen, "[ ", maxlen - buflen); + buflen += 2; + } if (p == q || grps[p] != prev) { - strncpy(buf + buflen, " ]", buflen); + strncpy(buf + buflen, " ]", maxlen - buflen); buflen += 2; while (BATcount(bn) < prev - min) { bunfastapp_nocheck(bn, BUNlast(bn), str_nil, Tsize(bn)); @@ -1811,11 +1815,13 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, } bunfastapp_nocheck(bn, BUNlast(bn), buf, Tsize(bn)); nils += strNil(buf); - strncpy(buf, str_nil, maxlen); + strncpy(buf + buflen, str_nil, maxlen - buflen); buflen = 0; if (p == q) break; prev = grps[p]; + strncpy(buf + buflen, "[ ", maxlen - buflen); + buflen += 2; isnil = 0; } if (isnil) @@ -1851,8 +1857,8 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, } switch (b->ttype) { case TYPE_str: - if (buflen == 0) { - len = snprintf(buf + buflen, maxlen - buflen, "[ \"%s\"", v); + if (buflen == 2) { + len = snprintf(buf + buflen, maxlen - buflen, "\"%s\"", v); buflen += len; } else { len = snprintf(buf + buflen, maxlen - buflen, ", \"%s\"", v); @@ -1860,8 +1866,8 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, } break; case TYPE_dbl: - if (buflen == 0) { - len = snprintf(buf + buflen, maxlen - buflen, "[ %s", v); + if (buflen == 2) { + len = snprintf(buf + buflen, maxlen - buflen, "%s", v); buflen += len; } else { len = snprintf(buf + buflen, maxlen - buflen, ", %s", v); @@ -1875,8 +1881,22 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, t2 = NULL; } else { for (p = BUNfirst(b), q = p + BATcount(b); p < q; p++) { - v = (const char *) BUNtail(bi, p); - if (strNil(v)) { + switch(b->ttype) { + case TYPE_str: + v = (const char *) BUNtail(bi, p); + break; + case TYPE_dbl: + val = (const double *) BUNtail(bi, p); + if (*val != dbl_nil) { + snprintf(temp, sizeof(temp), "%f", *val); + v = (const char *)temp; + } else { + v = NULL; + } + break; + } + + if (!v||strNil(v)) { if (skip_nils) continue; strncpy(buf, str_nil, buflen); @@ -1892,12 +1912,25 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, goto bunins_failed; } } - if (buflen == 0) { - len = sn
MonetDB: default - handle special case for aggregate if BATdense...
Changeset: 5f28f362245c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f28f362245c Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/json.mal sql/scripts/40_json.sql sql/test/json/Tests/aggregate01.sql Branch: default Log Message: handle special case for aggregate if BATdense and rename functions so that mitosis magic works for these functions diffs (154 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1761,12 +1761,6 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, } } } - if (g && BATtdense(g)) { - /* singleton groups: return group ID's (g's tail) and original -* values from b */ - bn = VIEWcreate(BATmirror(g), b); - goto out; - } maxlen = BUFSIZ; if ((buf = GDKmalloc(maxlen)) == NULL) { @@ -1798,6 +1792,59 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, } else { map = (const oid *) Tloc(t2, BUNfirst(t2)); } + if (g && BATtdense(g)) { + for (p = 0, q = BATcount(g); p < q; p++) { + switch(b->ttype) { + case TYPE_str: + v = (const char *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); + break; + case TYPE_dbl: + val = (const double *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); + if (*val != dbl_nil) { + snprintf(temp, sizeof(temp), "%f", *val); + v = (const char *)temp; + } else { + v = NULL; + } + break; + } + if (!v||strNil(v)) { + if (skip_nils) + continue; + strncpy(buf, str_nil, buflen); + isnil = 1; + } else { + len = strlen(v); + if (len >= maxlen - buflen) { + maxlen += len + BUFSIZ; + buf = GDKrealloc(buf, maxlen); + if (buf == NULL) { + err = MAL_MALLOC_FAIL; + goto bunins_failed; + } + } + switch (b->ttype) { + case TYPE_str: + len = snprintf(buf + buflen, maxlen - buflen, "[ \"%s\" ]", v); + buflen += len; + break; + case TYPE_dbl: + len = snprintf(buf + buflen, maxlen - buflen, "[ %s ]", v); + buflen += len; + break; + } + } + bunfastapp_nocheck(bn, BUNlast(bn), buf, Tsize(bn)); + buflen = 0; + } + BATseqbase(bn, min); + bn->T->nil = nils != 0; + bn->T->nonil = nils == 0; + bn->T->sorted = BATcount(bn) <= 1; + bn->T->revsorted = BATcount(bn) <= 1; + bn->T->key = BATcount(bn) <= 1; + goto out; + } grps = (const oid *) Tloc(g, BUNfirst(g)); prev = grps[0]; isnil = 0; diff --git a/monetdb5/modules/atoms/json.mal b/monetdb5/modules/atoms/json.mal --- a/monetdb5/modules/atoms/json.mal +++ b/monetdb5/modules/atoms/json.mal @@ -168,27 +168,27 @@ pattern calc.isnil(v:json):bit address CMDvarISNIL comment "Nil test for json value"; -command json.aggr(val:bat[:oid,:str]):str +command aggr.jsonaggr(val:bat[:oid,:str]):str address JSONgroupStr comment "Aggregate the string values to array."; -command json.aggr(val:bat[:oid,:dbl]):str +command aggr.jsonaggr(val:bat[:oid,:dbl]):str address JSONgroupStr comment "Aggregate the double values to array."; -command json.subaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1], skip_nils:bit) :bat[:oid,:str] +command aggr.subjsonaggr(val:bat[:oid,:str],g:bat[:oid,:oid],e:bat[:oid,:any_1], skip_nils:bit) :bat[:oid,:str] address JSONsubjson comment "Grouped aggregation of values."; -command json.subaggr(val:bat[:oid,:dbl],g:bat[:oid,:oid],e:
MonetDB: default - add null handling for double columns and add ...
Changeset: c70d5a791521 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c70d5a791521 Modified Files: monetdb5/modules/atoms/json.c sql/test/json/Tests/aggregate00.sql sql/test/json/Tests/aggregate00.stable.out sql/test/json/Tests/aggregate01.sql sql/test/json/Tests/aggregate01.stable.out Branch: default Log Message: add null handling for double columns and add tests diffs (217 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1825,12 +1825,16 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, v = (const char *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); break; case TYPE_dbl: - val = (const double *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); - snprintf(temp, sizeof(temp), "%f", *val); - v = (const char *)temp; + val = (const double *) BUNtail(bi, BUNfirst(b) + (map ? (BUN) map[p] : p + mapoff)); + if (*val != dbl_nil) { + snprintf(temp, sizeof(temp), "%f", *val); + v = (const char *)temp; + } else { + v = NULL; + } break; } - if (strNil(v)) { + if (!v||strNil(v)) { if (skip_nils) continue; strncpy(buf, str_nil, buflen); diff --git a/sql/test/json/Tests/aggregate00.sql b/sql/test/json/Tests/aggregate00.sql --- a/sql/test/json/Tests/aggregate00.sql +++ b/sql/test/json/Tests/aggregate00.sql @@ -1,21 +1,37 @@ -create table aggrtest ( col1 varchar(10), col2 integer ); +create table aggrtest00 ( col1 varchar(10), col2 integer ); -select json.tojsonarray(col1) from aggrtest; +select json.tojsonarray(col1) from aggrtest00; -insert into aggrtest values ('hallo', 1); +insert into aggrtest00 values ('hallo', 1); -select json.tojsonarray(col1) from aggrtest; +select json.tojsonarray(col1) from aggrtest00; -insert into aggrtest values ('world', 1); +insert into aggrtest00 values ('world', 1); -select json.tojsonarray(col1) from aggrtest; +select json.tojsonarray(col1) from aggrtest00; -select json.tojsonarray(col1) from aggrtest group by col2; +select json.tojsonarray(col1) from aggrtest00 group by col2; -insert into aggrtest values ('foobar', 2); +insert into aggrtest00 values ('foobar', 2); -select json.tojsonarray(col1) from aggrtest; +select json.tojsonarray(col1) from aggrtest00; -select json.tojsonarray(col1) from aggrtest group by col2; +select json.tojsonarray(col1) from aggrtest00 group by col2; -drop table aggrtest; +delete from aggrtest00; + +insert into aggrtest00 values (NULL, 1); + +select json.tojsonarray(col1) from aggrtest00; + +insert into aggrtest00 values ('hello', 1); + +select json.tojsonarray(col1) from aggrtest00; + +insert into aggrtest00 values ('world', 2); + +select json.tojsonarray(col1) from aggrtest00; + +select json.tojsonarray(col1) from aggrtest00 group by col2; + +drop table aggrtest00; diff --git a/sql/test/json/Tests/aggregate00.stable.out b/sql/test/json/Tests/aggregate00.stable.out --- a/sql/test/json/Tests/aggregate00.stable.out +++ b/sql/test/json/Tests/aggregate00.stable.out @@ -94,6 +94,40 @@ Ready. % 20 # length [ "[ \"hallo\", \"world\" ]" ] [ "[ \"foobar\" ]" ] +#delete from aggrtest00; +[ 3] +#insert into aggrtest00 values (NULL, 1); +[ 1] +#select json.tojsonarray(col1) from aggrtest00; +% sys.L1 # table_name +% L1 # name +% clob # type +% 0 # length +[ NULL ] +#insert into aggrtest00 values ('hello', 1); +[ 1] +#select json.tojsonarray(col1) from aggrtest00; +% sys.L1 # table_name +% L1 # name +% clob # type +% 11 # length +[ "[ \"hello\" ]" ] +#insert into aggrtest00 values ('world', 2); +[ 1] +#select json.tojsonarray(col1) from aggrtest00; +% sys.L1 # table_name +% L1 # name +% clob # type +% 20 # length +[ "[ \"hello\", \"world\" ]" ] +#select json.tojsonarray(col1) from aggrtest00 group by col2; +% sys.L1 # table_name +% L1 # name +% clob # type +% 11 # length +[ "[ \"hello\" ]" ] +[ "[ \"world\" ]" ] +#drop table aggrtest00; # 15:08:41 > # 15:08:41 > "Done." diff --git a/sql/test/json/Tests/aggregate01.sql b/sql/test/json/Tests/aggregate01.sql --- a/sql/test/json/Tests/aggregate01.sql +++ b/sql/test/json/Tests/aggregate01.sql @@ -1,21 +1,37 @@ -create table aggrtest1 ( col1 double, col2 integer ); +create table aggrtest01 ( col1 double, col2 integer ); -select json.tojsonarray(col
MonetDB: default - add json aggregate for double columns
Changeset: facde0cda494 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=facde0cda494 Added Files: sql/test/json/Tests/aggregate01.sql sql/test/json/Tests/aggregate01.stable.err sql/test/json/Tests/aggregate01.stable.out Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/json.mal sql/scripts/40_json.sql sql/test/json/Tests/All sql/test/json/Tests/aggregate00.sql Branch: default Log Message: add json aggregate for double columns diffs (truncated from 401 to 300 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1603,11 +1603,13 @@ JSONgroupStr(str *ret, const bat *bid) { BAT *b; BUN p, q; - const char *t; + const char *t = NULL; size_t len, size = BUFSIZ, offset; str buf = GDKmalloc(size); BATiter bi; const char *err = NULL; + char temp[128] = ""; + const double * val = NULL; if (buf == NULL) throw(MAL, "json.group",MAL_MALLOC_FAIL); @@ -1620,9 +1622,20 @@ JSONgroupStr(str *ret, const bat *bid) offset = 0; bi = bat_iterator(b); BATloop(b, p, q) { - int n; + int n = 0; - t = (const char *) BUNtail(bi, p); + switch (b->ttype) { + case TYPE_str: + t = (const char *) BUNtail(bi, p); + break; + case TYPE_dbl: + val = (const double *) BUNtail(bi, p); + snprintf(temp, sizeof(temp), "%f", *val); + t = (const char *)temp; + break; + } + + //t = (const char *) BUNtail(bi, p); if (strNil(t)) continue; @@ -1635,18 +1648,37 @@ JSONgroupStr(str *ret, const bat *bid) goto failed; } } - if (offset == 0) { - if (BATcount(b) == 1) { - n = snprintf(buf, size, "[ \"%s\" ]", t); + switch (b->ttype) { + case TYPE_str: + if (offset == 0) { + if (BATcount(b) == 1) { + n = snprintf(buf, size, "[ \"%s\" ]", t); + } else { + n = snprintf(buf, size, "[ \"%s\"", t); + } } else { - n = snprintf(buf, size, "[ \"%s\"", t); + if (p == BUNlast(b) - 1) { + n = snprintf(buf + offset, size - offset, ", \"%s\" ]", t); + } else { + n = snprintf(buf + offset, size - offset, ", \"%s\"", t); + } } - } else { - if (p == BUNlast(b) - 1) { - n = snprintf(buf + offset, size - offset, ", \"%s\" ]", t); - } else { - n = snprintf(buf + offset, size - offset, ", \"%s\"", t); + break; + case TYPE_dbl: + if (offset == 0) { + if (BATcount(b) == 1) { + n = snprintf(buf, size, "[ %s ]", t); + } else { + n = snprintf(buf, size, "[ %s", t); + } + } else { + if (p == BUNlast(b) - 1) { + n = snprintf(buf + offset, size - offset, ", %s ]", t); + } else { + n = snprintf(buf + offset, size - offset, ", %s", t); + } } + break; } offset += n; } @@ -1670,7 +1702,7 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, BUN nils = 0; int isnil; const oid *cand = NULL, *candend = NULL; - const char *v; + const char *v = NULL; const oid *grps, *map; oid mapoff = 0; oid prev; @@ -1679,12 +1711,14 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, char *buf = NULL; size_t buflen, maxlen, len; const char *err; + char temp[128] = ""; + const double * val = NULL; if ((err = BATgroupaggrinit(b, g, e, s, &min, &max, &ngrp, &start, &end, &cnt, &cand, &candend)) != NULL) { return err; } - assert(b->ttype == TYPE_str); +
MonetDB: default - functions for aggregating column as json array
Changeset: a7d5d1ff828f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a7d5d1ff828f Added Files: sql/test/json/Tests/aggregate00.sql sql/test/json/Tests/aggregate00.stable.err sql/test/json/Tests/aggregate00.stable.out Modified Files: monetdb5/modules/atoms/json.c monetdb5/modules/atoms/json.h monetdb5/modules/atoms/json.mal sql/scripts/40_json.sql sql/test/json/Tests/All Branch: default Log Message: functions for aggregating column as json array diffs (truncated from 552 to 300 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1598,3 +1598,329 @@ JSONtextGrouped(int *ret, int *bid, int throw(MAL,"json.text","tobeimplemented"); } +str +JSONgroupStr(str *ret, const bat *bid) +{ + BAT *b; + BUN p, q; + const char *t; + size_t len, size = BUFSIZ, offset; + str buf = GDKmalloc(size); + BATiter bi; + const char *err = NULL; + + if (buf == NULL) + throw(MAL, "json.group",MAL_MALLOC_FAIL); + if ((b = BATdescriptor(*bid)) == NULL) { + GDKfree(buf); + throw(MAL, "json.agg", RUNTIME_OBJECT_MISSING); + } + + strcpy(buf, str_nil); + offset = 0; + bi = bat_iterator(b); + BATloop(b, p, q) { + int n; + + t = (const char *) BUNtail(bi, p); + + if (strNil(t)) + continue; + len = strlen(t) + 1; + if (len >= size - offset) { + size += len + 128; + buf = GDKrealloc(buf, size); + if (buf == NULL) { + err= MAL_MALLOC_FAIL; + goto failed; + } + } + if (offset == 0) { + if (BATcount(b) == 1) { + n = snprintf(buf, size, "[ \"%s\" ]", t); + } else { + n = snprintf(buf, size, "[ \"%s\"", t); + } + } else { + if (p == BUNlast(b) - 1) { + n = snprintf(buf + offset, size - offset, ", \"%s\" ]", t); + } else { + n = snprintf(buf + offset, size - offset, ", \"%s\"", t); + } + } + offset += n; + } + BBPreleaseref(b->batCacheid); + *ret = buf; + return MAL_SUCCEED; + failed: + BBPreleaseref(b->batCacheid); + if (buf != NULL) + GDKfree(buf); + throw(MAL, "json.agg", "%s", err); +} + +static const char * +JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, BAT *e, BAT *s, int skip_nils) +{ + BAT *bn = NULL, *t1, *t2 = NULL; + BATiter bi; + oid min, max; + BUN ngrp, start, end, cnt; + BUN nils = 0; + int isnil; + const oid *cand = NULL, *candend = NULL; + const char *v; + const oid *grps, *map; + oid mapoff = 0; + oid prev; + BUN p, q; + int freeb = 0, freeg = 0; + char *buf = NULL; + size_t buflen, maxlen, len; + const char *err; + + if ((err = BATgroupaggrinit(b, g, e, s, &min, &max, &ngrp, &start, &end, + &cnt, &cand, &candend)) != NULL) { + return err; + } + assert(b->ttype == TYPE_str); + if (BATcount(b) == 0 || ngrp == 0) { + bn = BATconstant(TYPE_str, ATOMnilptr(TYPE_str), ngrp); + if (bn == NULL) + return MAL_MALLOC_FAIL; + BATseqbase(bn, ngrp == 0 ? 0 : min); + *bnp = bn; + return NULL; + } + if (s) { + b = BATleftjoin(s, b, BATcount(s)); + if (b == NULL) { + err = "internal leftjoin failed"; + goto out; + } + freeb = 1; + if (b->htype != TYPE_void) { + t1 = BATmirror(BATmark(BATmirror(b), 0)); + if (t1 == NULL) { + err = "internal mark failed"; + goto out; + } + BBPunfix(b->batCacheid); + b = t1; + } + if (g) { + g = BATleftjoin(s, g, BATcount(s)); + if (g == NULL) { + err = "internal leftjoin failed"; + goto out; + } + freeg = 1; + if (g->htype != TYPE_void) { + t1 = BATmirror(BATmark(BATmirror(g), 0)); +
MonetDB: default - Improve rendering of sql resultset in json fo...
Changeset: d61df17a37de for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d61df17a37de Modified Files: sql/backends/monet5/sql_result.c Branch: default Log Message: Improve rendering of sql resultset in json format diffs (59 lines): diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c --- a/sql/backends/monet5/sql_result.c +++ b/sql/backends/monet5/sql_result.c @@ -1154,24 +1154,29 @@ mvc_export_table(backend *b, stream *s, } if (json) { res_col *p = t->cols + (i - 1); + ssep = ""; - /* TODO name: -* if i == 1 -> { name : -* if i > 1 -> , name : + /* +* We define the "proper" way of returning +* a relational table in json format as a +* json array of objects, where each row is +* represented as a json object. */ if (i == 1) { - bj = SA_NEW_ARRAY(m->sa, char, strlen(p->name) + 6); - snprintf(bj, strlen(p->name) + 6, "{ %s , ", p->name); + bj = SA_NEW_ARRAY(m->sa, char, strlen(p->name) + 11); + snprintf(bj, strlen(p->name) + 11, "\t{\n\t\t\"%s\" : ", p->name); fmt[i - 1].sep = bj; fmt[i - 1].seplen = _strlen(fmt[i - 1].sep); fmt[i - 1].rsep = NULL; } else if (i <= t->nr_cols) { - fmt[i - 1].sep = p->name; + bj = SA_NEW_ARRAY(m->sa, char, strlen(p->name) + 10); + snprintf(bj, strlen(p->name) + 10, ",\n\t\t\"%s\" : ", p->name); + fmt[i - 1].sep = bj; fmt[i - 1].seplen = _strlen(fmt[i - 1].sep); fmt[i - 1].rsep = NULL; } if (i == t->nr_cols) { - fmt[i].sep = " }\n"; + fmt[i].sep = "\n\t}\n"; fmt[i].seplen = _strlen(fmt[i].sep); fmt[i].rsep = NULL; } @@ -1594,6 +1599,7 @@ mvc_export_result(backend *b, stream *s, BUN count; res_table *t = res_tables_find(m->results, res_id); BAT *order = NULL; + int json = (b->output_format == OFMT_JSON); if (!s || !t) return 0; @@ -1603,7 +1609,9 @@ mvc_export_result(backend *b, stream *s, if (t->tsep) return mvc_export_file(b, s, t); - mvc_export_head(b, s, res_id, TRUE); + if (!json) { + mvc_export_head(b, s, res_id, TRUE); + } if (!t->order) return mvc_export_row(b, s, t, "[ ", ",\t", "\t]\n", "\"", "NULL"); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - add test for bug 3406
Changeset: c56b27a02e4e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c56b27a02e4e Added Files: sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.sql sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.err sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.out Modified Files: sql/test/BugTracker-2013/Tests/All Branch: default Log Message: add test for bug 3406 diffs (133 lines): diff --git a/sql/test/BugTracker-2013/Tests/All b/sql/test/BugTracker-2013/Tests/All --- a/sql/test/BugTracker-2013/Tests/All +++ b/sql/test/BugTracker-2013/Tests/All @@ -63,3 +63,4 @@ syntaxerror.Bug-3399 timestamp.Bug-3401 not_null.Bug-3403 nested_concat_query.Bug-3408 +json_is_null.Bug-3406 \ No newline at end of file diff --git a/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.sql b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.sql @@ -0,0 +1,5 @@ +create table testjsonisnull(js json); + +select * from testjsonisnull where js is null; + +drop table testjsonisnull; diff --git a/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.err b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.err @@ -0,0 +1,35 @@ +stderr of test 'json_is_null.Bug-3406` in directory 'sql/test/BugTracker-2013` itself: + + +# 13:09:26 > +# 13:09:26 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36037" "--set" "mapi_usock=/var/tmp/mtest-26873/.s.monetdb.36037" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 13:09:26 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 36037 +# cmdline opt mapi_usock = /var/tmp/mtest-26873/.s.monetdb.36037 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013 +# cmdline opt mal_listing = 0 + +# 13:09:26 > +# 13:09:26 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-26873" "--port=36037" +# 13:09:26 > + + +# 13:12:45 > +# 13:12:45 > "Done." +# 13:12:45 > + diff --git a/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.out b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/json_is_null.Bug-3406.stable.out @@ -0,0 +1,69 @@ +stdout of test 'json_is_null.Bug-3406` in directory 'sql/test/BugTracker-2013` itself: + + +# 13:09:26 > +# 13:09:26 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36037" "--set" "mapi_usock=/var/tmp/mtest-26873/.s.monetdb.36037" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 13:09:26 > + +# MonetDB 5 server v11.18.0 +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2013', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.592 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +#WARNING: MALException:malInclude:could not open file: batgsl +# Listening for connection requests on mapi:monetdb://rotterdam.ins.cwi.nl:36037/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-26873/.s.monetdb.36037 +# MonetDB/GIS module loaded +# MonetDB/JAQL module loaded +# MonetDB/SQL module loaded + +Ready. +# SQL catalog created, loading sql scripts once +# loading sql script: 09_like.sql +# loading sql script: 10_math.sql +# loading sql script: 11_times.sql +# loading sql script: 12_url.sql +# loading sql script: 13_date.sql +# loading sql script: 14_inet.sql +# loading sql script: 15_querylog.sql +# loading sql script: 16_tracelog.sql +# loading sql script: 17_compress.sql +# loading sql script: 18_dictionary.sql +# loading sql script: 19_cluster.sql +# loading sql script: 20_vacuum.sql +# loading sql script: 21_dependency_functions.sql +# loading sql script: 22_clients.sql
MonetDB: default - add test for bug 3408
Changeset: 067195f12153 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=067195f12153 Added Files: sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.sql sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.err sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.out Modified Files: sql/test/BugTracker-2013/Tests/All Branch: default Log Message: add test for bug 3408 diffs (174 lines): diff --git a/sql/test/BugTracker-2013/Tests/All b/sql/test/BugTracker-2013/Tests/All --- a/sql/test/BugTracker-2013/Tests/All +++ b/sql/test/BugTracker-2013/Tests/All @@ -62,3 +62,4 @@ udf_error.Bug-3396 syntaxerror.Bug-3399 timestamp.Bug-3401 not_null.Bug-3403 +nested_concat_query.Bug-3408 diff --git a/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.sql b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.sql @@ -0,0 +1,27 @@ +declare datem integer; +declare dateh integer; +declare dated integer; +declare stamp varchar(32); + +/* +set datem = right(concat('00',cast(EXTRACT(MINUTE FROM localtimestamp()) as varchar(2))), 2); +set dateh = right(concat('00',cast(EXTRACT(HOUR FROM localtimestamp()) as varchar(2))), 2); +set dated = right(concat('00',cast(EXTRACT(DAY FROM localtimestamp()) as varchar(2))), 2); +*/ + +set datem = '12'; +set dateh = '11'; +set dated = '10'; + +set stamp = concat(concat(concat(concat(concat('2013-11-', dated), ' '), dateh), ':'), datem), ':30.00'); + +select stamp; + +set stamp = concat('2013-11-', dated); +set stamp = concat(stamp, ' '); +set stamp = concat(stamp, dateh); +set stamp = concat(stamp, ':'); +set stamp = concat(stamp, datem); +set stamp = concat(stamp, ':01.00'); + +select stamp; diff --git a/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.err b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.err @@ -0,0 +1,36 @@ +stderr of test 'nested_concat_query.Bug-3408` in directory 'sql/test/BugTracker-2013` itself: + + +# 12:42:48 > +# 12:42:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34396" "--set" "mapi_usock=/var/tmp/mtest-25374/.s.monetdb.34396" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 12:42:48 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 34396 +# cmdline opt mapi_usock = /var/tmp/mtest-25374/.s.monetdb.34396 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013 +# cmdline opt mal_listing = 0 + +# 12:42:48 > +# 12:42:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-25374" "--port=34396" +# 12:42:48 > + + + +# 12:42:48 > +# 12:42:48 > "Done." +# 12:42:48 > + diff --git a/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.out b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/nested_concat_query.Bug-3408.stable.out @@ -0,0 +1,88 @@ +stdout of test 'nested_concat_query.Bug-3408` in directory 'sql/test/BugTracker-2013` itself: + + +# 12:42:48 > +# 12:42:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34396" "--set" "mapi_usock=/var/tmp/mtest-25374/.s.monetdb.34396" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 12:42:48 > + +# MonetDB 5 server v11.18.0 +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2013', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.592 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +#WARNING: MALException:malInclude:could not open file: batgsl +# Listening for connection requests on mapi:monetdb://rotterdam.ins.cwi.nl:34396/ +# Listenin
MonetDB: default - apply patch from niels to gsl bat -> bat func...
Changeset: 0d1343df9283 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d1343df9283 Modified Files: sql/backends/monet5/gsl/Tests/gsl01.stable.err sql/backends/monet5/gsl/Tests/gsl01.stable.out sql/backends/monet5/gsl/gsl.c Branch: default Log Message: apply patch from niels to gsl bat -> bat function diffs (184 lines): diff --git a/sql/backends/monet5/gsl/Tests/gsl01.stable.err b/sql/backends/monet5/gsl/Tests/gsl01.stable.err --- a/sql/backends/monet5/gsl/Tests/gsl01.stable.err +++ b/sql/backends/monet5/gsl/Tests/gsl01.stable.err @@ -28,42 +28,33 @@ stderr of test 'gsl01` in directory 'sql # 15:57:56 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-16688" "--port=34082" # 15:57:56 > -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT gsl.chi2prob(20.0, NULL); ERROR = !Wrong value for datapoints -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT gsl.chi2prob(NULL, 5.0); ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT gsl.chi2prob(-1, 5.0); ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 -QUERY = SELECT gsl.chi2prob(20.0, 1.0); -ERROR = !Wrong value for datapoints -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(a, b) FROM chi2; ERROR = !Wrong value for datapoints -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(19.0, b) FROM chi2; ERROR = !Wrong value for datapoints -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(a, b) FROM chi2; ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(a, 6.0) FROM chi2; ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(a, b) FROM chi2; ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +MAPI = (monetdb) /var/tmp/mtest-28608/.s.monetdb.36472 QUERY = SELECT chi2prob(a, 6.0) FROM chi2; ERROR = !Wrong value for chi2 -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 -QUERY = SELECT chi2prob(a, b) FROM chi2; -ERROR = !Wrong value for datapoints -MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 -QUERY = SELECT chi2prob(19.0, b) FROM chi2; -ERROR = !Wrong value for datapoints # 15:57:57 > # 15:57:57 > "Done." diff --git a/sql/backends/monet5/gsl/Tests/gsl01.stable.out b/sql/backends/monet5/gsl/Tests/gsl01.stable.out --- a/sql/backends/monet5/gsl/Tests/gsl01.stable.out +++ b/sql/backends/monet5/gsl/Tests/gsl01.stable.out @@ -60,6 +60,12 @@ Ready. % double # type % 24 # length [ 0.001249730563 ] +#SELECT gsl.chi2prob(20.0, 1.0); +% .L # table_name +% chi2prob_single_value # name +% double # type +% 24 # length +[ 7.744216431e-06 ] #CREATE TABLE chi2(a double, b double); #INSERT INTO chi2 VALUES (20.0, 5.0), # (22.0, 4.0), @@ -141,6 +147,15 @@ Ready. # (20.0, 6.0), #(20.0, 1.0); [ 4] +#SELECT chi2prob(a, b) FROM chi2; +% sys.L # table_name +% chi2prob_a # name +% double # type +% 24 # length +[ 0.001249730563 ] +[ 0.0002004204095 ] +[ 0.002769395716 ] +[ 7.744216431e-06 ] #SELECT chi2prob(a, 6.0) FROM chi2; % sys.L # table_name % chi2prob_a # name @@ -150,6 +165,15 @@ Ready. [ 0.001210873307 ] [ 0.002769395716 ] [ 0.002769395716 ] +#SELECT chi2prob(19.0, b) FROM chi2; +% .L # table_name +% chi2prob_single_value # name +% double # type +% 24 # length +[ 0.001922136821 ] +[ 0.0007859442138 ] +[ 0.004163633038 ] +[ 1.307184537e-05 ] # 15:55:27 > # 15:55:27 > "Done." diff --git a/sql/backends/monet5/gsl/gsl.c b/sql/backends/monet5/gsl/gsl.c --- a/sql/backends/monet5/gsl/gsl.c +++ b/sql/backends/monet5/gsl/gsl.c @@ -53,7 +53,7 @@ gsl_chisqprob(double * retval, double ch *retval = dbl_nil; if ((chi2 == dbl_nil) || (chi2 < 0)) throw(MAL, "gsl.chi2prob", "Wrong value for chi2"); - if ((datapoints == dbl_nil) || (datapoints <= 1)) + if ((datapoints == dbl_nil) || (datapoints < 0)) throw(MAL, "gsl.chi2prob", "Wrong value for datapoints"); *retval = gsl_cdf_chisq_Q(chi2, datapoints); return MAL_SUCCEED; @@ -71,7 +71,7 @@ gsl_bat_chisqprob_cst(bat * retval, bat if (datapoints == dbl_nil) {
MonetDB: default - add test for bug 3394
Changeset: 9ee5aecf7b01 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9ee5aecf7b01 Added Files: sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.sql sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.err sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.out Modified Files: sql/test/BugTracker-2013/Tests/All Branch: default Log Message: add test for bug 3394 diffs (224 lines): diff --git a/sql/test/BugTracker-2013/Tests/All b/sql/test/BugTracker-2013/Tests/All --- a/sql/test/BugTracker-2013/Tests/All +++ b/sql/test/BugTracker-2013/Tests/All @@ -55,3 +55,4 @@ python-explain.Bug-3380 case-orderby.Bug-3388 unop_vs_aggr.Bug-3885 singleton-median.Bug-3389 +Cannot_Find_Column_Type.Bug-3394 diff --git a/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.sql b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.sql @@ -0,0 +1,47 @@ +create function tmp1 () +returns boolean +begin +create temporary table table1 ( + field1 integer +); + +return true; +end; + +select tmp1(); + +create function tmp2 () +returns boolean +begin +create temporary table table2 ( + field1 json +); + +return true; +end; + +select tmp2(); + +create function tmp3 () +returns boolean +begin +create temporary table table3 ( + field1 float +); + +return true; +end; + +select tmp3(); + +create function tmp4 () +returns boolean +begin +create temporary table table4 ( + field1 uuid +); + +return true; +end; + +select tmp4(); diff --git a/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.err b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.err @@ -0,0 +1,34 @@ +stderr of test 'Cannot_Find_Column_Type.Bug-3394` in directory 'sql/test/BugTracker-2013` itself: + + +# 16:07:34 > +# 16:07:34 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39840" "--set" "mapi_usock=/var/tmp/mtest-31374/.s.monetdb.39840" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 16:07:34 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 39840 +# cmdline opt mapi_usock = /var/tmp/mtest-31374/.s.monetdb.39840 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013 +# cmdline opt mal_listing = 0 + +# 16:07:35 > +# 16:07:35 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-31374" "--port=39840" +# 16:07:35 > + +# 16:07:35 > +# 16:07:35 > "Done." +# 16:07:35 > + diff --git a/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.out b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/Cannot_Find_Column_Type.Bug-3394.stable.out @@ -0,0 +1,120 @@ +stdout of test 'Cannot_Find_Column_Type.Bug-3394` in directory 'sql/test/BugTracker-2013` itself: + + +# 16:07:34 > +# 16:07:34 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39840" "--set" "mapi_usock=/var/tmp/mtest-31374/.s.monetdb.39840" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 16:07:34 > + +# MonetDB 5 server v11.16.0 +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2013', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.592 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +#WARNING: MALException:malInclude:could not open file: batgsl +# Listening for connection requests on mapi:monetdb://rotterdam.ins.cwi.nl:39840/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-31374/.s.monetdb.39840 +# Mon
MonetDB: default - add bat aware versions of gsl statistical fun...
Changeset: e58a61ddb5c2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e58a61ddb5c2 Modified Files: sql/backends/monet5/gsl/73_gsl.mal sql/backends/monet5/gsl/Tests/gsl01.sql sql/backends/monet5/gsl/Tests/gsl01.stable.err sql/backends/monet5/gsl/Tests/gsl01.stable.out sql/backends/monet5/gsl/gsl.c sql/backends/monet5/gsl/gsl.mal Branch: default Log Message: add bat aware versions of gsl statistical function diffs (truncated from 426 to 300 lines): diff --git a/sql/backends/monet5/gsl/73_gsl.mal b/sql/backends/monet5/gsl/73_gsl.mal --- a/sql/backends/monet5/gsl/73_gsl.mal +++ b/sql/backends/monet5/gsl/73_gsl.mal @@ -16,3 +16,4 @@ # All Rights Reserved. include gsl; +include batgsl; diff --git a/sql/backends/monet5/gsl/Tests/gsl01.sql b/sql/backends/monet5/gsl/Tests/gsl01.sql --- a/sql/backends/monet5/gsl/Tests/gsl01.sql +++ b/sql/backends/monet5/gsl/Tests/gsl01.sql @@ -1,1 +1,68 @@ -SELECT gsl.chi2prob(20.0,5.0); +SELECT gsl.chi2prob(20.0, 5.0); + +SELECT gsl.chi2prob(20.0, NULL); + +SELECT gsl.chi2prob(NULL, 5.0); + +SELECT gsl.chi2prob(-1, 5.0); + +SELECT gsl.chi2prob(20.0, 1.0); + +CREATE TABLE chi2(a double, b double); + +INSERT INTO chi2 VALUES (20.0, 5.0), + (22.0, 4.0), + (20.0, 6.0); + +SELECT chi2prob(a, b) FROM chi2; + +SELECT chi2prob(a, 6.0) FROM chi2; + +SELECT chi2prob(19.0, b) FROM chi2; + +INSERT INTO chi2 VALUES (20.0, NULL); + +SELECT chi2prob(a, b) FROM chi2; + +SELECT chi2prob(a, 6.0) FROM chi2; + +SELECT chi2prob(19.0, b) FROM chi2; + +DELETE FROM chi2; + +INSERT INTO chi2 VALUES (20.0, 5.0), + (22.0, 4.0), + (20.0, 6.0), +(NULL, 5.0); + +SELECT chi2prob(a, b) FROM chi2; + +SELECT chi2prob(a, 6.0) FROM chi2; + +SELECT chi2prob(19.0, b) FROM chi2; + +DELETE FROM chi2; + +INSERT INTO chi2 VALUES (20.0, 5.0), + (22.0, 4.0), + (20.0, 6.0), +(-1, 5.0); + +SELECT chi2prob(a, b) FROM chi2; + +SELECT chi2prob(a, 6.0) FROM chi2; + +SELECT chi2prob(19.0, b) FROM chi2; + +DELETE FROM chi2; + +INSERT INTO chi2 VALUES (20.0, 5.0), + (22.0, 4.0), + (20.0, 6.0), +(20.0, 1.0); + +SELECT chi2prob(a, b) FROM chi2; + +SELECT chi2prob(a, 6.0) FROM chi2; + +SELECT chi2prob(19.0, b) FROM chi2; diff --git a/sql/backends/monet5/gsl/Tests/gsl01.stable.err b/sql/backends/monet5/gsl/Tests/gsl01.stable.err --- a/sql/backends/monet5/gsl/Tests/gsl01.stable.err +++ b/sql/backends/monet5/gsl/Tests/gsl01.stable.err @@ -24,12 +24,48 @@ stderr of test 'gsl01` in directory 'sql # cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl # cmdline opt mal_listing = 0 -# 15:55:27 > -# 15:55:27 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-19131" "--port=36073" -# 15:55:27 > +# 15:57:56 > +# 15:57:56 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-16688" "--port=34082" +# 15:57:56 > +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT gsl.chi2prob(20.0, NULL); +ERROR = !Wrong value for datapoints +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT gsl.chi2prob(NULL, 5.0); +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT gsl.chi2prob(-1, 5.0); +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT gsl.chi2prob(20.0, 1.0); +ERROR = !Wrong value for datapoints +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, b) FROM chi2; +ERROR = !Wrong value for datapoints +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(19.0, b) FROM chi2; +ERROR = !Wrong value for datapoints +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, b) FROM chi2; +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, 6.0) FROM chi2; +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, b) FROM chi2; +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, 6.0) FROM chi2; +ERROR = !Wrong value for chi2 +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(a, b) FROM chi2; +ERROR = !Wrong value for datapoints +MAPI = (monetdb) /var/tmp/mtest-16688/.s.monetdb.34082 +QUERY = SELECT chi2prob(19.0, b) FROM chi2; +ERROR = !Wrong value for datapoints -# 15:55:27 > -# 15:55:27 > "Done." -# 15:55:27 > +# 15:57:57 > +# 15:57:57 > "Done." +# 15:57:57 > diff --git a/sql/backends/monet5/gsl/Tests/gsl01.stable.out b/sql/backends/monet5/gsl/Te
MonetDB: default - add missing calc.json function
Changeset: 560a3e6dd0de for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=560a3e6dd0de Modified Files: monetdb5/modules/atoms/json_atom.c monetdb5/modules/atoms/json_atom.mal Branch: default Log Message: add missing calc.json function diffs (26 lines): diff --git a/monetdb5/modules/atoms/json_atom.c b/monetdb5/modules/atoms/json_atom.c --- a/monetdb5/modules/atoms/json_atom.c +++ b/monetdb5/modules/atoms/json_atom.c @@ -117,7 +117,7 @@ JSONjson2str(str *ret, json *j) } str -JSONstr2json(str *ret, json *j) +JSONstr2json(json *ret, str *j) { str msg = JSONparse(*j); diff --git a/monetdb5/modules/atoms/json_atom.mal b/monetdb5/modules/atoms/json_atom.mal --- a/monetdb5/modules/atoms/json_atom.mal +++ b/monetdb5/modules/atoms/json_atom.mal @@ -33,6 +33,10 @@ command calc.json(j:str):json address JSONstr2json comment "Convert string to its JSON. Dealing with escape characters"; +command calc.json(j:json):json +address JSONstr2json +comment "Convert JSON to JSON. Dealing with escape characters"; + command str(j:json):str address JSONjson2str comment "Convert JSON to its string equivalent. Dealing with escape characters"; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - add wrapper for gsl function for Bart
Changeset: 0fb74d107207 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0fb74d107207 Added Files: sql/backends/monet5/gsl/46_gsl.sql sql/backends/monet5/gsl/73_gsl.mal sql/backends/monet5/gsl/Makefile.ag sql/backends/monet5/gsl/Tests/All sql/backends/monet5/gsl/Tests/gsl00.mal sql/backends/monet5/gsl/Tests/gsl00.stable.err sql/backends/monet5/gsl/Tests/gsl00.stable.out sql/backends/monet5/gsl/Tests/gsl01.sql sql/backends/monet5/gsl/Tests/gsl01.stable.err sql/backends/monet5/gsl/Tests/gsl01.stable.out sql/backends/monet5/gsl/gsl.c sql/backends/monet5/gsl/gsl.mal Modified Files: configure.ag sql/backends/monet5/Makefile.ag Branch: default Log Message: add wrapper for gsl function for Bart diffs (truncated from 459 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -234,6 +234,13 @@ AC_ARG_ENABLE(jsonstore, enable_jsonstore=$enableval, enable_jsonstore=$dft_jsonstore) +dft_gsl=auto +AC_ARG_ENABLE(gsl, + AS_HELP_STRING([--enable-gsl], + [enable support for GSL (default=no)]), + enable_gsl=$enableval, + enable_gsl=$dft_gsl) + dft_odbc=auto AC_ARG_ENABLE(odbc, AS_HELP_STRING([--enable-odbc], @@ -2453,6 +2460,18 @@ if test "x$enable_jsonstore" != xno; the esac fi +dnl Check for gsl library for statistical functions +org_have_gsl=no +have_gsl=$org_have_gsl +if test "x$enable_gsl" != xno; then + PKG_CHECK_MODULES([gsl], [gsl], + [have_gsl=yes; AC_DEFINE(HAVE_GSL, 1, [Define if you have the gsl library])], + [have_gsl=no; why_have_gsl="(gsl library not found)" +if test "x$enable_gsl" = xyes; then AC_MSG_ERROR([gsl library required for GSL support]); fi; +enable_gsl=no; disable_gsl="(gsl library not found)"]) +fi +AM_CONDITIONAL(HAVE_GSL, test x"$have_gsl" != xno) + dnl checks for header files AC_HEADER_STDBOOL AC_HEADER_STDC @@ -3266,6 +3285,7 @@ for comp in \ 'jaql ' \ 'jsonstore' \ 'geom ' \ + 'gsl ' \ 'fits ' \ 'rdf ' \ 'datacell ' \ @@ -3293,6 +3313,7 @@ for comp in \ 'curl ' \ 'geos ' \ 'getaddrinfo ' \ + 'gsl ' \ 'hwcounters ' \ 'java ' \ 'java_control ' \ diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag --- a/sql/backends/monet5/Makefile.ag +++ b/sql/backends/monet5/Makefile.ag @@ -15,7 +15,7 @@ # Copyright August 2008-2013 MonetDB B.V. # All Rights Reserved. -SUBDIRS = NOT_WIN32?vaults UDF LSST ENABLE_DATACELL?datacell HAVE_JSONSTORE?rest +SUBDIRS = NOT_WIN32?vaults UDF LSST ENABLE_DATACELL?datacell HAVE_JSONSTORE?rest HAVE_GSL?gsl INCLUDES = ../../include ../../common ../../storage ../../server \ ../../../monetdb5/modules/atoms \ diff --git a/sql/backends/monet5/gsl/46_gsl.sql b/sql/backends/monet5/gsl/46_gsl.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/46_gsl.sql @@ -0,0 +1,22 @@ +-- The contents of this file are subject to the MonetDB Public License +-- Version 1.1 (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the License at +-- http://www.monetdb.org/Legal/MonetDBLicense +-- +-- Software distributed under the License is distributed on an "AS IS" +-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +-- License for the specific language governing rights and limitations +-- under the License. +-- +-- The Original Code is the MonetDB Database System. +-- +-- The Initial Developer of the Original Code is CWI. +-- Copyright August 2008-2013 MonetDB B.V. +-- All Rights Reserved. + +-- (co) Arjen de Rijke, Bart Scheers +-- Use statistical functions from gsl library + +-- Calculate Chi squared probability +create function sys.chi2prob(chi2 double, datapoints double) +returns double external name gsl."chi2prob"; diff --git a/sql/backends/monet5/gsl/73_gsl.mal b/sql/backends/monet5/gsl/73_gsl.mal new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/73_gsl.mal @@ -0,0 +1,18 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the
MonetDB: default - implement attachment with openssl library. ge...
Changeset: 744a03155426 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=744a03155426 Modified Files: sql/backends/monet5/rest/Makefile.ag sql/backends/monet5/rest/rest_jsonstore_handle_get.c Branch: default Log Message: implement attachment with openssl library. getAttachment not finished. diffs (183 lines): diff --git a/sql/backends/monet5/rest/Makefile.ag b/sql/backends/monet5/rest/Makefile.ag --- a/sql/backends/monet5/rest/Makefile.ag +++ b/sql/backends/monet5/rest/Makefile.ag @@ -33,9 +33,7 @@ INCLUDES = .. \ lib__jsonstore = { MODULE - #SEP = _ DIR = libdir/monetdb5 - #COND = HAVE_URIPARSER SOURCES = rest_jsonstore.c rest_jsonstore.h \ rest_jsonstore_handle_get.c rest_jsonstore_handle_get.h LIBS = ../../../../monetdb5/tools/libmonetdb5 \ @@ -44,7 +42,8 @@ lib__jsonstore = { ../../../../sql/storage/libstore \ #../../../../sql/backends/monet5/lib_sql \ ../../../../gdk/libbat \ -$(uriparser_LIBS) +$(uriparser_LIBS) \ +$(openssl_LIBS) } headers_jsonstoremal = { diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -19,6 +19,10 @@ #include "monetdb_config.h" #include +#include +#include +#include +#include #include "mal_mapi.h" #include "mal_client.h" #include "mal_linker.h" @@ -132,9 +136,10 @@ str RESTcreateDB(char ** result, char * "_id uuid, " "mimetype varchar(128)," "filename varchar(128)," - "value blob); "; +"deleted BOOLEAN, " + "value clob); "; - size_t len = 3 * strlen(dbname) + (13 * line) - (3 * place) + char0; + size_t len = 3 * strlen(dbname) + (14 * line) - (3 * place) + char0; querytext = malloc(len); snprintf(querytext, len, query, dbname, dbname, dbname); @@ -392,54 +397,40 @@ str RESTinsertAttach(char ** result, cha size_t len = strlen(dbname) + strlen(doc_id) + strlen(attachment) + (7 * line) - (3 * place) + char0; */ - char *s; - char * attach; - size_t i; + size_t len; + char * attach64; + char * query = + "INSERT INTO jsonblob_%s ( _id, mimetype, filename, deleted, value ) VALUES ( '%s', '', '\"text/plain\"', FALSE, '%s');"; - size_t len; - char * query = - "INSERT INTO jsonblob_%s ( _id, mimetype, filename, value ) VALUES ( '%s', '', '\"text/plain\"','%s');"; - char hexit[] = "0123456789ABCDEF"; + BIO *bio; + BIO *b64; + FILE* stream; + int encodedSize = 4*ceil((double)strlen(attachment)/3); + attach64 = malloc(encodedSize+1); - size_t expectedlen; + stream = fmemopen(attach64, encodedSize+1, "w"); + b64 = BIO_new(BIO_f_base64()); + bio = BIO_new_fp(stream, BIO_NOCLOSE); + bio = BIO_push(b64, bio); + BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); + BIO_write(bio, attachment, strlen(attachment)); + (void)BIO_flush(bio); + BIO_free_all(bio); + fclose(stream); - if (strlen(attachment) == ~(size_t) 0) - expectedlen = 4; - else - expectedlen = (strlen(attachment) * 2); - /*if (*l < 0 || (size_t) * l < expectedlen) { - if (*tostr != NULL) - GDKfree(*tostr); - *tostr = (str) GDKmalloc(expectedlen); - *l = (int) expectedlen; - } - */ - attach = malloc(expectedlen); - s = attach + strlen(attach); - - for (i = 0; i < strlen(attachment); i++) { - int val = (attachment[i] >> 4) & 15; - - //*s++ = ' '; - *s++ = hexit[val]; - val = attachment[i] & 15; - *s++ = hexit[val]; - } - *s = '\0'; - - len = strlen(dbname) + strlen(doc_id) + strlen(attach) - + 95 + char0; + len = strlen(dbname) + strlen(doc_id) + strlen(attach64) + + 112 + char0; querytext = malloc(len); - snprintf(querytext, len, query, dbname, doc_id, attach); + snprintf(querytext, len, query, dbname, doc_id, attach64); msg = RESTsqlQuery(result, querytext); if (querytext != NULL) { free(querytext); } - //if (strcmp(*result,"&2 1 -1\n") == 0) { - // msg = RESTsqlQuery(result, result_ok); - //} + if (attach64 != NULL) { + free(attach64); + } return msg; } @@ -448,11 +439,52 @@ str RESTgetAttach(char ** result, char * str msg = MAL_SUCCEED; size_t len = strlen(dbname) +
MonetDB: default - add deleted field and new set of tests
Changeset: fe2fc41f7a15 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe2fc41f7a15 Added Files: sql/backends/monet5/rest/Tests/jsonstore01.sql sql/backends/monet5/rest/Tests/jsonstore01.stable.err sql/backends/monet5/rest/Tests/jsonstore01.stable.out Modified Files: sql/backends/monet5/rest/Tests/All sql/backends/monet5/rest/rest_jsonstore_handle_get.c Branch: default Log Message: add deleted field and new set of tests diffs (truncated from 468 to 300 lines): diff --git a/sql/backends/monet5/rest/Tests/All b/sql/backends/monet5/rest/Tests/All --- a/sql/backends/monet5/rest/Tests/All +++ b/sql/backends/monet5/rest/Tests/All @@ -1,1 +1,2 @@ jsonstore00 +jsonstore01 diff --git a/sql/backends/monet5/rest/Tests/jsonstore01.sql b/sql/backends/monet5/rest/Tests/jsonstore01.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/rest/Tests/jsonstore01.sql @@ -0,0 +1,123 @@ +CREATE TABLE json_first ( + _id uuid, _rev VARCHAR(34), + deleted BOOLEAN, + js json); + +CREATE FUNCTION first_update_doc +( doc_id VARCHAR(36), + doc json ) + RETURNS TABLE ( OK BOOLEAN ) +BEGIN + DECLARE ISNEW INTEGER; + DECLARE VERSION INT; + DECLARE NEWVER VARCHAR(6); + SET ISNEW = (SELECT + COUNT(*) FROM json_first + WHERE _id = doc_id); + IF (ISNEW = 0) THEN +SET NEWVER = '1'; + ELSE +SET VERSION = ( + SELECT MAX( + CAST( + SUBSTRING(_rev, +1,POSITION('-' + IN _rev) - 1) + AS INT) + 1) + FROM json_first + WHERE _id = + doc_id); + SET NEWVER = + CAST(VERSION AS + VARCHAR(6)); + END IF; + INSERT INTO json_first ( + _id, _rev, deleted, js ) + VALUES ( doc_id, + CONCAT(NEWVER, +CONCAT('-', + md5(doc))), + FALSE, + doc ); + RETURN + SELECT TRUE; +END; + +INSERT INTO json_first (_id, _rev, deleted, js) +VALUES ('4b5b0c91-61f3-46db-b279-1535c8e2bd41', concat('1-', md5('{}')), FALSE, '{}'); + +SELECT * FROM json_first; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND json_first.deleted = FALSE +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +SELECT * FROM json_first WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41'; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41' + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND json_first.deleted = FALSE +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +SELECT * FROM first_update_doc ('4b5b0c91-61f3-46db-b279-1535c8e2bd41', '{"message":"hello world"}'); + +INSERT INTO json_first (_id, _rev, deleted, js) +VALUES ('4b5b0c91-61f3-46db-b279-1535c8e2bd42', concat('1-', md5('{}')), FALSE, '{}'); + +UPDATE json_first SET deleted = TRUE WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41'; + +SELECT * FROM json_first; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND json_first.deleted = FALSE +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +SELECT * FROM json_first WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41'; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41' + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND json_first.deleted = FALSE +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +DROP FUNCTION first_update_doc; +DROP TABLE json_first; diff --git a/sql/backends/monet5/rest/Tests/jsonstore01.stable.err b/sql/backends/monet5/rest/Tests/jsonstore01.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/rest/Tests/jsonstore01.stable.err @@ -0,0 +1,35 @@ +stderr of test 'jsonstore01` in directory 'sql/backends/monet5/rest` itself: + + +# 14:35:29 > +# 14:35:29 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36192" "--set" "mapi_usock=/var/tmp/mtest-4657/.s.monetdb.36192" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijk
MonetDB: default - start implementing document updates and small...
Changeset: d225b549a453 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d225b549a453 Modified Files: monetdb5/mal/mal_http_daemon.c sql/backends/monet5/rest/rest_jsonstore_handle_get.c Branch: default Log Message: start implementing document updates and small improvements after testing diffs (123 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -36,7 +36,7 @@ static int volatile hdrunning; struct MHD_Daemon *http_daemon; #define PORT 8998 #define POSTBUFFERSIZE 512 -#define MAXNAMESIZE 20 +#define MAXNAMESIZE 512 #define MAXANSWERSIZE 512 #define GET 0 diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -61,6 +61,7 @@ RESTsqlQuery(char **result, char * query msg = SQLinitClient(c); MSinitClientPrg(c, "user", "main"); (void) MCinitClientThread(c); + // TODO: check that be <> NULL be = (backend*)c->sqlcontext; be->output_format = OFMT_JSON; @@ -130,11 +131,48 @@ str RESTcreateDB(char ** result, char * "_id uuid, " "mimetype varchar(128)," "filename varchar(128)," - "value blob); "; + "value blob); "; + size_t len = 3 * strlen(dbname) + (12 * line) - (3 * place) + char0; + querytext = malloc(len); + snprintf(querytext, len, query, dbname, dbname, dbname); + + msg = RESTsqlQuery(result, querytext); + if (querytext != NULL) { + free(querytext); + } + + query = + "CREATE FUNCTION %s_UPDATE_DOC " + "( doc_id VARCHAR(36), " + " doc json ) " + "RETURNS VARCHAR(100) " + "BEGIN " + " DECLARE ISNEW INTEGER; " + " DECLARE VERSION INTEGER;" + " SET ISNEW = (SELECT " + "COUNT(*) FROM json_%s " + "WHERE _id = doc_id); " + " IF (ISNEW = 0) THEN " + "INSERT INTO json_%s ( " + " _id, _rev, js ) " + "VALUES ( doc_id, " + " CONCAT('1-', md5(doc)), " + "doc );" + " ELSE" + "INSERT INTO json_%s ( " + " _id, _rev, js ) " + "VALUES ( doc_id, " + " CONCAT('2-', md5(doc)), " + "doc );" + " END IF;" + "RETURN" + " SELECT 'TRUE' as ok;" + "END; "; + len = 4 * strlen(dbname) + (26 * line) - (4 * place) + char0; querytext = malloc(len); - snprintf(querytext, len, query, dbname, dbname, dbname); + snprintf(querytext, len, query, dbname, dbname, dbname, dbname); msg = RESTsqlQuery(result, querytext); if (querytext != NULL) { @@ -151,12 +189,14 @@ str RESTdeleteDB(char ** result, char * str msg = MAL_SUCCEED; char * querytext = NULL; char * query = + "DROP FUNCTION %s_UPDATE_DOC; " "DROP TABLE json_%s; " - "DROP TABLE jsonblob_%s; "; - int len = 2 * strlen(dbname) + (2 * line) - (2 * place) + char0; + "DROP TABLE jsonblob_%s; " + "DROP TABLE jsondesign_%s; "; + int len = 4 * strlen(dbname) + (4 * line) - (4 * place) + char0; querytext = malloc(len); - snprintf(querytext, len, query, dbname, dbname); + snprintf(querytext, len, query, dbname, dbname, dbname); msg = RESTsqlQuery(result, querytext); if (querytext != NULL) { @@ -223,19 +263,16 @@ str RESTgetDoc(char ** result, char * db str RESTupdateDoc(char ** result, char * dbname, const char * doc, const char * doc_id) { str msg = MAL_SUCCEED; - size_t len = strlen(doc_id) + strlen(dbname) + 2 * strlen(doc) + 74; + size_t len = strlen(dbname) + strlen(doc) + strlen(doc_id) + 28 + char0; char * querytext = NULL; querytext = malloc(len); - snprintf(querytext, len, "INSERT INTO json_%s (_id, _rev, js) VALUES ('%s', concat('2-', md5('%s')), '%s');", dbname, doc_id, doc, doc); + snprintf(querytext, len, "SELECT %s_update_doc ('%s', '%s');", dbname, doc_id, doc); msg = RESTsqlQuery(result, querytext); if
MonetDB: default - implement document versioning and add tests
Changeset: f86d1d4aaf04 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f86d1d4aaf04 Added Files: sql/backends/monet5/rest/Tests/All sql/backends/monet5/rest/Tests/jsonstore00.sql sql/backends/monet5/rest/Tests/jsonstore00.stable.err sql/backends/monet5/rest/Tests/jsonstore00.stable.out Modified Files: sql/backends/monet5/rest/Makefile.ag sql/backends/monet5/rest/rest_jsonstore_handle_get.c Branch: default Log Message: implement document versioning and add tests diffs (truncated from 548 to 300 lines): diff --git a/sql/backends/monet5/rest/Makefile.ag b/sql/backends/monet5/rest/Makefile.ag --- a/sql/backends/monet5/rest/Makefile.ag +++ b/sql/backends/monet5/rest/Makefile.ag @@ -62,3 +62,4 @@ headers_restautoload = { } EXTRA_DIST = 73_jsonstore.mal jsonstore.mal rest_jsonstore.h +EXTRA_DIST_DIR = Tests diff --git a/sql/backends/monet5/rest/Tests/All b/sql/backends/monet5/rest/Tests/All new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/rest/Tests/All @@ -0,0 +1,1 @@ +jsonstore00 diff --git a/sql/backends/monet5/rest/Tests/jsonstore00.sql b/sql/backends/monet5/rest/Tests/jsonstore00.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/rest/Tests/jsonstore00.sql @@ -0,0 +1,110 @@ +SELECT 'Unknown' AS error; + +SELECT 'Welcome' AS jsonstore, '(unreleased)' AS version; + +-- SELECT uuid() AS uuid; + +CREATE TABLE json_first ( + _id uuid, _rev VARCHAR(34), + js json); + +CREATE TABLE jsondesign_first ( + _id varchar(128), + _rev VARCHAR(34), + design json); + +CREATE TABLE jsonblob_first ( + _id uuid, + mimetype varchar(128), + filename varchar(128), + value blob); + +CREATE FUNCTION first_update_doc +( doc_id VARCHAR(36), + doc json ) + RETURNS TABLE ( OK BOOLEAN ) +BEGIN + DECLARE ISNEW INTEGER; + DECLARE VERSION INT; + DECLARE NEWVER VARCHAR(6); + SET ISNEW = (SELECT + COUNT(*) FROM json_first + WHERE _id = doc_id); + IF (ISNEW = 0) THEN +SET NEWVER = '1'; + ELSE +SET VERSION = ( + SELECT MAX( + CAST( + SUBSTRING(_rev, +1,POSITION('-' + IN _rev) - 1) + AS INT) + 1) + FROM json_first + WHERE _id = + doc_id); + SET NEWVER = + CAST(VERSION AS + VARCHAR(6)); + END IF; + INSERT INTO json_first ( + _id, _rev, js ) + VALUES ( doc_id, + CONCAT(NEWVER, +CONCAT('-', + md5(doc))), + doc ); + RETURN + SELECT TRUE; +END; + +SELECT SUBSTRING(name, 6, length(name) -5) AS name +FROM tables +WHERE name LIKE 'json!_%'ESCAPE'!'; + +INSERT INTO json_first (_id, _rev, js) +VALUES ('4b5b0c91-61f3-46db-b279-1535c8e2bd41', concat('1-', md5('{}')), '{}'); + +SELECT * FROM json_first; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +SELECT * FROM json_first WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41'; + +WITH curr_first(maxrev, _id) AS ( + SELECT MAX(CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT)), + _id + FROM json_first + WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41' + GROUP BY _id) +SELECT json_first._id, + json_first._rev, + json_first.js +FROM curr_first, + json_first +WHERE curr_first._id = json_first._id +AND curr_first.maxrev = CAST(SUBSTRING(_rev,1,POSITION('-' IN _rev) - 1) AS INT); + +SELECT * FROM first_update_doc ('4b5b0c91-61f3-46db-b279-1535c8e2bd41', '{"message":"hello world"}'); + +DELETE FROM json_first WHERE _id = '4b5b0c91-61f3-46db-b279-1535c8e2bd41'; + +DROP FUNCTION first_update_doc; +DROP TABLE json_first; +DROP TABLE jsonblob_first; +DROP TABLE jsondesign_first; + +SELECT 'Missing Database Name' AS error; +SELECT 'No Parameter Allowed' AS error; +SELECT 'Missing Attachment PATH' AS error; diff --git a/sql/backends/monet5/rest/Tests/jsonstore00.stable.err b/sql/backends/monet5/rest/Tests/jsonstore00.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/rest/Tests/jsonstore00.stable.err @@ -0,0 +1,35 @@ +stderr of test 'jsonstore00` in directory 'sql/backends/monet5/rest` itself: + + +# 10:04:37 > +# 10:04:37 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33859" "--set" "mapi_usock=/var/tmp/mtest-6476/.s.monetdb.33859" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_rest" "--set" "mal_listing=0" +# 10:04:37 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_dae
MonetDB: default - handle case of unknown url
Changeset: 83ed82a7e75e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83ed82a7e75e Modified Files: sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: handle case of unknown url diffs (40 lines): diff --git a/sql/backends/monet5/rest/rest_jsonstore.c b/sql/backends/monet5/rest/rest_jsonstore.c --- a/sql/backends/monet5/rest/rest_jsonstore.c +++ b/sql/backends/monet5/rest/rest_jsonstore.c @@ -377,6 +377,7 @@ handle_http_request (const char *url, co break; default: /* error, unknown command */ + RESTunknown(page); ret = 1; } diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -81,6 +81,14 @@ RESTsqlQuery(char **result, char * query return msg; } +str RESTunknown(char **result) +{ + str msg = MAL_SUCCEED; + char * querytext = "select 'Unknown' as error;"; + msg = RESTsqlQuery(result, querytext); + return msg; +} + str RESTwelcome(char **result) { str msg = MAL_SUCCEED; diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.h b/sql/backends/monet5/rest/rest_jsonstore_handle_get.h --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.h +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.h @@ -33,6 +33,7 @@ #define rest_export extern #endif +rest_export str RESTunknown(char **result); rest_export str RESTwelcome(char **result); rest_export str RESTuuid(char **result); rest_export str RESTallDBs(char **result); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - implement design functions
Changeset: fcc72f8cbb45 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fcc72f8cbb45 Modified Files: sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: implement design functions diffs (202 lines): diff --git a/sql/backends/monet5/rest/rest_jsonstore.c b/sql/backends/monet5/rest/rest_jsonstore.c --- a/sql/backends/monet5/rest/rest_jsonstore.c +++ b/sql/backends/monet5/rest/rest_jsonstore.c @@ -103,8 +103,17 @@ mserver_browser_get(const UriUriA uri) { } else { // The first path element is a table name // we cannot check this here, so we assume the table exists - mserver_rest_command = MONETDB_REST_DB_GETDOCID; - fprintf(stderr, "url: %s\n", uri.pathHead->text.first); + if (strncmp(uri.pathHead->next->text.first, API_SPECIAL_CHAR, 1) == 0) { + // This path element is on of the special cases + mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; + if (strncmp(uri.pathHead->next->text.first, MONETDB_REST_PATH_DESIGN, 7) == 0) { + mserver_rest_command = MONETDB_REST_GET_DESIGN; + fprintf(stderr, "special url: %s\n", uri.pathTail->text.first); + } + } else { + mserver_rest_command = MONETDB_REST_DB_GETDOCID; + fprintf(stderr, "url: %s\n", uri.pathHead->text.first); + } } } } @@ -125,7 +134,7 @@ mserver_browser_put(const UriUriA uri) { if (uri.absolutePath) { if (uri.pathHead != NULL) { if (uri.pathHead->next == NULL) { - if (strcmp(uri.pathHead->text.first, API_SPECIAL_CHAR) < 0) { + if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; } else { @@ -133,12 +142,24 @@ mserver_browser_put(const UriUriA uri) { fprintf(stderr, "url: %s\n", uri.pathHead->text.first); } } else { - if (strcmp(uri.pathHead->text.first, API_SPECIAL_CHAR) < 0) { + // We have multiple paths + if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; } else { - mserver_rest_command = MONETDB_REST_DB_UPDATE_DOC; + // The first path element is a table name + // we cannot check this here, so we assume the table exists fprintf(stderr, "url: %s\n", uri.pathHead->text.first); + if (strncmp(uri.pathHead->next->text.first, API_SPECIAL_CHAR, 1) == 0) { + // This path element is on of the special cases + mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; + if (strncmp(uri.pathHead->next->text.first, MONETDB_REST_PATH_DESIGN, 7) == 0) { + mserver_rest_command = MONETDB_REST_INSERT_DESIGN; + fprintf(stderr, "special url: %s\n", uri.pathTail->text.first); + } + } else { + mserver_rest_command = MONETDB_REST_DB_UPDATE_DOC; + } }
MonetDB: default - small fixes and start implementing other curl...
Changeset: c708feb01273 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c708feb01273 Modified Files: monetdb5/mal/mal_http_daemon.c Branch: default Log Message: small fixes and start implementing other curl wrappers diffs (12 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -67,7 +67,7 @@ send_page (struct MHD_Connection *connec rest = (*http_handler)(url, method, &page, postdata); (void)rest; response = - MHD_create_response_from_buffer (strlen (page), + MHD_create_response_from_buffer (strlen (page), (void *) page, MHD_RESPMEM_MUST_COPY); if (!response) ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - improve http request handling and add rest fu...
Changeset: b1d479fdc126 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b1d479fdc126 Modified Files: monetdb5/mal/mal_http_daemon.c Branch: default Log Message: improve http request handling and add rest functions diffs (12 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -67,7 +67,7 @@ send_page (struct MHD_Connection *connec rest = (*http_handler)(url, method, &page, postdata); (void)rest; response = - MHD_create_response_from_buffer (strlen (page), + MHD_create_response_from_buffer (strlen (page), (void *) page, MHD_RESPMEM_MUST_COPY); if (!response) ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - small fixes and start implementing other curl...
Changeset: 7f919b96f320 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7f919b96f320 Modified Files: monetdb5/mal/mal_http_daemon.c monetdb5/modules/atoms/mcurl.c monetdb5/modules/atoms/mcurl.mal sql/backends/monet5/rest/rest_jsonstore.c Branch: default Log Message: small fixes and start implementing other curl wrappers diffs (truncated from 354 to 300 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -67,7 +67,7 @@ send_page (struct MHD_Connection *connec rest = (*http_handler)(url, method, &page, postdata); (void)rest; response = - MHD_create_response_from_buffer (strlen (page), + MHD_create_response_from_buffer (strlen (page), (void *) page, MHD_RESPMEM_MUST_COPY); if (!response) @@ -105,8 +105,7 @@ iterate_post (void *coninfo_cls, enum MH snprintf (answerstring, MAXANSWERSIZE, "%s", data); con_info->answerstring = answerstring; -} - else + } else con_info->answerstring = NULL; return MHD_NO; @@ -148,8 +147,11 @@ answer_to_connection (void *cls, struct char * page = NULL; struct connection_info_struct *con_info; int *done = cls; + char *answerstring = NULL; char *errorpage = - "This doesn't seem to be right."; + "" + "Failed to handle error in http request." + ""; (void)version; @@ -161,8 +163,10 @@ answer_to_connection (void *cls, struct if (strcmp (method, "POST") == 0) { con_info->postprocessor = - MHD_create_post_processor (connection, POSTBUFFERSIZE, - iterate_post, (void *) con_info); + MHD_create_post_processor (connection, + POSTBUFFERSIZE, + iterate_post, + (void *) con_info); if (con_info->postprocessor == NULL) { free (con_info); @@ -191,17 +195,15 @@ answer_to_connection (void *cls, struct if (strcmp (method, "PUT") == 0) { if (*upload_data_size != 0) { - char *answerstring; // TODO: check free answerstring answerstring = malloc (MAXANSWERSIZE); if (!answerstring) return MHD_NO; snprintf (answerstring, MAXANSWERSIZE, "%s", upload_data); - con_info->answerstring = answerstring; *upload_data_size = 0; return send_page(connection, url, method, page, -con_info->answerstring); +answerstring); } *done = 1; } diff --git a/monetdb5/modules/atoms/mcurl.c b/monetdb5/modules/atoms/mcurl.c --- a/monetdb5/modules/atoms/mcurl.c +++ b/monetdb5/modules/atoms/mcurl.c @@ -125,6 +125,203 @@ handle_get_request(str *retval, str *url *retval = d; return msg; } + +static str +handle_put_request(str *retval, str *url) +{ + str d = NULL; + str msg = MAL_SUCCEED; + + CURL *curl_handle; + CURLcode res = CURLE_OK; + + struct MemoryStruct chunk; + + chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ + chunk.size = 0;/* no data at this point */ + + curl_global_init(CURL_GLOBAL_ALL); + /* init the curl session */ + curl_handle = curl_easy_init(); + curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); + /* set URL to get */ + + curl_easy_setopt(curl_handle, CURLOPT_URL, *url); + + /* no progress meter please */ + curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); + + /* send all data to this function */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); + + /* we want the body be written to this file handle instead of stdout */ + curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); + + /* get it! */ + res = curl_easy_perform(curl_handle); + + /* check for errors */ + if(res != CURLE_OK) { + msg = createException(MAL, "mcurl.deleterequest", + "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); + } else { +
MonetDB: default - add new functions and partial implementation ...
Changeset: 5586e168c723 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5586e168c723 Modified Files: monetdb5/mal/mal_http_daemon.c sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: add new functions and partial implementation of attachments diffs (truncated from 379 to 300 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -3,14 +3,14 @@ * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.monetdb.org/Legal/MonetDBLicense - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. - * + * * The Original Code is the MonetDB Database System. - * + * * The Initial Developer of the Original Code is CWI. * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. * Copyright August 2008-2013 MonetDB B.V. @@ -54,6 +54,7 @@ struct connection_info_struct int connectiontype; char *answerstring; struct MHD_PostProcessor *postprocessor; + char * poststring; }; static int @@ -111,6 +112,23 @@ iterate_post (void *coninfo_cls, enum MH return MHD_NO; } + if (strcmp (key, "file") == 0) + { + if ((size > 0) && (size <= MAXNAMESIZE)) + { + char *poststring; + poststring = malloc (MAXANSWERSIZE); + if (!poststring) + return MHD_NO; + + snprintf (poststring, MAXANSWERSIZE, "%s", data); + con_info->poststring = poststring; + } else + con_info->poststring = NULL; + + return MHD_NO; + } + return MHD_YES; } @@ -187,9 +205,11 @@ answer_to_connection (void *cls, struct *upload_data_size); *upload_data_size = 0; return MHD_YES; - } else if (con_info->answerstring != NULL) { - return send_page(connection, url, method, page, -con_info->answerstring); + } else { + if (con_info->answerstring != NULL) { + return send_page(connection, url, method, page, +con_info->answerstring); + } } } diff --git a/sql/backends/monet5/rest/rest_jsonstore.c b/sql/backends/monet5/rest/rest_jsonstore.c --- a/sql/backends/monet5/rest/rest_jsonstore.c +++ b/sql/backends/monet5/rest/rest_jsonstore.c @@ -165,6 +165,14 @@ mserver_browser_delete(const UriUriA uri mserver_rest_command = MONETDB_REST_DELETE_DB; fprintf(stderr, "url: %s\n", uri.pathHead->text.first); } + } else { + if (strcmp(uri.pathHead->text.first, API_SPECIAL_CHAR) < 0) { + // This path element is on of the special cases + mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; + } else { + mserver_rest_command = MONETDB_REST_DB_DELETE_DOC; + fprintf(stderr, "url: %s\n", uri.pathHead->text.first); + } } } else { // A absolutePath with an empty pathHead means the root url @@ -183,17 +191,31 @@ mserver_browser_post(const UriUriA uri) if (uri.absolutePath) { if (uri.pathHead != NULL) { if (uri.pathHead->next == NULL) { - if (strcmp(uri.pathHead->text.first, API_SPECIAL_CHAR) < 0) { + if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; } else { - mserver_rest_command = MONETDB_REST_POST_NEW_DOC; - fprintf(stderr, "url: %s\n", uri.pathHead->text.first); +
MonetDB: default - partial implementation of attachment handling
Changeset: cd180d4fef46 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cd180d4fef46 Modified Files: monetdb5/mal/mal_http_daemon.c sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: partial implementation of attachment handling diffs (193 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -54,7 +54,6 @@ struct connection_info_struct int connectiontype; char *answerstring; struct MHD_PostProcessor *postprocessor; - char * poststring; }; static int @@ -87,6 +86,7 @@ iterate_post (void *coninfo_cls, enum MH size_t size) { struct connection_info_struct *con_info = coninfo_cls; + char *answerstring; (void)key; (void)kind; @@ -99,7 +99,6 @@ iterate_post (void *coninfo_cls, enum MH { if ((size > 0) && (size <= MAXNAMESIZE)) { - char *answerstring; answerstring = malloc (MAXANSWERSIZE); if (!answerstring) return MHD_NO; @@ -111,24 +110,23 @@ iterate_post (void *coninfo_cls, enum MH return MHD_NO; } - + if (strcmp (key, "file") == 0) { if ((size > 0) && (size <= MAXNAMESIZE)) { - char *poststring; - poststring = malloc (MAXANSWERSIZE); - if (!poststring) + answerstring = malloc (MAXANSWERSIZE); + if (!answerstring) return MHD_NO; - snprintf (poststring, MAXANSWERSIZE, "%s", data); - con_info->poststring = poststring; + snprintf (answerstring, MAXANSWERSIZE, "%s", data); + con_info->answerstring = answerstring; } else - con_info->poststring = NULL; + con_info->answerstring = NULL; return MHD_NO; } - + return MHD_YES; } diff --git a/sql/backends/monet5/rest/rest_jsonstore.c b/sql/backends/monet5/rest/rest_jsonstore.c --- a/sql/backends/monet5/rest/rest_jsonstore.c +++ b/sql/backends/monet5/rest/rest_jsonstore.c @@ -56,7 +56,7 @@ mserver_browser_get(const UriUriA uri) { if (uri.absolutePath) { if (uri.pathHead != NULL) { if (uri.pathHead->next == NULL) { - if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { + if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; if (strcmp(uri.pathHead->text.first, MONETDB_REST_PATH_ALLDBS) == 0) { @@ -74,7 +74,7 @@ mserver_browser_get(const UriUriA uri) { } } else { // We have multiple paths - if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { + if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; if (strcmp(uri.pathHead->text.first, MONETDB_REST_PATH_ALLDBS) == 0) { @@ -191,7 +191,8 @@ mserver_browser_post(const UriUriA uri) if (uri.absolutePath) { if (uri.pathHead != NULL) { if (uri.pathHead->next == NULL) { - if (strncmp(uri.pathHead->text.first, API_SPECIAL_CHAR, 1) == 0) { + if (strncmp(uri.pathHead->text.first, + API_SPECIAL_CHAR, 1) == 0) { // This path element is on of the special cases mserver_rest_command = MONETDB_REST_UNKWOWN_SPECIAL; } else { diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -284,13 +284,46 @@ str RESTinsertAttach(char ** result, cha size_t len = strlen(dbname) + strlen(doc_id) + strlen(attachment) + (7 * line) - (3 * p
MonetDB: default - improve http request handling and add rest fu...
Changeset: b0d4d943156d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b0d4d943156d Modified Files: monetdb5/mal/mal_http_daemon.c sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: improve http request handling and add rest functions diffs (truncated from 325 to 300 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -57,6 +57,29 @@ struct connection_info_struct }; static int +send_page (struct MHD_Connection *connection, const char * url, + const char * method, char *page, char * postdata) +{ + int ret; + int rest; + struct MHD_Response *response; + + rest = (*http_handler)(url, method, &page, postdata); + (void)rest; + response = + MHD_create_response_from_buffer (strlen (page), +(void *) page, +MHD_RESPMEM_MUST_COPY); + if (!response) + return MHD_NO; + + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; +} + +static int iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, @@ -72,9 +95,9 @@ iterate_post (void *coninfo_cls, enum MH (void)off; if (strcmp (key, "json") == 0) -{ + { if ((size > 0) && (size <= MAXNAMESIZE)) -{ + { char *answerstring; answerstring = malloc (MAXANSWERSIZE); if (!answerstring) @@ -87,7 +110,7 @@ iterate_post (void *coninfo_cls, enum MH con_info->answerstring = NULL; return MHD_NO; -} + } return MHD_YES; } @@ -106,11 +129,11 @@ request_completed (void *cls, struct MHD return; if (con_info->connectiontype == POST) -{ + { MHD_destroy_post_processor (con_info->postprocessor); if (con_info->answerstring) free (con_info->answerstring); -} + } free (con_info); *con_cls = NULL; @@ -122,15 +145,12 @@ answer_to_connection (void *cls, struct const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) { - struct MHD_Response *response; - int ret; - int rest; char * page = NULL; - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info; + int *done = cls; + char *errorpage = + "This doesn't seem to be right."; - (void)cls; - (void)url; - (void)method; (void)version; if (*con_cls == NULL) { @@ -142,7 +162,7 @@ answer_to_connection (void *cls, struct if (strcmp (method, "POST") == 0) { con_info->postprocessor = MHD_create_post_processor (connection, POSTBUFFERSIZE, - iterate_post, (void *) con_info); + iterate_post, (void *) con_info); if (con_info->postprocessor == NULL) { free (con_info); @@ -157,31 +177,48 @@ answer_to_connection (void *cls, struct } if (strcmp (method, "POST") == 0) { + con_info = *con_cls; if (*upload_data_size != 0) { MHD_post_process (con_info->postprocessor, upload_data, - *upload_data_size); + *upload_data_size); *upload_data_size = 0; + return MHD_YES; } else if (con_info->answerstring != NULL) { - // return send_page (connection, con_info->answerstring); - //return MHD_NO; + return send_page(connection, url, method, page, +con_info->answerstring); } } - rest = (*http_handler)(url, method, &page, con_info->answerstring); - (void)rest; - response = - MHD_create_response_from_buffer (strlen (page), (void *) page, - MHD_RESPMEM_MUST_COPY); -
MonetDB: default - improve json export function
Changeset: ccfaf5027870 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ccfaf5027870 Modified Files: sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/sql_result.c sql/backends/monet5/sql_scenario.c Branch: default Log Message: improve json export function diffs (65 lines): diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -55,10 +55,10 @@ RESTsqlQuery(char **result, char * query initLibraries(); msg = setScenario(c, "sql"); msg = SQLinitClient(c); + MSinitClientPrg(c, "user", "main"); + (void) MCinitClientThread(c); be = (backend*)c->sqlcontext; be->output_format = OFMT_JSON; - MSinitClientPrg(c, "user", "main"); - (void) MCinitClientThread(c); qmsg = SQLstatementIntern(c, &query, "rest", TRUE, TRUE); if (qmsg == MAL_SUCCEED) { diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c --- a/sql/backends/monet5/sql_result.c +++ b/sql/backends/monet5/sql_result.c @@ -1097,6 +1097,7 @@ mvc_export_table(backend *b, stream *s, struct time_res *tres; int csv = (b->output_format == OFMT_CSV); int json = (b->output_format == OFMT_JSON); + char * bj; if (!t) return -1; @@ -1129,15 +1130,22 @@ mvc_export_table(backend *b, stream *s, fmt[i].seplen = _strlen(fmt[i].sep); } if (json) { - res_col *p = t->cols + (i - 2); + res_col *p = t->cols + (i - 1); /* TODO name: * if i == 1 -> { name : * if i > 1 -> , name : */ - fmt[i-1].sep = p->name; - fmt[i-1].seplen = _strlen(fmt[i-1].sep); - if (i == t->nr_cols) { + if (i == 1) { + bj = SA_NEW_ARRAY(m->sa, char, strlen(p->name) + 6); + snprintf(bj, strlen(p->name) + 6, "{ %s , ", p->name); + fmt[i-1].sep = bj; + fmt[i-1].seplen = _strlen(fmt[i-1].sep); + } else if (i <= t->nr_cols) { + fmt[i-1].sep = p->name; + fmt[i-1].seplen = _strlen(fmt[i-1].sep); + } + if (i == t->nr_cols) { fmt[i].sep = " }\n"; fmt[i].seplen = _strlen(fmt[i].sep); } diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1072,6 +1072,7 @@ SQLstatementIntern(Client c, str *expr, m->type= Q_PARSE; be = sql; sql = backend_create(m, c); + sql->output_format = be->output_format; m->qc = NULL; m->caching = 0; m->user_id = m->role_id = USER_MONETDB; ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merge with default
Changeset: 37cb815a9757 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=37cb815a9757 Modified Files: gdk/gdk_heap.c gdk/gdk_posix.c Branch: default Log Message: merge with default diffs (212 lines): diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -344,6 +344,7 @@ int HEAPextend(Heap *h, size_t size) { char nme[PATHLENGTH], *ext = NULL; + char *failure = "None"; if (h->filename) { strncpy(nme, h->filename, sizeof(nme)); @@ -352,6 +353,8 @@ HEAPextend(Heap *h, size_t size) } if (size <= h->size) return 0; + else + failure = "size > h->size"; if (h->storage != STORE_MEM) { char *p; @@ -370,6 +373,8 @@ HEAPextend(Heap *h, size_t size) h->size = size; h->base = p; return 0; + } else { + failure = "MT_mremap() failed"; } } else { /* extend a malloced heap, possibly switching over to @@ -394,6 +399,8 @@ HEAPextend(Heap *h, size_t size) HEAPDEBUG fprintf(stderr, "#HEAPextend: extending malloced heap " SZFMT " " SZFMT " " PTRFMT " " PTRFMT "\n", size, h->size, PTRFMTCAST p, PTRFMTCAST h->base); if (h->base) return 0; + else + failure = "h->storage == STORE_MEM && !must_map && !h->base"; } /* too big: convert it to a disk-based temporary heap */ if (can_mmap) { @@ -416,8 +423,10 @@ HEAPextend(Heap *h, size_t size) * to use a file from the cache (or * create a new one) */ h->filename = GDKmalloc(strlen(nme) + strlen(ext) + 2); - if (h->filename == NULL) + if (h->filename == NULL) { + failure = "h->storage == STORE_MEM && can_map && h->filename == NULL"; goto failed; + } sprintf(h->filename, "%s.%s", nme, ext); h->base = HEAPcacheFind(&h->size, h->filename, STORE_MMAP); if (h->base) { @@ -425,6 +434,8 @@ HEAPextend(Heap *h, size_t size) memcpy(h->base, bak.base, bak.free); HEAPfree(&bak); return 0; + } else { + failure = "h->storage == STORE_MEM && can_map && !h->base"; } } fd = GDKfdlocate(nme, "wb", ext); @@ -447,11 +458,15 @@ HEAPextend(Heap *h, size_t size) memcpy(h->base, bak.base, bak.free); HEAPfree(&bak); return 0; + } else { + failure = "h->storage == STORE_MEM && can_map && fd >= 0 && HEAPload() < 0"; } /* couldn't allocate, now first save * data to file */ - if (HEAPsave_intern(&bak, nme, ext, ".tmp") < 0) + if (HEAPsave_intern(&bak, nme, ext, ".tmp") < 0) { + failure = "h->storage == STORE_MEM && can_map && fd >= 0 && HEAPsave_intern() < 0"; goto failed; + } /* then free memory */ HEAPfree(&bak); /* and load heap back in via @@ -460,15 +475,21 @@ HEAPextend(Heap *h, size_t size) /* success! */ GDKclrerr();/* don't leak errors from e.g. HEAPload */ return 0; + } else { + failure = "h->storage == STORE_MEM && can_map && fd >= 0 && HEAPload_intern() < 0"; } /* we failed */ + } else { + failure = "h->storage == STORE_MEM && can_map && fd < 0"; } + } else { + failure = "h->storage == STORE_MEM && !can_map"; } failed: *h = bak; } - GDKerror("HEAPextend: failed to extend to " SZFMT " for %s%s%s\n", -
MonetDB: default - merge with default
Changeset: 43a561e9cab2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43a561e9cab2 Modified Files: monetdb5/modules/mal/tablet.c sql/backends/monet5/UDF/udf.c sql/backends/monet5/UDF/udf_impl.h sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit Branch: default Log Message: merge with default diffs (162 lines): diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -1064,8 +1064,8 @@ SQLinsert_val(Column *fmt, char *s, char bunins_failed: if (*err == NULL) { snprintf(buf, BUFSIZ, -"parsing error from line " BUNFMT " field %d not inserted\n", -BATcount(fmt->c[0]) + 1, col); +"value from line " BUNFMT " field %d not inserted: %s\n", +BATcount(fmt->c[0]) + 1, col, GDKerrbuf); *err = GDKstrdup(buf); } return -1; diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c --- a/sql/backends/monet5/UDF/udf.c +++ b/sql/backends/monet5/UDF/udf.c @@ -254,15 +254,15 @@ UDFBATfuse_(BAT **ret, const BAT *bone, switch (bone->ttype) { case TYPE_bte: msg = UDFBATfuse_bte_sht ( bres, bone, btwo, n, - &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); + &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); break; case TYPE_sht: msg = UDFBATfuse_sht_int ( bres, bone, btwo, n, - &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); + &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); break; case TYPE_int: msg = UDFBATfuse_int_lng ( bres, bone, btwo, n, - &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); + &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); break; default: BBPreleaseref(bres->batCacheid); diff --git a/sql/backends/monet5/UDF/udf_impl.h b/sql/backends/monet5/UDF/udf_impl.h --- a/sql/backends/monet5/UDF/udf_impl.h +++ b/sql/backends/monet5/UDF/udf_impl.h @@ -41,7 +41,7 @@ static char * UF(UDFfuse_,UI,UO,_) ( UO *ret , UI one , UI two ) { -int shift = sizeof(UI) * 8; + int shift = sizeof(UI) * 8; /* assert calling sanity */ assert(ret != NULL); @@ -71,16 +71,37 @@ UF(UDFfuse_,UI,UO,) ( UO *ret , const UI * accessing value arrays directly. */ -/* type-specific core algorithm */ +/* type-specific core algorithm on arrays */ +static char * +UF(UDFarrayfuse_,UI,UO,) ( UO *res, const UI *one, const UI *two, BUN n ) +{ + BUN i; + int shift = sizeof(UI) * 8; + + /* assert calling sanity */ + assert(res != NULL && one != NULL && two != NULL); + + /* iterate over all values/tuples and do the work */ + for (i = 0; i < n; i++) + if (one[i] == UN(UI) || two[i] == UN(UI)) + /* NULL/nil in => NULL/nil out */ + res[i] = UN(UO); + else + /* do the work; watch out for sign bits */ + res[i] = ((UO) (UU) one[i] << shift) | (UU) two[i]; + + return MAL_SUCCEED; +} + +/* type-specific core algorithm on BATs */ static char * UF(UDFBATfuse_,UI,UO,) ( const BAT *bres, const BAT *bone, const BAT *btwo, BUN n, - bit *two_tail_sorted_unsigned, - bit *two_tail_revsorted_unsigned ) + bit *two_tail_sorted_unsigned, + bit *two_tail_revsorted_unsigned ) { UI *one = NULL, *two = NULL; UO *res = NULL; - BUN i; -int shift = sizeof(UI) * 8; + str msg = NULL; /* assert calling sanity */ assert(bres != NULL && bone != NULL && btwo != NULL); @@ -93,14 +114,11 @@ UF(UDFBATfuse_,UI,UO,) ( const BAT *bre one = (UI*) Tloc(bone, BUNfirst(bone)); two = (UI*) Tloc(btwo, BUNfirst(btwo)); res = (UO*) Tloc(bres, BUNfirst(bres)); - /* iterate over all values/tuples and do the work */ - for (i = 0; i < n; i++) - if (one[i] == UN(UI) || two[i] == UN(UI)) - /* NULL/nil in => NULL/nil out */ - res[i] = UN(UO); - else - /* do the work; watch out for sign bits */ - res[i] = ((UO) (UU) one[i] << shift) | (UU) two[i]; + + /* call core function on arrays */ + msg = UF(UDFarrayfuse_,UI,UO,) ( res, one, two , n ); + if (msg != MAL_SUCCEED) + return msg; *two_tail_sorted_unsigned = BATtordered(btwo) && (two[0] >= 0 || two[n-1
MonetDB: default - merge with local clone
Changeset: 75314c7590b8 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75314c7590b8 Modified Files: sql/backends/monet5/sql.mx sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_psm.c sql/test/Dependencies/Tests/Dependencies.stable.out sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check1_nogeom.stable.out sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check2_nogeom.stable.out sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check3_nogeom.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check4_nogeom.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/leaks/Tests/check5_nogeom.stable.out Branch: default Log Message: merge with local clone diffs (truncated from 601 to 300 lines): diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx --- a/sql/backends/monet5/sql.mx +++ b/sql/backends/monet5/sql.mx @@ -2520,6 +2520,8 @@ create_func( mvc *sql, char *sname, sql_ sql->sa = sa_create(); buf = sa_strdup(sql->sa, nf->query); r = rel_parse(sql, buf, m_deps); + if (r) + r = rel_optimizer(sql, r); if (r) { stmt *sb = rel_bin(sql, r); list *id_col_l = stmt_list_dependencies(sql->sa, sb, COLUMN_DEPENDENCY); diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -23,6 +23,7 @@ #include "rel_exp.h" #include "rel_psm.h" #include "rel_prop.h" /* for prop_copy() */ +#include "rel_optimizer.h" static sql_exp * exp_create(sql_allocator *sa, int type ) @@ -439,10 +440,11 @@ exp_if(sql_allocator *sa, sql_exp *cond, } sql_exp * -exp_rel(sql_allocator *sa, sql_rel *rel) +exp_rel(mvc *sql, sql_rel *rel) { - sql_exp *e = exp_create(sa, e_psm); + sql_exp *e = exp_create(sql->sa, e_psm); + rel = rel_optimizer(sql, rel); e->l = rel; e->flag = PSM_REL; return e; diff --git a/sql/server/rel_exp.h b/sql/server/rel_exp.h --- a/sql/server/rel_exp.h +++ b/sql/server/rel_exp.h @@ -20,6 +20,8 @@ #ifndef _REL_EXP_H_ #define _REL_EXP_H_ +#include "sql_mvc.h" + #define new_exp_list(sa) sa_list(sa) #define exp2list(sa,e) append(sa_list(sa),e) @@ -72,7 +74,7 @@ extern sql_exp * exp_var(sql_allocator * extern sql_exp * exp_return(sql_allocator *sa, sql_exp *val, int level); extern sql_exp * exp_while(sql_allocator *sa, sql_exp *cond, list *stmts); extern sql_exp * exp_if(sql_allocator *sa, sql_exp *cond, list *if_stmts, list *else_stmts); -extern sql_exp * exp_rel(sql_allocator *sa, sql_rel * r); +extern sql_exp * exp_rel(mvc *sql, sql_rel * r); extern void exp_setname(sql_allocator *sa, sql_exp *e, char *rname, char *name ); extern void exp_setrelname(sql_allocator *sa, sql_exp *e, int nr ); diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -91,12 +91,12 @@ psm_set_exp(mvc *sql, dnode *n) if (!e) return NULL; if (rel) { - sql_exp *er = exp_rel(sql->sa, rel); + sql_exp *er = exp_rel(sql, rel); list *b = sa_list(sql->sa); append(b, er); append(b, exp_set(sql->sa, name, e, level)); - res = exp_rel(sql->sa, rel_psm_block(sql->sa, b)); + res = exp_rel(sql, rel_psm_block(sql->sa, b)); } else { res = exp_set(sql->sa, name, e, level); } @@ -389,7 +389,7 @@ rel_psm_return( mvc *sql, sql_subtype *r return NULL; if (rel && ek.card != card_relation) - append(l, exp_rel(sql->sa, rel)); + append(l, exp_rel(sql, rel)); else if (rel) { list *exps = sa_list(sql->sa); node *n, *m; @@ -418,7 +418,7 @@ rel_psm_return( mvc *sql, sql_subtype *r rel -> exps = exps; else rel = rel_project(sql->sa, rel, exps); - res = exp_rel(sql->sa, rel); + res = exp_rel(sql, rel); } else if (!rel && res->tpe.comp_type){ /* handle return table-var */ sql_rel *rel = stack_find_rel_var(sql, res->r); list *exps = sa_list(sql->sa); @@ -439,7 +439,7 @@ rel_psm_return( mvc *sql, sql_subtype *r append(exps, e); } rel = rel_project(sql->sa, rel, exps); - res = exp_rel(sql->sa, rel); + res = exp_rel(sql, rel); } append(l, exp_return(sql->sa, res, stack_nr_of_declared_tables(sql))); return l; @@ -461,7 +461,7 @@ rel_select_into( mvc *sql, symbol *sq, e if (!r) return NULL; nl = sa_list(sql
MonetDB: default - implement new rest functions
t,"&2 1 -1\n") == 0) { msg = RESTsqlQuery(result, result_ok); } return msg; } + +str RESTdbInfo(char **result, char * dbname) +{ + str msg = MAL_SUCCEED; + int len = strlen(dbname) + 21; + char * querytext = NULL; + + querytext = malloc(len); + snprintf(querytext, len, "SELECT * FROM json_%s;", dbname); + + msg = RESTsqlQuery(result, querytext); + if (querytext != NULL) { + free(querytext); + } + return msg; +} diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.h b/sql/backends/monet5/rest/rest_jsonstore_handle_get.h --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.h +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.h @@ -36,8 +36,9 @@ rest_export str RESTwelcome(char **result); rest_export str RESTuuid(char **result); rest_export str RESTallDBs(char **result); -rest_export str RESTcreateDB(char **result, char * dbName); -rest_export str RESTdeleteDB(char **result, char * dbName); -rest_export str RESTcreateDoc(char **result, char * dbName, const char * doc); +rest_export str RESTcreateDB(char **result, char * dbname); +rest_export str RESTdeleteDB(char **result, char * dbname); +rest_export str RESTcreateDoc(char **result, char * dbname, const char * doc); +rest_export str RESTdbInfo(char **result, char * dbname); #endif diff --git a/sql/scripts/41_jsonstore.sql b/sql/scripts/41_jsonstore.sql new file mode 100644 --- /dev/null +++ b/sql/scripts/41_jsonstore.sql @@ -0,0 +1,22 @@ + +-- The contents of this file are subject to the MonetDB Public License +-- Version 1.1 (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the License at +-- http://www.monetdb.org/Legal/MonetDBLicense +-- +-- Software distributed under the License is distributed on an "AS IS" +-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +-- License for the specific language governing rights and limitations +-- under the License. +-- +-- The Original Code is the MonetDB Database System. +-- +-- The Initial Developer of the Original Code is CWI. +-- Copyright August 2008-2013 MonetDB B.V. +-- All Rights Reserved. + +-- (co) Arjen de Rijke +-- Functions supporting jsonstore + +create function sys.md5(v string) +returns string external name clients.md5sum; diff --git a/sql/scripts/Makefile.ag b/sql/scripts/Makefile.ag --- a/sql/scripts/Makefile.ag +++ b/sql/scripts/Makefile.ag @@ -20,7 +20,7 @@ MT_SAFE headers_sql = { HEADERS = sql DIR = libdir/monetdb5/createdb - SOURCES = 09_like.sql 10_math.sql 11_times.sql 12_url.sql 13_date.sql 14_inet.sql 15_querylog.sql 16_tracelog.sql 17_compress.sql 18_dictionary.sql 19_cluster.sql 20_vacuum.sql 21_dependency_functions.sql 22_clients.sql 23_skyserver.sql 24_zorder.sql 25_debug.sql 26_sysmon.sql 39_analytics.sql 40_json.sql 45_uuid.sql 75_storagemodel.sql 99_system.sql + SOURCES = 09_like.sql 10_math.sql 11_times.sql 12_url.sql 13_date.sql 14_inet.sql 15_querylog.sql 16_tracelog.sql 17_compress.sql 18_dictionary.sql 19_cluster.sql 20_vacuum.sql 21_dependency_functions.sql 22_clients.sql 23_skyserver.sql 24_zorder.sql 25_debug.sql 26_sysmon.sql 39_analytics.sql 40_json.sql 41_jsonstore.sql 45_uuid.sql 75_storagemodel.sql 99_system.sql } headers_moresql = { ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merge with local clone
Changeset: 792e61051eea for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=792e61051eea Modified Files: sql/test/BugTracker-2013/Tests/php-size-limit-bug.SQL.bat sql/test/mapi/Tests/php_monetdb.SQL.bat sql/test/mapi/Tests/php_monetdb_nogeom.SQL.bat Branch: default Log Message: merge with local clone ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - working client context and code cleanup
Changeset: c302ce01d883 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c302ce01d883 Modified Files: sql/backends/monet5/rest/rest_jsonstore_handle_get.c Branch: default Log Message: working client context and code cleanup diffs (200 lines): diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -21,12 +21,14 @@ #include #include "mal_mapi.h" #include "mal_client.h" +#include "mal_linker.h" #include "stream.h" #include "sql_scenario.h" #include #include static str RESTsqlQuery(char **result, char * query); +char * result_ok = "select true as ok;"; static str RESTsqlQuery(char **result, char * query) @@ -35,134 +37,120 @@ RESTsqlQuery(char **result, char * query str qmsg = MAL_SUCCEED; char * resultstring = NULL; struct buffer * resultbuffer; - stream * oldstream; stream * resultstream; Client c; + bstream *fin = NULL; + int len = 0; resultbuffer = buffer_create(BLOCK); resultstream = buffer_wastream(resultbuffer, "resultstring"); - c = mal_clients; - oldstream = c->fdout; - c->fdout = resultstream; + c = MCinitClient(CONSOLE, fin, resultstream); + c->nspace = newModule(NULL, putName("user", 4)); + + // TODO: lookup user_id in bat + c->user = 1; + initLibraries(); msg = setScenario(c, "sql"); + msg = SQLinitClient(c); + MSinitClientPrg(c, "user", "main"); + (void) MCinitClientThread(c); + qmsg = SQLstatementIntern(c, &query, "rest", TRUE, TRUE); - - resultstring = buffer_get_buf(resultbuffer); - *result = GDKstrdup(resultstring); - msg = setScenario(c, "mal"); - c->fdout = oldstream; - free(resultstring); + if (qmsg == MAL_SUCCEED) { + resultstring = buffer_get_buf(resultbuffer); + *result = GDKstrdup(resultstring); + free(resultstring); + } else { + len = strlen(qmsg) + 19; + resultstring = malloc(len); + snprintf(resultstring, len, "{ \"error\": \"%s\" }\n", qmsg); + *result = GDKstrdup(resultstring); + free(resultstring); + } buffer_destroy(resultbuffer); - - if (qmsg != MAL_SUCCEED) { - return qmsg; - } else { - return msg; - } + msg = SQLexitClient(c); + return msg; } str RESTwelcome(char **result) { str msg = MAL_SUCCEED; - char * querytext = "select '{ \"monetdb jsonstore\": \"Welcome\", \"version\":\"(unreleased)\" }';"; - + // TODO: get version from variable + char * querytext = "select 'Welcome' as jsonstore, '(unreleased)' as version;"; msg = RESTsqlQuery(result, querytext); - return msg; } str RESTallDBs(char **result) { str msg = MAL_SUCCEED; - char * querytext = "select name from tables where name like 'json_%';"; - + char * querytext = "select substring(name, 6, length(name) -5) from tables where name like 'json_%';"; msg = RESTsqlQuery(result, querytext); - return msg; } str RESTuuid(char **result) { str msg = MAL_SUCCEED; - char * querytext = "select uuid();"; - + char * querytext = "select uuid() as uuid;"; msg = RESTsqlQuery(result, querytext); - return msg; } str RESTcreateDB(char ** result, char * dbname) { str msg = MAL_SUCCEED; - str qmsg = MAL_SUCCEED; int len = strlen(dbname) + 45; - char * committext = "commit;"; - char * rollbacktext = "rollback;"; char * querytext = NULL; querytext = malloc(len); - sprintf(querytext, "CREATE TABLE sys.json_%s (u uuid, r int, js json);", dbname); + snprintf(querytext, len, "CREATE TABLE json_%s (u uuid, r int, js json);", dbname); - qmsg = RESTsqlQuery(result, querytext); - if (qmsg == MAL_SUCCEED) { - msg = RESTsqlQuery(result, committext); - } else { - msg = RESTsqlQuery(result, rollbacktext); - } - if (msg) {}; + msg = RESTsqlQuery(result, querytext); if (querytext != NULL) { free(querytext); } - return qmsg; + if (strcmp(*result,"") == 0) { + msg = RESTsqlQuery(result, result_ok); + } + return msg; } str RESTdeleteDB(char ** result, char * dbname) { str msg = MAL_SUCCEED; - str qmsg = MAL_SUCCEED; int len = strlen(dbname) + 23; - char * committext = "commit;"; - char * rollbacktext = "rollback;"; char * querytext = NULL; querytext = malloc(len); - sprintf(querytext, "DROP TABLE json_%s;", dbname); + snprintf(querytext, len, "DROP TABLE
MonetDB: default - merge with local clone
Changeset: 9b805eee7a0d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b805eee7a0d Modified Files: gdk/gdk_group.c gdk/gdk_heap.c gdk/gdk_system.c gdk/gdk_system.h monetdb5/mal/mal_recycle.c sql/backends/monet5/sql.mx sql/backends/monet5/sql_user.c sql/include/sql_relation.h Branch: default Log Message: merge with local clone diffs (truncated from 976 to 300 lines): diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -70,6 +70,7 @@ * At the MAL level, the multigroup function would perform the dynamic * optimization. */ + #define GRPnotfound() \ do {\ /* no equal found: start new group */ \ @@ -96,11 +97,184 @@ ngrp++; \ } while (0) -#define GRPhashloop(TYPE) \ + +#define GRP_compare_consecutive_values(INIT_0,INIT_1,COMP,KEEP) \ do {\ - TYPE *w = (TYPE *) Tloc(b, 0); \ - for (r = BUNfirst(b), p = r, q = r + BATcount(b); p < q; p++) { \ - prb = hash_##TYPE(hs, &w[p]); \ + INIT_0; \ + for (r = BUNfirst(b), p = r + 1, q = r + BATcount(b); \ +p < q; \ +p++) { \ + INIT_1; \ + if ((grps && *grps != prev) || COMP) { \ + GRPnotfound(); \ + } else {\ + ngrps[p - r] = ngrp - 1;\ + if (histo) \ + cnts[ngrp - 1]++; \ + } \ + KEEP; \ + if (grps) \ + prev = *grps++; \ + } \ + } while(0) + +#define GRP_compare_consecutive_values_tpe(TYPE) \ + GRP_compare_consecutive_values( \ + /* INIT_0 */TYPE *w = (TYPE *) Tloc(b, 0); \ + TYPE pw = w[BUNfirst(b)], \ + /* INIT_1 */, \ + /* COMP */w[p] != pw , \ + /* KEEP */pw = w[p] \ + ) + +#define GRP_compare_consecutive_values_any() \ + GRP_compare_consecutive_values( \ + /* INIT_0 */pv = BUNtail(bi, BUNfirst(b)) , \ + /* INIT_1 */v = BUNtail(bi, p) , \ + /* COMP */cmp(v, pv) != 0 , \ + /* KEEP */pv = v \ + ) + + +#define GRP_subscan_old_groups(INIT_0,INIT_1,COMP,KEEP) \ + do {\ + INIT_0; \ + pgrp[grps[0]] = BUNfirst(b);\ + for (j = r = BUNfirst(b), p = r + 1, q = r + BATcount(b); \ +p < q; \ +p++) { \ + INIT_1; \ + if (COMP) { \ + /* range [j, p) is all same value */\ + /* i is position where we saw p's old \ +* group last */\ + i = pgrp[grps[p - r]]; \ + /* p is new position where we saw this \ +* group */ \ + pgrp[grps[p - r]] = p; \ + if (j <= i && i < p){ \ + /* i is position of equal \ +* value in same old group as \ +
MonetDB: default - merge with local clone
Changeset: 876696d85bde for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=876696d85bde Removed Files: monetdb5/modules/atoms/mcurl.h Modified Files: clients/Tests/exports.stable.out monetdb5/mal/mal_recycle.c monetdb5/mal/mal_recycle.h monetdb5/modules/atoms/Makefile.ag monetdb5/modules/atoms/mcurl.c Branch: default Log Message: merge with local clone diffs (truncated from 386 to 300 lines): diff --git a/monetdb5/mal/mal_recycle.c b/monetdb5/mal/mal_recycle.c --- a/monetdb5/mal/mal_recycle.c +++ b/monetdb5/mal/mal_recycle.c @@ -91,19 +91,37 @@ static lng recycleSearchTime =0;/* cach * The profiler record is re-used to store recycler information. * The clk is used by the LRU scheme, counter is the number of * times this pattern was used, ticks is the clock ticks - * used to produce the result. rbytes+wbytes depict the storage - * size of operands and result arguments. + * used to produce the result. wbytes is the best approximation + * of the amount of storage needed for the intermediate. + * The read cost depends on too many factors. * - * The cost function is a weighted balance between cpu and - * storage cost. Often there is a direct relationship, + * For each intermediate we have to assume that at some point + * it is written to disk. This is the most expensive cost involved. + * For it means we also have to read it back in again. + * This leads to a cost estimate C =2 * writecost(Bytes) + * If this number is smaller the the inital cpu cost it is + * worth considering to keep the result. Otherwise we simply + * recalculate it. + * Once stored, an intermediate becomes more valuable as it is + * reused more often. + * + * If we don't write the intermediate, then its actual read time + * is the normalised cost. */ +#define MB (1024*1024) +#define USECperMB (75/100.0) /* 75MB per second, should be determined once */ +#define IOcost(B) (B/(MB) * USECperMB) +#define recycleProfit2(X) (recycleBlk->profiler[X].wbytes? IOcost(recycleBlk->profiler[X].wbytes): recycleBlk->profiler[X].ticks) + #define recycleCost(X) (recycleBlk->profiler[X].wbytes) -#define recycleW(X) ((recycleBlk->profiler[X].trace && (recycleBlk->profiler[X].calls >1 )) ? \ - (recycleBlk->profiler[X].calls -1) : 0.1 ) +#define recycleW(X) ((recycleBlk->profiler[X].calls >1 ) ? recycleBlk->profiler[X].calls : 0.1 ) #define recycleLife(X) ((GDKusec() - recycleBlk->profiler[X].rbytes)/ 1000.0) -#define recycleProfit(X) (recycleCost(X) * recycleW(X) / recycleLife(X)) +#define recycleProfit(X) recycleCost(X) * recycleW(X) +/* + * The new cost function is focussed on minimizing the IO overhead + */ static str bindRef = 0, bind_idxRef = 0, sqlRef = 0; static str subselectRef = 0, thetasubselectRef = 0, likesubselectRef = 0; @@ -183,6 +201,7 @@ RECYCLEgarbagecollect(MalBlkPtr mb, Inst } /* leaves : array of indices of leaf instructions */ +/* choose victum based on the predicted benefit from keeping it around */ static int chooseVictims(Client cntxt, int *leaves, int ltop, lng wr) @@ -196,12 +215,18 @@ int chooseVictims(Client cntxt, int *lea wben = (dbl *)GDKzalloc(sizeof(dbl)*ltop); for (l = 0; l < ltop; l++){ sz = recycleBlk->profiler[leaves[l]].wbytes; - ben = recycleProfit(leaves[l]); + ben = recycleProfit2(leaves[l]); wben[l] = sz? ben / sz : -1; +#ifdef _DEBUG_CACHE_ + mnstr_printf(cntxt->fdout,"#leaf[%d], wr "LLFMT" size "LLFMT" benefit %6.2f (%6.2f) wben %6.2f\n" ,l, wr, sz, (float)ben, recycleProfit2(l), (float)wben[l]); +#endif totmem += sz; } if (totmem <= wr) { /* all leaves need to be dropped */ GDKfree(wben); +#ifdef _DEBUG_CACHE_ + mnstr_printf(cntxt->fdout,"#drop all leaves\n"); +#endif return ltop; } @@ -230,14 +255,14 @@ int chooseVictims(Client cntxt, int *lea tmp = wben[mpos]; wben[mpos] = wben[newtop-1]; wben[newtop-1] = tmp; - tot_ben += recycleProfit(tmpl); + tot_ben += recycleProfit2(tmpl); } else break; } /* compare benefits of knap-sack content and the critical item */ ci_ben = 0; /* find the critical item */ for (l = 0; l < ltop; l++) { - ben = recycleProfit(leaves[l]); + ben = recycleProfit2(leaves[l]); if (recycleBlk->profiler[leaves[l]].wbytes <= targmem && ben > ci_ben){ ci = l; @@ -260,7 +285,7 @@ int chooseVictims(Client cntxt, int *lea } -static void RECYCLEcleanCache(Client cntxt, lng clk){ +static void RECYCLEcleanCache(Client cntxt){ int j,i,l,ltop,v,vtop; InstrPtr p; Instr
MonetDB: default - fix problems after testweb run
Changeset: c1b8e47a2d34 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c1b8e47a2d34 Modified Files: monetdb5/mal/mal_http_daemon.c monetdb5/modules/atoms/mcurl.c sql/backends/monet5/rest/Makefile.ag Branch: default Log Message: fix problems after testweb run diffs (39 lines): diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -19,6 +19,7 @@ #include "monetdb_config.h" +#ifdef HAVE_MICROHTTPD #include #include #include @@ -28,7 +29,6 @@ #include "mal_client.h" #include "mal_http_daemon.h" -#ifdef HAVE_MICROHTTPD #include static MT_Id hdthread; diff --git a/monetdb5/modules/atoms/mcurl.c b/monetdb5/modules/atoms/mcurl.c --- a/monetdb5/modules/atoms/mcurl.c +++ b/monetdb5/modules/atoms/mcurl.c @@ -113,7 +113,7 @@ handle_get_request(str *retval, str *url * should free() it as a nice application. */ - printf("%lu bytes retrieved\n", (long)chunk.size); + //printf("%lu bytes retrieved\n", (long)chunk.size); } if (chunk.size) { d = GDKstrdup(chunk.memory); diff --git a/sql/backends/monet5/rest/Makefile.ag b/sql/backends/monet5/rest/Makefile.ag --- a/sql/backends/monet5/rest/Makefile.ag +++ b/sql/backends/monet5/rest/Makefile.ag @@ -62,4 +62,3 @@ headers_restautoload = { } EXTRA_DIST = 73_jsonstore.mal jsonstore.mal rest_jsonstore.h -EXTRA_DIST_DIR = Tests ___ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merge with local clone
Changeset: 1f66e1251666 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f66e1251666 Added Files: monetdb5/mal/mal_http_daemon.c monetdb5/mal/mal_http_daemon.h monetdb5/modules/atoms/Tests/curl00.mal monetdb5/modules/atoms/Tests/curl00.stable.err monetdb5/modules/atoms/Tests/curl00.stable.out monetdb5/modules/atoms/mcurl.c monetdb5/modules/atoms/mcurl.h monetdb5/modules/atoms/mcurl.mal sql/backends/monet5/rest/73_jsonstore.mal sql/backends/monet5/rest/Makefile.ag sql/backends/monet5/rest/jsonstore.mal sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Modified Files: configure.ag monetdb5/mal/Makefile.ag monetdb5/mal/mal.c monetdb5/modules/atoms/Makefile.ag monetdb5/modules/atoms/Tests/All monetdb5/modules/mal/mal_init.mal sql/backends/monet5/Makefile.ag Branch: default Log Message: merge with local clone diffs (truncated from 1478 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -227,6 +227,13 @@ no-auto) ;; esac +dft_jsonstore=no +AC_ARG_ENABLE(jsonstore, + AS_HELP_STRING([--enable-jsonstore], + [enable support for MonetDB/jsonstore (default=no)]), + enable_jsonstore=$enableval, + enable_jsonstore=$dft_jsonstore) + dft_odbc=auto AC_ARG_ENABLE(odbc, AS_HELP_STRING([--enable-odbc], @@ -2097,6 +2104,7 @@ if test x"$have_curl" = x"yes" ; then AC_DEFINE(HAVE_CURL, 1, [Define if you have the cURL library]) AC_SUBST(PKG_CURL, libcurl) fi +AM_CONDITIONAL(HAVE_CURL, test x"$have_curl" != xno) PKG_CHECK_MODULES([zlib], [zlib], [have_zlib="yes"], [have_zlib="no"; why_have_zlib="(zlib not found)"]) if test x"$have_zlib" = x"yes" ; then @@ -2373,6 +2381,64 @@ if test x"$have_atomic_ops" = x"yes" ; t LIBS="$LIBS $atomic_ops_LIBS" fi +dnl MicroHTTPD library +dnl required for MonetDB5 SQL jsonstore, optional otherwise +have_libmicrohttpd=auto +AC_ARG_WITH(libmicrohttpd, + AS_HELP_STRING([--with-libmicrohttpd=DIR], + [libmicrohttpd library is installed in DIR]), + have_libmicrohttpd="$withval") + +dnl Uriparser library +dnl required for MonetDB5 SQL jsonstore, optional otherwise +have_liburiparser=auto +AC_ARG_WITH(liburiparser, + AS_HELP_STRING([--with-liburiparser=DIR], + [liburiparser library is installed in DIR]), + have_liburiparser="$withval") + +if test "x$have_liburiparser" == xauto; then + PKG_CHECK_MODULES([liburiparser], [liburiparser], + [have_liburiparser=yes], + [have_liburiparser=no]) +fi + +if test "x$have_libmicrohttpd" == xauto; then + PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd], + [have_libmicrohttpd=yes], + [have_libmicrohttpd=no]) +fi + +if test "x$enable_jsonstore" != xno; then + AC_DEFINE(HAVE_JSONSTORE, 1, [Define that you want to build the jsonstore library]) + + case "$enable_jsonstore-$have_libmicrohttpd" in +yes-no) + AC_MSG_ERROR([LibMicroHTTPD library not found but required for jsonstore]) + ;; +yes-yes) +AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if you have the LibMicroHTTPD library]) + save_LIBS="$LIBS" + LIBS="$LIBS $libmicrohttpd_LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $libmicrohttpd_CFLAGS" +;; + esac + + case "$enable_jsonstore-$have_liburiparser" in +yes-no) + AC_MSG_ERROR([LibUriParser library not found but required for jsonstore]) + ;; +yes-yes) +AC_DEFINE(HAVE_URIPARSER, 1, [Define if you have the LibUriParser library]) + save_LIBS="$LIBS" + LIBS="$LIBS $liburiparser_LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $liburiparser_CFLAGS" +;; + esac +fi + dnl checks for header files AC_HEADER_STDBOOL AC_HEADER_STDC @@ -2841,6 +2907,7 @@ AM_CONDITIONAL(HAVE_MONETDB5, test "x$en AM_CONDITIONAL(HAVE_SQL, test "x$enable_sql" = xyes -o "x$enable_sql" = xauto) AM_CONDITIONAL(HAVE_JAQL, test "x$enable_jaql" = xyes -o "x$enable_jaql" = xauto) AM_CONDITIONAL(HAVE_GEOM, test "x$enable_geom" = xyes -o "x$enable_geom" = xauto) +AM_CONDITIONAL(HAVE_JSONSTORE, test "x$enable_jsonstore" = xyes -o "x$enable_jsonstore" = xauto) AM_CONDITIONAL(HAVE_TESTING, test "x$enable_testing" = xyes -o "x$enable_testing" = xauto) AM_CONDITIONAL(HAVE_DEVELOPER, test "x$enable_developer" = xyes) @@ -3180,18 +3247,19 @@ done echo echo "* Enabled/disabled components:" for comp in \ - 'gdk ' \ - 'monetdb5' \ - 'sql ' \ - 'jaql'
MonetDB: default - wrap curl library functions in mal to be able...
Changeset: ceea046dfaaa for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ceea046dfaaa Added Files: monetdb5/modules/atoms/Tests/curl00.mal monetdb5/modules/atoms/Tests/curl00.stable.err monetdb5/modules/atoms/Tests/curl00.stable.out monetdb5/modules/atoms/mcurl.c monetdb5/modules/atoms/mcurl.h monetdb5/modules/atoms/mcurl.mal Modified Files: configure.ag monetdb5/modules/atoms/Makefile.ag monetdb5/modules/atoms/Tests/All monetdb5/modules/mal/mal_init.mal Branch: default Log Message: wrap curl library functions in mal to be able to test jsonstore diffs (truncated from 353 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2104,6 +2104,7 @@ if test x"$have_curl" = x"yes" ; then AC_DEFINE(HAVE_CURL, 1, [Define if you have the cURL library]) AC_SUBST(PKG_CURL, libcurl) fi +AM_CONDITIONAL(HAVE_CURL, test x"$have_curl" != xno) PKG_CHECK_MODULES([zlib], [zlib], [have_zlib="yes"], [have_zlib="no"; why_have_zlib="(zlib not found)"]) if test x"$have_zlib" = x"yes" ; then diff --git a/monetdb5/modules/atoms/Makefile.ag b/monetdb5/modules/atoms/Makefile.ag --- a/monetdb5/modules/atoms/Makefile.ag +++ b/monetdb5/modules/atoms/Makefile.ag @@ -20,7 +20,7 @@ INCLUDES = ../../mal \ ../../../common/stream \ ../../../common/utils \ ../../../gdk \ - $(libxml2_CFLAGS) + $(libxml2_CFLAGS) $(curl_CFLAGS) MTSAFE lib_atoms = { @@ -37,6 +37,7 @@ lib_atoms = { url.c url.h \ json_atom.c json_atom.h \ uuid.c uuid.h \ + mcurl.c mcurl.h \ xml.c xml.h } @@ -55,8 +56,9 @@ headers_mal = { json_atom.mal \ uuid.mal \ xml.mal \ +mcurl.mal \ mtime.mal } EXTRA_DIST_DIR = Tests -EXTRA_DIST = blob.mal color.mal identifier.mal inet.mal xml.mal xml.sql batxml.sql str.mal batxml.mal url.mal json_atom.mal uuid.mal streams.mal mtime.mal +EXTRA_DIST = blob.mal color.mal identifier.mal inet.mal xml.mal xml.sql batxml.sql str.mal batxml.mal url.mal json_atom.mal uuid.mal streams.mal mtime.mal mcurl.mal diff --git a/monetdb5/modules/atoms/Tests/All b/monetdb5/modules/atoms/Tests/All --- a/monetdb5/modules/atoms/Tests/All +++ b/monetdb5/modules/atoms/Tests/All @@ -24,3 +24,4 @@ json05 jsonrender uuid00 +#curl00 \ No newline at end of file diff --git a/monetdb5/modules/atoms/Tests/curl00.mal b/monetdb5/modules/atoms/Tests/curl00.mal new file mode 100644 --- /dev/null +++ b/monetdb5/modules/atoms/Tests/curl00.mal @@ -0,0 +1,8 @@ + +a:="http://localhost:8998/";; +b:str:= mcurl.getrequest(a); +io.print(b); + +#a:="http://www.example.com/";; +#b:str:= mcurl.getrequest(a); +#io.print(b); diff --git a/monetdb5/modules/atoms/Tests/curl00.stable.err b/monetdb5/modules/atoms/Tests/curl00.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/modules/atoms/Tests/curl00.stable.err @@ -0,0 +1,29 @@ +stderr of test 'curl00` in directory 'monetdb5/modules/atoms` itself: + + +# 18:14:24 > +# 18:14:24 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35895" "--set" "mapi_usock=/var/tmp/mtest-19428/.s.monetdb.35895" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/work/arjen/monetdb/monetdb/default/var/MonetDB/mTests_monetdb5_modules_atoms" "curl00.mal" +# 18:14:24 > + +# builtin opt gdk_dbpath = /export/work/arjen/monetdb/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 35895 +# cmdline opt mapi_usock = /var/tmp/mtest-19428/.s.monetdb.35895 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/work/arjen/monetdb/monetdb/default/var/MonetDB/mTests_monetdb5_modules_atoms + +# 18:14:25 > +# 18:14:25 > "Done." +# 18:14:25 > + diff --git a/monetdb5/modules/atoms/Tests/curl00.stable.out b/monetdb5/modules/atoms/Tests/curl00.stable.out new file mode 100644 --- /dev/null +++ b/monetdb5/modules/atoms/Tests/curl00.stable.out @@ -0,0 +1,37 @@ +stdout of test 'curl00` in directory 'monetdb5/modules/atoms` itself: + + +# 18:14:24 > +# 18:14:24 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35895" "--set" "mapi_usock=/var/tmp/mtest-19428/.s.monetdb.35895" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/work/arjen/monetdb/monetdb/d
MonetDB: default - cleanup code and indent
Changeset: 77501749c803 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=77501749c803 Modified Files: monetdb5/mal/mal.c monetdb5/mal/mal_http_daemon.c monetdb5/mal/mal_http_daemon.h sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Branch: default Log Message: cleanup code and indent diffs (truncated from 1086 to 300 lines): diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c --- a/monetdb5/mal/mal.c +++ b/monetdb5/mal/mal.c @@ -255,9 +255,9 @@ int mal_init(void){ initParser(); initHeartbeat(); initResource(); - #ifdef HAVE_JSONSTORE +#ifdef HAVE_JSONSTORE startHttpdaemon(); - #endif +#endif RECYCLEinit(); if( malBootstrap() == 0) return -1; @@ -332,9 +332,9 @@ void mal_exit(void){ RECYCLEdrop(mal_clients); /* remove any left over intermediates */ stopProfiling(); stopHeartbeat(); - #ifdef HAVE_JSONSTORE +#ifdef HAVE_JSONSTORE stopHttpdaemon(); - #endif +#endif stopMALdataflow(); #if 0 diff --git a/monetdb5/mal/mal_http_daemon.c b/monetdb5/mal/mal_http_daemon.c --- a/monetdb5/mal/mal_http_daemon.c +++ b/monetdb5/mal/mal_http_daemon.c @@ -30,15 +30,6 @@ #include "mal_http_daemon.h" #ifdef HAVE_MICROHTTPD #include -/*#include "rest_jsonstore.h"*/ -#endif - -/* -void startHttpdaemon(void); -void stopHttpdaemon(void); -*/ - -#ifdef HAVE_MICROHTTPD static MT_Id hdthread; static int volatile hdrunning; @@ -55,14 +46,14 @@ static http_request_handler http_handler; void register_http_handler(http_request_handler handler) { - http_handler = handler; + http_handler = handler; } struct connection_info_struct { - int connectiontype; - char *answerstring; - struct MHD_PostProcessor *postprocessor; + int connectiontype; + char *answerstring; + struct MHD_PostProcessor *postprocessor; }; static int @@ -71,58 +62,58 @@ iterate_post (void *coninfo_cls, enum MH const char *transfer_encoding, const char *data, uint64_t off, size_t size) { - struct connection_info_struct *con_info = coninfo_cls; + struct connection_info_struct *con_info = coninfo_cls; - if (key) {}; - if (kind) {}; - if (filename) {}; - if (content_type) {}; - if (transfer_encoding) {}; - if (off) {}; + (void)key; + (void)kind; + (void)filename; + (void)content_type; + (void)transfer_encoding; + (void)off; - if (strcmp (key, "json") == 0) + if (strcmp (key, "json") == 0) { - if ((size > 0) && (size <= MAXNAMESIZE)) + if ((size > 0) && (size <= MAXNAMESIZE)) { - char *answerstring; - answerstring = malloc (MAXANSWERSIZE); - if (!answerstring) -return MHD_NO; + char *answerstring; + answerstring = malloc (MAXANSWERSIZE); + if (!answerstring) + return MHD_NO; - snprintf (answerstring, MAXANSWERSIZE, "%s", data); - con_info->answerstring = answerstring; + snprintf (answerstring, MAXANSWERSIZE, "%s", data); + con_info->answerstring = answerstring; } - else -con_info->answerstring = NULL; + else + con_info->answerstring = NULL; - return MHD_NO; + return MHD_NO; } - return MHD_YES; + return MHD_YES; } static void request_completed (void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *con_cls; - if (cls) {}; - if (connection) {}; - if (toe) {}; + (void)cls; + (void)connection; + (void)toe; - if (NULL == con_info) -return; + if (NULL == con_info) + return; - if (con_info->connectiontype == POST) + if (con_info->connectiontype == POST) { - MHD_destroy_post_processor (con_info->postprocessor); - if (con_info->answerstring) -free (con_info->answerstring); + MHD_destroy_post_processor (con_info->postprocessor); + if (con_info->answerstring) + free (con_info->answerstring); } - free (con_info); - *con_cls = NULL; + free (con_info); + *con_cls = NULL; } static int @@ -131,85 +122,76 @@ answer_to_connection (void *cls, struct const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) { - struct MHD_Response *response; - int ret; - int rest; - char * page = NULL;
MonetDB: default - first working version of jsonstore
Changeset: 3fd1b1ebfc1f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fd1b1ebfc1f Added Files: monetdb5/mal/mal_http_daemon.c monetdb5/mal/mal_http_daemon.h sql/backends/monet5/rest/73_jsonstore.mal sql/backends/monet5/rest/Makefile.ag sql/backends/monet5/rest/jsonstore.mal sql/backends/monet5/rest/rest_jsonstore.c sql/backends/monet5/rest/rest_jsonstore.h sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/rest/rest_jsonstore_handle_get.h Modified Files: configure.ag monetdb5/mal/Makefile.ag monetdb5/mal/mal.c sql/backends/monet5/Makefile.ag Branch: default Log Message: first working version of jsonstore diffs (truncated from 1163 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -227,6 +227,13 @@ no-auto) ;; esac +dft_jsonstore=no +AC_ARG_ENABLE(jsonstore, + AS_HELP_STRING([--enable-jsonstore], + [enable support for MonetDB/jsonstore (default=no)]), + enable_jsonstore=$enableval, + enable_jsonstore=$dft_jsonstore) + dft_odbc=auto AC_ARG_ENABLE(odbc, AS_HELP_STRING([--enable-odbc], @@ -2292,6 +2299,64 @@ if test x"$have_atomic_ops" = x"yes" ; t LIBS="$LIBS $atomic_ops_LIBS" fi +dnl MicroHTTPD library +dnl required for MonetDB5 SQL jsonstore, optional otherwise +have_libmicrohttpd=auto +AC_ARG_WITH(libmicrohttpd, + AS_HELP_STRING([--with-libmicrohttpd=DIR], + [libmicrohttpd library is installed in DIR]), + have_libmicrohttpd="$withval") + +dnl Uriparser library +dnl required for MonetDB5 SQL jsonstore, optional otherwise +have_liburiparser=auto +AC_ARG_WITH(liburiparser, + AS_HELP_STRING([--with-liburiparser=DIR], + [liburiparser library is installed in DIR]), + have_liburiparser="$withval") + +if test "x$have_liburiparser" == xauto; then + PKG_CHECK_MODULES([liburiparser], [liburiparser], + [have_liburiparser=yes], + [have_liburiparser=no]) +fi + +if test "x$have_libmicrohttpd" == xauto; then + PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd], + [have_libmicrohttpd=yes], + [have_libmicrohttpd=no]) +fi + +if test "x$enable_jsonstore" != xno; then + AC_DEFINE(HAVE_JSONSTORE, 1, [Define that you want to build the jsonstore library]) + + case "$enable_jsonstore-$have_libmicrohttpd" in +yes-no) + AC_MSG_ERROR([LibMicroHTTPD library not found but required for jsonstore]) + ;; +yes-yes) +AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if you have the LibMicroHTTPD library]) + save_LIBS="$LIBS" + LIBS="$LIBS $libmicrohttpd_LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $libmicrohttpd_CFLAGS" +;; + esac + + case "$enable_jsonstore-$have_liburiparser" in +yes-no) + AC_MSG_ERROR([LibUriParser library not found but required for jsonstore]) + ;; +yes-yes) +AC_DEFINE(HAVE_URIPARSER, 1, [Define if you have the LibUriParser library]) + save_LIBS="$LIBS" + LIBS="$LIBS $liburiparser_LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $liburiparser_CFLAGS" +;; + esac +fi + dnl checks for header files AC_HEADER_STDBOOL AC_HEADER_STDC @@ -2755,6 +2820,7 @@ AM_CONDITIONAL(HAVE_MONETDB5, test "x$en AM_CONDITIONAL(HAVE_SQL, test "x$enable_sql" = xyes -o "x$enable_sql" = xauto) AM_CONDITIONAL(HAVE_JAQL, test "x$enable_jaql" = xyes -o "x$enable_jaql" = xauto) AM_CONDITIONAL(HAVE_GEOM, test "x$enable_geom" = xyes -o "x$enable_geom" = xauto) +AM_CONDITIONAL(HAVE_JSONSTORE, test "x$enable_jsonstore" = xyes -o "x$enable_jsonstore" = xauto) AM_CONDITIONAL(HAVE_TESTING, test "x$enable_testing" = xyes -o "x$enable_testing" = xauto) AM_CONDITIONAL(HAVE_DEVELOPER, test "x$enable_developer" = xyes) @@ -3077,6 +3143,7 @@ for comp in \ monetdb5 \ sql \ jaql \ + jsonstore \ geom \ fits \ rdf \ diff --git a/monetdb5/mal/Makefile.ag b/monetdb5/mal/Makefile.ag --- a/monetdb5/mal/Makefile.ag +++ b/monetdb5/mal/Makefile.ag @@ -20,6 +20,7 @@ INCLUDES = ../../common/options \ ../../common/utils \ ../../clients/mapilib \ ../../gdk \ + #../../sql/backends/monet5/rest \ $(READLINE_INCS) MTSAFE @@ -37,6 +38,7 @@ lib_mal = { mal_exception.c mal_exception.h \ mal_factory.c mal_factory.h \ mal_function.c mal_function.h \ + mal_http_daemon.c mal_http_daemon.h \ mal_import.c mal_import.h \ mal_runtime.c mal_runtime.h \ mal_instruction.c mal_instruction.h \ diff --git a/monetdb5/m