15 Commits

Author SHA1 Message Date
e9b202f5c8 \#10 Address compiler warnings
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-30 11:07:42 -05:00
bc3005a6a4 \#10 Address compiler warnings 2023-10-30 10:59:04 -05:00
8cf19e0594 \#10 Address compiler warnings 2023-10-30 10:54:35 -05:00
b137b57dbc \#10 Address compiler warnings 2023-10-30 10:36:31 -05:00
5dff8927da build win32 last
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-30 10:04:00 -05:00
197e79dd07 fix mingw64 jenkins build
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-30 10:02:55 -05:00
6262aca761 cmake build cleanup
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head There was a failure building this commit
2023-10-29 20:38:13 -05:00
c156ae704b cmake build refactor
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
2023-10-29 20:21:37 -05:00
a67979ec40 cleanup build
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
2023-10-29 20:05:38 -05:00
54bfc11620 fix erroneous nodiscard
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
2023-10-29 19:45:21 -05:00
d33c2cd3a2 removed msvc compilation support
Some checks are pending
BlockStorage/repertory_linux_builds/pipeline/head Build queued...
BlockStorage/repertory_osx/pipeline/head Build queued...
2023-10-29 19:40:29 -05:00
3a5f428fb6 [boost to v1.83.0] [curl to v8.4.0] [libsodium to v1.0.19] [rocksdb to v8.6.7]
Some checks reported errors
BlockStorage/repertory_windows/pipeline/head Something is wrong with the build of this commit
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head There was a failure building this commit
2023-10-29 19:26:09 -05:00
0331152569 add zlib as project dependency
All checks were successful
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-29 19:12:16 -05:00
1b7e854f5f added zlib
All checks were successful
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-29 19:05:40 -05:00
12a945d863 updated version
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2023-10-29 01:59:00 -05:00
34 changed files with 360 additions and 755 deletions

View File

@ -144,6 +144,7 @@ lptr
lpwstr
lzma
makefiles
markdownlint
mbig
mockwinfspdrive
mqtt

View File

@ -6,7 +6,7 @@ pipeline {
environment {
BUILD_ARGS = '--build . -j 8'
CONFIGURE_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON'
CONFIGURE_MINGW64_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON -DCMAKE_TOOLCHAIN_FILE=../../cmake/mingw-w64-x86_64.cmake'
CONFIGURE_MINGW64_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON -DCMAKE_TOOLCHAIN_FILE=${WORKSPACE}/cmake/mingw-w64-x86_64.cmake'
REPERTORY_TEST_DIR = "${HOME}/.ci/cfg"
}

View File

@ -1,39 +0,0 @@
#!groovy
pipeline {
agent any
environment {
REPERTORY_TEST_DIR = "C:\\.ci\\cfg"
}
options {
disableConcurrentBuilds()
retry(2)
}
stages {
stage('clean') {
steps {
bat 'del /q build\\Release\\librepertory.lib || exit 0'
bat 'del /q build\\Release\\unittests.exe || exit 0'
bat 'del /q build\\Release\\repertory.exe || exit 0'
}
}
stage('configure') {
steps {
cmake arguments: '.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON', installation: 'InSearchPath', workingDir: 'build'
}
}
stage('build') {
steps {
retry(2) {
sleep time: 5, unit: 'SECONDS'
cmake arguments: '--build . --target ALL_BUILD --config Release -j 4', installation: 'InSearchPath', workingDir: 'build'
}
}
}
}
}

View File

@ -1,7 +1,22 @@
# Changelog
## 2.0.1-rc
### Issues
* \#10 Address compiler warnings
### Changes from v2.0.0-rc
* Removed MSVC compilation support (MinGW-64 should be used)
* Upgraded `boost` to v1.83.0
* Upgraded `curl` to v8.4.0
* Upgraded `libsodium` to v1.0.19
* Upgraded `rocksdb` to v8.6.7
## 2.0.0-rc
<!-- markdownlint-disable-next-line -->
### Issues
* \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception

View File

@ -11,7 +11,7 @@ include(ExternalProject)
set(REPERTORY_MAJOR 2)
set(REPERTORY_MINOR 0)
set(REPERTORY_REV 0)
set(REPERTORY_REV 1)
set(REPERTORY_RELEASE_NUM 0)
set(REPERTORY_RELEASE_ITER rc)
set(REPERTORY_VERSION ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}-${REPERTORY_RELEASE_ITER})
@ -44,17 +44,6 @@ if (UNIX)
endif()
endif()
if (MSVC OR MINGW)
set(WINFSP_LIBRARY_BASENAME winfsp-x64)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/inc)
link_directories(${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/lib)
set(REPERTORY_LINK_LIBRARIES
${REPERTORY_LINK_LIBRARIES}
${WINFSP_LIBRARY_BASENAME}.lib
)
endif()
if (LINUX OR MINGW)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "Require at least gcc-8.0")
@ -163,27 +152,20 @@ elseif (MACOS)
"-framework SystemConfiguration"
)
elseif (MSVC)
set(OPENSSL_USE_STATIC_LIBS TRUE)
if (NOT OPENSSL_ROOT_DIR)
set (OPENSSL_ROOT_DIR "$ENV{USERPROFILE}\\scoop\\apps\\openssl\\current")
endif()
find_package(OpenSSL 1.1.1 REQUIRED)
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
set(REPERTORY_DEFINITIONS ${REPERTORY_DEFINITIONS} -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
if (NOT CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
set(REPERTORY_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
message(FATAL_ERROR "MSVC is currently not supported [MinGW-64 should be used]")
endif()
if (MINGW)
set(WINFSP_LIBRARY_BASENAME winfsp-x64)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/inc)
link_directories(${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/lib)
set(REPERTORY_LINK_LIBRARIES
${REPERTORY_LINK_LIBRARIES}
${WINFSP_LIBRARY_BASENAME}.lib
mswsock
)
endif()
if (MSVC OR MINGW)
set(REPERTORY_VER_FILEVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM})
set(REPERTORY_VER_FILEVERSION_STR ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}.${REPERTORY_RELEASE_NUM})
set(REPERTORY_VER_PRODUCTVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM})
@ -195,10 +177,6 @@ if (MSVC OR MINGW)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc @ONLY)
set(WINDOWS_VERSION_RC ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc)
if (MSVC)
set(LIB_EXT .lib)
endif()
set(REPERTORY_LINK_LIBRARIES
${REPERTORY_LINK_LIBRARIES}
advapi32${LIB_EXT}

View File

@ -2,10 +2,11 @@ set(BOOST_PROJECT_NAME boost_${BOOST_VERSION})
set(BOOST_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${BOOST_PROJECT_NAME})
set(BOOST_ADDRESS_MODEL 64)
set(BOOST_DLL_ARCH x64)
set(BOOST_DOWNLOAD_URL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_DL}.tar.gz)
set(BOOST_VERSION ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_REVISION})
set(BOOST_VERSION2 ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_REVISION})
set(BOOST_DOWNLOAD_URL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION2}.tar.gz)
if (UNIX OR MINGW)
if (IS_CLANG_COMPILER)
set(BOOST_TOOLSET --with-toolset=clang)
else ()
@ -31,6 +32,9 @@ if (UNIX OR MINGW)
linkflags=-std=c++${CMAKE_CXX_STANDARD}
threading=multi
variant=${CMAKE_BUILD_TYPE_LOWER}
-sZLIB_BINARY=zlibstatic${DEBUG_EXTRA}
-sZLIB_LIBPATH="${EXTERNAL_BUILD_ROOT}/lib"
-sZLIB_INCLUDE="${EXTERNAL_BUILD_ROOT}/include"
)
if (MINGW)
@ -84,54 +88,5 @@ if (UNIX OR MINGW)
libboost_serialization${BOOST_LIB_EXTRA}.a
libboost_thread${BOOST_LIB_EXTRA}.a
)
elseif(MSVC)
set (BOOST_COMMON_ARGS
--with-date_time
--with-regex
--with-serialization
--with-system
--with-filesystem
--prefix=${EXTERNAL_BUILD_ROOT}
runtime-link=shared
threading=multi
address-model=${BOOST_ADDRESS_MODEL}
architecture=x86
toolset=${BOOST_MSVC_TOOLSET}
variant=${CMAKE_BUILD_TYPE_LOWER}
-sZLIB_BINARY=zlibstatic${DEBUG_EXTRA}
-sZLIB_LIBPATH="${EXTERNAL_BUILD_ROOT}/lib"
-sZLIB_INCLUDE="${EXTERNAL_BUILD_ROOT}/include"
)
ExternalProject_Add(boost_project
DOWNLOAD_NO_PROGRESS 1
URL ${BOOST_DOWNLOAD_URL}
PREFIX ${BOOST_BUILD_ROOT}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND
bootstrap.bat
--with-date_time
--with-regex
--with-system
--with-serialization
--with-filesystem
BUILD_COMMAND
b2.exe
${BOOST_COMMON_ARGS}
INSTALL_COMMAND
b2.exe
install
${BOOST_COMMON_ARGS}
)
add_dependencies(boost_project zlib_project)
set(BOOST_ROOT ${BOOST_BUILD_ROOT}/src/boost_project)
set(Boost_INCLUDE_DIR ${EXTERNAL_BUILD_ROOT}/include/boost-${BOOST_VERSION_DLL})
set(Boost_LIBRARIES
${EXTERNAL_BUILD_ROOT}/lib/libboost_date_time-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
${EXTERNAL_BUILD_ROOT}/lib/libboost_filesystem-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
${EXTERNAL_BUILD_ROOT}/lib/libboost_regex-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
${EXTERNAL_BUILD_ROOT}/lib/libboost_serialization-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
${EXTERNAL_BUILD_ROOT}/lib/libboost_system-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
)
endif()

View File

@ -31,14 +31,20 @@ set(CURL_CMAKE_ARGS
-DUSE_LIBIDN2=OFF
)
if (MINGW AND CMAKE_TOOLCHAIN_FILE)
if (CMAKE_TOOLCHAIN_FILE)
set(CURL_CMAKE_ARGS
${CURL_CMAKE_ARGS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
)
endif()
if (MINGW)
set(CURL_CMAKE_ARGS
${CURL_CMAKE_ARGS}
-DCURL_USE_OPENSSL=OFF
-DUSE_WIN32_CRYPTO=ON
)
elseif(NOT MINGW)
else()
set(CURL_CMAKE_ARGS
${CURL_CMAKE_ARGS}
-DCURL_USE_OPENSSL=ON
@ -54,9 +60,8 @@ ExternalProject_Add(curl_project
set(REPERTORY_DEFINITIONS ${REPERTORY_DEFINITIONS} -DCURL_STATICLIB=ON -DCURL_DISABLE_LDAP=ON)
if (MSVC)
set(CURL_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libcurl${DEBUG_EXTRA2}${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(CURL_LIBRARIES libcurl${DEBUG_EXTRA2}${CMAKE_STATIC_LIBRARY_SUFFIX})
add_dependencies(curl_project openssl_project)
endif()
add_dependencies(curl_project
openssl_project
zlib_project
)

View File

@ -73,41 +73,6 @@ if (UNIX OR MINGW)
${REPERTORY_COMMON_FLAG_LIST}
-std=c++${CMAKE_CXX_STANDARD}
)
elseif (MSVC)
set(REPERTORY_C_FLAGS_LIST
${REPERTORY_C_FLAGS_LIST}
/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
/DNOMINMAX
/bigobj
/Zi
)
set(REPERTORY_CXX_FLAGS_LIST
${REPERTORY_CXX_FLAGS_LIST}
/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
/DNOMINMAX
/bigobj
/Zi
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(REPERTORY_C_FLAGS_LIST
${REPERTORY_C_FLAGS_LIST}
/DEBUG
)
set(REPERTORY_CXX_FLAGS_LIST
${REPERTORY_CXX_FLAGS_LIST}
/DEBUG
)
set(REPERTORY_SHARED_LINKER_FLAGS_LIST
${REPERTORY_SHARED_LINKER_FLAGS_LIST}
/DEBUG
/OPT:REF
/OPT:ICF
)
endif()
endif()
list(JOIN REPERTORY_CXX_FLAGS_LIST " " REPERTORY_CXX_FLAGS_LIST)

View File

@ -1,5 +1,5 @@
function(copy_support_files target)
if (MSVC OR MINGW)
if (MINGW)
add_custom_command(
TARGET ${target}
POST_BUILD

View File

@ -16,17 +16,11 @@ add_dependencies(librepertory
boost_project
curl_project
libsodium_project
openssl_project
rocksdb_project
zlib_project
)
if (LINUX)
add_dependencies(librepertory libuuid_project)
endif()
if (LINUX OR MINGW OR MACOS)
add_dependencies(librepertory openssl_project)
endif()
if (MSVC OR MINGW)
add_dependencies(librepertory zlib_project)
endif()

View File

@ -2,28 +2,6 @@ set(LIBSODIUM_PROJECT_NAME libsodium_${LIBSODIUM_VERSION})
set(LIBSODIUM_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${LIBSODIUM_PROJECT_NAME})
set(LIBSODIUM_BUILD_TYPE ${EXTERNAL_BUILD_TYPE})
if (MSVC)
ExternalProject_Add(libsodium_project
DOWNLOAD_NO_PROGRESS 1
PREFIX ${LIBSODIUM_BUILD_ROOT}
BUILD_IN_SOURCE 1
URL https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}-RELEASE/libsodium-${LIBSODIUM_VERSION}.tar.gz
CONFIGURE_COMMAND echo "Skipping Configure"
BUILD_COMMAND cd builds\\msvc\\vs2019 && msbuild
libsodium.sln
/p:Configuration=Static${LIBSODIUM_BUILD_TYPE}
/p:Platform=x64
/t:libsodium
INSTALL_COMMAND echo "Skipping Install"
)
link_directories(PRIVATE ${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/bin/x64/${LIBSODIUM_BUILD_TYPE}/v142/static)
set(LIBSODIUM_LIBRARIES libsodium.lib)
add_definitions(-DSODIUM_STATIC)
include_directories(SYSTEM
${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/src/libsodium/include
${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/builds/msvc
)
else()
if (MINGW)
set(LIBSODIUM_HOST --host=x86_64-w64-mingw32)
endif()
@ -43,5 +21,7 @@ else()
BUILD_COMMAND make
INSTALL_COMMAND make install
)
set(LIBSODIUM_LIBRARIES libsodium.a)
endif()
add_dependencies(libsodium_project zlib_project)

View File

@ -14,4 +14,7 @@ if (LINUX)
INSTALL_COMMAND make install
)
set(LIBUUID_LIBRARIES libuuid.a)
add_dependencies(libuuid_project zlib_project)
endif()

View File

@ -1,4 +1,3 @@
if (MACOS OR LINUX OR MINGW)
if (IS_CLANG_COMPILER)
set(OPENSSL_COMPILE_TYPE_EXTRA -clang)
endif()
@ -29,15 +28,9 @@ if (MACOS OR LINUX OR MINGW)
INSTALL_COMMAND make install
)
if (MACOS)
set(OPENSSL_LIBRARIES
${EXTERNAL_BUILD_ROOT}/lib/libssl.a
${EXTERNAL_BUILD_ROOT}/lib/libcrypto.a
)
else()
set(OPENSSL_LIBRARIES
libssl.a
libcrypto.a
)
endif()
endif()
add_dependencies(openssl_project zlib_project)

View File

@ -26,23 +26,6 @@ set(ROCKSDB_CMAKE_ARGS
-DWITH_TOOLS=OFF
)
if(MSVC)
ExternalProject_Add(rocksdb_project
DOWNLOAD_NO_PROGRESS 1
URL https://github.com/facebook/rocksdb/archive/v${ROCKSDB_VERSION}.tar.gz
PREFIX ${ROCKSDB_BUILD_ROOT}
CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS}
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project/include)
if (CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
set(ROCKSDB_LIBRARIES ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project-build/rocksdb.lib)
else ()
set(ROCKSDB_LIBRARIES ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project-build/${CMAKE_BUILD_TYPE}/rocksdb.lib)
endif ()
else()
if (MINGW)
if (CMAKE_TOOLCHAIN_FILE)
set(ROCKSDB_CMAKE_ARGS
@ -75,8 +58,9 @@ else()
set(ROCKSDB_LIBRARIES librocksdb.a)
endif()
endif()
endif()
if (MSVC OR LINUX OR MINGW)
if (LINUX OR MINGW)
add_dependencies(rocksdb_project curl_project)
endif()
add_dependencies(rocksdb_project zlib_project)

View File

@ -4,20 +4,6 @@ if (REPERTORY_ENABLE_TESTING)
set(GTEST_PROJECT_NAME gtest_${GTEST_VERSION})
set(GTEST_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${GTEST_PROJECT_NAME})
if (MSVC)
ExternalProject_Add(gtest_project
DOWNLOAD_NO_PROGRESS 1
URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.tar.gz
PREFIX ${GTEST_BUILD_ROOT}
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
-Dgtest_force_shared_crt=OFF
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
else()
if (MACOS)
set(GTEST_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(GTEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
@ -38,24 +24,13 @@ if (REPERTORY_ENABLE_TESTING)
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
endif()
set(GTEST_INCLUDE_DIRS
${GTEST_BUILD_ROOT}/src/gtest_project/googletest/include
${GTEST_BUILD_ROOT}/src/gtest_project/googlemock/include
)
if (MSVC)
if (NOT CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
set (GTEST_PATH_EXTRA ${CMAKE_BUILD_TYPE}/)
endif()
set(GTEST_LIBRARIES
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.lib
)
elseif (UNIX OR MINGW)
if(UNIX OR MINGW)
set(GTEST_LIBRARIES
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgmock.a
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgtest.a
@ -72,7 +47,11 @@ if (REPERTORY_ENABLE_TESTING)
)
add_project_executable(unittests "${UNITTEST_SOURCES}")
add_dependencies(unittests gtest_project)
add_dependencies(unittests
gtest_project
zlib_project
)
target_compile_definitions(unittests PUBLIC
GTEST_LINKED_AS_SHARED_LIBRARY=1
REPERTORY_TESTING
@ -83,28 +62,5 @@ if (REPERTORY_ENABLE_TESTING)
)
target_link_libraries(unittests PRIVATE ${GTEST_LIBRARIES})
if (MSVC)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
endif()
if (CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
endif()

View File

@ -1,16 +1,11 @@
set(BOOST_MAJOR_VERSION 1)
set(BOOST_MINOR_VERSION 78)
set(BOOST_MSVC_TOOLSET msvc-14.2)
set(BOOST_MSVC_TOOLSET_DLL 142)
set(BOOST_MINOR_VERSION 83)
set(BOOST_REVISION 0)
set(BOOST_VERSION ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_REVISION})
set(BOOST_VERSION_DL ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_REVISION})
set(BOOST_VERSION_DLL ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION})
set(CURL_VERSION 8_3_0)
set(CURL_VERSION 8_4_0)
set(GTEST_VERSION v1.14.0)
set(LIBSODIUM_VERSION 1.0.18)
set(LIBSODIUM_VERSION 1.0.19)
set(LIBUUID_VERSION 1.6.2)
set(OPENSSL_VERSION 1_1_1w)
set(ROCKSDB_VERSION 8.5.3)
set(ROCKSDB_VERSION 8.6.7)
set(WINFSP_VERSION 2.0)
set(ZLIB_VERSION v1.3)

View File

@ -1,4 +1,3 @@
if (MSVC OR MINGW)
set(ZLIB_PROJECT_NAME zlib_${ZLIB_VERSION})
set(ZLIB_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${ZLIB_PROJECT_NAME})
set(ZLIB_CMAKE_ARGS
@ -11,7 +10,7 @@ if (MSVC OR MINGW)
-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}
)
if (MINGW AND CMAKE_TOOLCHAIN_FILE)
if (CMAKE_TOOLCHAIN_FILE)
set(ZLIB_CMAKE_ARGS
${ZLIB_CMAKE_ARGS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
@ -28,15 +27,5 @@ if (MSVC OR MINGW)
if(MINGW)
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libzlibstatic${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/zlibstatic${DEBUG_EXTRA}${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
elseif(LINUX)
find_library(ZLIB_LIBRARIES NO_CACHE NAMES z)
if (NOT ZLIB_LIBRARIES)
message(FATAL_ERROR "'zlib' not found")
endif()
if (REPERTORY_MUSL)
set(ZLIB_LIBRARIES libz.a)
endif()
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libz${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()

View File

@ -46,7 +46,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
argc, argv, utils::cli::options::create_directory_option,
api_path)) == exit_code::success) {
lock_data lock(pt, unique_id);
const auto res = lock.grab_lock(1u);
const auto lock_res = lock.grab_lock(1u);
/* if (res == lock_result::locked) { */
/* auto port = app_config::default_api_port(pt); */
/* utils::cli::get_api_authentication_data(user, password, port, pt,
@ -57,7 +57,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
/* std::cout << static_cast<int>(response.response_type) << std::endl; */
/* std::cout << response.data.dump(2) << std::endl; */
/* } else */
if (res == lock_result::success) {
if (lock_res == lock_result::success) {
std::cout << "creating directory: '" << api_path << "'" << std::endl;
app_config config(pt, data_directory);
s3_comm comm(config);
@ -65,8 +65,8 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
std::cout << api_error_to_string(res) << std::endl;
ret = exit_code::success;
} else {
std::cout << "failed to grab lock: '" << static_cast<int>(res) << "'"
<< std::endl;
std::cout << "failed to grab lock: '" << static_cast<int>(lock_res)
<< "'" << std::endl;
ret = exit_code::lock_failed;
}
}

View File

@ -42,18 +42,8 @@ list_objects(int /* argc */, char * /* argv */[],
if (pt == provider_type::s3) {
lock_data lock(pt, unique_id);
const auto res = lock.grab_lock(1u);
/* if (res == lock_result::locked) { */
/* auto port = app_config::default_api_port(pt); */
/* utils::cli::get_api_authentication_data(user, password, port, pt,
* data_directory); */
/* const auto response = */
/* client({"localhost", password, port,
* user}).create_directory(api_path); */
/* std::cout << static_cast<int>(response.response_type) << std::endl; */
/* std::cout << response.data.dump(2) << std::endl; */
/* } else */
if (res == lock_result::success) {
auto lock_res = lock.grab_lock(1u);
if (lock_res == lock_result::success) {
app_config config(pt, data_directory);
s3_comm comm(config);
std::vector<directory_item> list{};
@ -67,7 +57,7 @@ list_objects(int /* argc */, char * /* argv */[],
std::cout << api_error_to_string(res) << std::endl;
}
} else {
std::cout << "failed to grab lock: '" << static_cast<int>(res) << "'"
std::cout << "failed to grab lock: '" << static_cast<int>(lock_res) << "'"
<< std::endl;
ret = exit_code::lock_failed;
}

View File

@ -27,12 +27,12 @@
#include "file_manager/file_manager.hpp"
namespace repertory {
class i_provider;
class app_config;
class console_consumer;
class directory_cache;
class eviction;
class full_server;
class i_provider;
class lock_data;
class logging_consumer;
namespace remote_fuse {
@ -197,8 +197,7 @@ protected:
#ifdef __APPLE__
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
char *value, size_t size,
[[nodiscard]] uint32_t position,
char *value, size_t size, uint32_t position,
int &attribute_size) -> api_error override;
#else // __APPLE__
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,

View File

@ -32,12 +32,12 @@ using event_consumer = event_system::event_consumer;
#define E_CAST(t) ((std::string)t)
#define E_DOUBLE(d) std::to_string(d)
#define E_DOUBLE_PRECISE(d) \
#define E_DOUBLE_PRECISE(dbl_val) \
([](const double &d) -> std::string { \
std::stringstream ss; \
ss << std::fixed << std::setprecision(2) << d; \
return ss.str(); \
})(d)
})(dbl_val)
#define E_FROM_BOOL(t) std::to_string(t)
#define E_FROM_EXCEPTION(e) std::string(e.what() ? e.what() : "")
#define E_FROM_INT32(t) std::to_string(t)
@ -69,8 +69,9 @@ using event_consumer = event_system::event_consumer;
#define E_PROP(type, name, short_name, ts) \
private: \
void init_##short_name(const type &val) { \
ss_ << "|" << #short_name << "|" << ts(val); \
j_[#name] = ts(val); \
auto ts_val = ts(val); \
ss_ << "|" << #short_name << "|" << ts_val; \
j_[#name] = ts_val; \
} \
\
public: \

View File

@ -1,115 +0,0 @@
@echo off
setlocal
setlocal enabledelayedexpansion
set SIGNING_FOLDER=%1
set BINARY_FOLDER=%2
set SOURCE_FOLDER=%3
set OUTPUT_FOLDER=%4
set PATH=%~dp0%..\bin;!PATH!
if "%SIGNING_FOLDER%" == "" (
call :EXIT_SCRIPT "'SIGNING_FOLDER' is not set (arg1)"
)
if "%BINARY_FOLDER%" == "" (
call :EXIT_SCRIPT "'BINARY_FOLDER' is not set (arg2)"
)
if "%SOURCE_FOLDER%" == "" (
call :EXIT_SCRIPT "'SOURCE_FOLDER' is not set (arg3)"
)
if "%OUTPUT_FOLDER%" == "" (
call :EXIT_SCRIPT "'OUTPUT_FOLDER' is not set (arg4)"
)
call :NORMALIZE "%SIGNING_FOLDER%"
set SIGNING_FOLDER=%RETVAL%
call :NORMALIZE "%BINARY_FOLDER%"
set BINARY_FOLDER=%RETVAL%
call :NORMALIZE "%SOURCE_FOLDER%"
set SOURCE_FOLDER=%RETVAL%
set BUILD_ARCH=Win64
set OPENSSL_BIN="c:\OpenSSL-%BUILD_ARCH%\bin\openssl.exe"
if NOT EXIST %OPENSSL_BIN% (
set OPENSSL_BIN="c:\Program Files\OpenSSL-%BUILD_ARCH%\bin\openssl.exe"
set REPERTORY_OPENSSL_ROOT="c:\Program Files\OpenSSL-%BUILD_ARCH%"
)
pushd "%SOURCE_FOLDER%"
for /F "tokens=*" %%f in ('git rev-parse --short HEAD') do (set GIT_REV=%%f)
for /F "tokens=*" %%f in ('git branch --show-current') do (set GIT_BRANCH=%%f)
for /F "tokens=*" %%f in ('grep set(REPERTORY_MAJOR .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%%f)
for /F "tokens=*" %%f in ('grep set(REPERTORY_MINOR .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%.%%f)
for /F "tokens=*" %%f in ('grep set(REPERTORY_REV .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%.%%f)
for /F "tokens=*" %%f in ('grep set(REPERTORY_RELEASE_ITER .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%-%%f)
popd
if "%GIT_BRANCH%" == "development" (
set RELEASE_FOLDER=nightly
) else (
set RELEASE_FOLDER=%REPERTORY_RELEASE_ITER%
)
call :NORMALIZE "%OUTPUT_FOLDER%\!RELEASE_FOLDER!"
set OUTPUT_FOLDER=%RETVAL%
set OUT_FILE=repertory_%REPERTORY_VERSION%_%GIT_REV%_windows_amd64.zip
set OUT_ZIP=%BINARY_FOLDER%\%OUT_FILE%
set FILE_LIST=repertory.exe repertory.exe.sha256 repertory.exe.sig winfsp-x64.dll winfsp-x64.dll.sha256 winfsp-x64.dll.sig cacert.pem cacert.pem.sha256 cacert.pem.sig
pushd "%BINARY_FOLDER%"
call :CLEANUP
call :CREATE_HASH "%BINARY_FOLDER%\repertory.exe"
call :CREATE_HASH "%BINARY_FOLDER%\winfsp-x64.dll"
call :CREATE_HASH "%BINARY_FOLDER%\cacert.pem"
(7za u "%OUT_FILE%" %FILE_LIST%) || (7z u "%OUT_FILE%" %FILE_LIST%) || (call :EXIT_SCRIPT "Create repertory zip failed")
call :CREATE_HASH "%OUT_FILE%"
copy /y "%OUT_ZIP%" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP% to %OUTPUT_FOLDER% failed"
copy /y "%OUT_ZIP%.sha256" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP%.sha256 to %OUTPUT_FOLDER% failed"
copy /y "%OUT_ZIP%.sig" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP%.sig to %OUTPUT_FOLDER% failed"
call :CLEANUP
popd
goto :END
:CREATE_HASH
call :NORMALIZE %1
set HASH_FILE=%RETVAL%
(%OPENSSL_BIN% dgst -sha256 -sign "%SIGNING_FOLDER%\blockstorage_dev_private.pem" -out "%HASH_FILE%.sig" "%HASH_FILE%") || (call :EXIT_SCRIPT "Create %HASH_FILE% signature failed")
(%OPENSSL_BIN% dgst -sha256 -verify "%SIGNING_FOLDER%\blockstorage_dev_public.pem" -signature "%HASH_FILE%.sig" "%HASH_FILE%") || (call :EXIT_SCRIPT "Verify %HASH_FILE% signature failed")
((certutil -hashfile "%HASH_FILE%" SHA256 | sed -e "1d" -e "$d" -e "s/\ //g") > "%HASH_FILE%.sha256") || (call :EXIT_SCRIPT "Create %HASH_FILE% sha-256 failed")
EXIT /B
:CLEANUP
del /q "%OUT_ZIP%" 1>NUL 2>&1
del /q "%OUT_ZIP%.sha256" 1>NUL 2>&1
del /q "%OUT_ZIP%.sig" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\cacert.pem.sha256" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\cacert.pem.sig" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\repertory.exe.sha256" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\repertory.exe.sig" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\winfsp-x64.dll.sha256" 1>NUL 2>&1
del /q "%BINARY_FOLDER%\winfsp-x64.dll.sig" 1>NUL 2>&1
EXIT /B
:NORMALIZE
SET RETVAL=%~f1
exit /B
:EXIT_SCRIPT
echo %1
exit 1
:END
echo Done

View File

@ -1,44 +0,0 @@
@echo off
set MSVC_BUILD_TYPE=%1
set BUILD_CLEAN=%2
if "%MSVC_BUILD_TYPE%" == "" (
echo "Build type not set"
exit 1
)
if "%MSVC_BUILD_TYPE%" == "Debug" (
set BUILD_FOLDER=debug
) else (
if "%MSVC_BUILD_TYPE%" == "Release" (
set BUILD_FOLDER=release
) else (
set BUILD_FOLDER=%MSVC_BUILD_TYPE%
)
set MSVC_BUILD_TYPE=Release
)
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
) else (
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
)
)
pushd "%~dp0%"
md ..\build2\%BUILD_FOLDER%
del /q ..\build2\%BUILD_FOLDER%\librepertory.lib
del /q ..\build2\%BUILD_FOLDER%\repertory.exe
del /q ..\build2\%BUILD_FOLDER%\unittests.exe
pushd "..\build2\%BUILD_FOLDER%"
cmake ..\.. -G "NMake Makefiles" -DREPERTORY_ENABLE_S3_TESTING=ON -DREPERTORY_ENABLE_S3=ON -DCMAKE_BUILD_TYPE=%MSVC_BUILD_TYPE% || exit 1
copy /y compile_commands.json ..
if "%BUILD_CLEAN%" == "clean" (
nmake clean || exit 1
)
nmake || exit 1
popd
popd

View File

@ -103,13 +103,13 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
reset_timeout();
}
unique_recur_mutex_lock file_lock(file_mtx_);
unique_recur_mutex_lock download_lock(file_mtx_);
if ((get_api_error() == api_error::success) && (chunk < read_state_.size()) &&
not read_state_[chunk]) {
if (active_downloads_.find(chunk) != active_downloads_.end()) {
if (not skip_active) {
auto active_download = active_downloads_.at(chunk);
file_lock.unlock();
download_lock.unlock();
active_download->wait();
}
@ -129,7 +129,7 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
read_state_.count());
active_downloads_[chunk] = std::make_shared<download>();
file_lock.unlock();
download_lock.unlock();
if (should_reset) {
reset_timeout();
@ -486,7 +486,7 @@ auto file_manager::open_file::close() -> bool {
}
void file_manager::open_file::update_background_reader(std::size_t read_chunk) {
recur_mutex_lock file_lock(file_mtx_);
recur_mutex_lock reader_lock(file_mtx_);
read_chunk_index_ = read_chunk;
if (not reader_thread_ && not stop_requested_) {
@ -533,11 +533,11 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
return api_error::success;
}
unique_recur_mutex_lock file_lock(file_mtx_);
unique_recur_mutex_lock write_lock(file_mtx_);
if (stop_requested_) {
return api_error::download_stopped;
}
file_lock.unlock();
write_lock.unlock();
const auto start_chunk_index =
static_cast<std::size_t>(write_offset / chunk_size_);
@ -552,7 +552,7 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
return get_api_error();
}
file_lock.lock();
write_lock.lock();
if ((write_offset + data.size()) > fsi_.size) {
auto res = resize(write_offset + data.size());
if (res != api_error::success) {

View File

@ -264,18 +264,18 @@ auto file_manager::ring_buffer_open_file::read(std::size_t read_size,
res = do_io([this, &buffer, &chunk, &data, read_offset,
&to_read]() -> api_error {
std::size_t bytes_read{};
auto res = nf_->read_bytes(buffer.data(), buffer.size(),
auto ret = nf_->read_bytes(buffer.data(), buffer.size(),
((chunk % ring_state_.size()) * chunk_size_),
bytes_read)
? api_error::success
: api_error::os_error;
if (res == api_error::success) {
if (ret == api_error::success) {
data.insert(data.end(), buffer.begin() + read_offset,
buffer.begin() + read_offset + to_read);
reset_timeout();
}
return res;
return ret;
});
read_offset = 0u;
read_size -= to_read;

View File

@ -407,8 +407,7 @@ void base_provider::remove_deleted_files() {
removed_files.pop_back();
bool exists{};
auto res = is_directory(api_path, exists);
if (res != api_error::success) {
if (is_directory(api_path, exists) != api_error::success) {
continue;
}
@ -421,7 +420,7 @@ void base_provider::remove_deleted_files() {
fm_->perform_locked_operation(
[this, &api_path, &source_path](i_provider &) -> bool {
if (fm_->has_no_open_file_handles()) {
const auto res = meta_db_->remove_item_meta(api_path);
auto res = meta_db_->remove_item_meta(api_path);
if (res == api_error::success) {
event_system::instance().raise<file_removed_externally>(
api_path, source_path);

View File

@ -222,21 +222,23 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
for (const auto &dir_entry :
std::filesystem::directory_iterator(source_path)) {
try {
std::string api_path{};
std::string entry_api_path{};
if (dir_entry.is_directory()) {
db_->Get(rocksdb::ReadOptions(), dir_family_,
dir_entry.path().string(), &api_path);
if (api_path.empty()) {
dir_entry.path().string(), &entry_api_path);
if (entry_api_path.empty()) {
const auto cfg = config_.get_encrypt_config();
for (const auto &child_dir_entry :
std::filesystem::directory_iterator(dir_entry.path())) {
if (process_directory_entry(child_dir_entry, cfg, api_path)) {
api_path = utils::path::get_parent_api_path(api_path);
if (process_directory_entry(child_dir_entry, cfg,
entry_api_path)) {
entry_api_path =
utils::path::get_parent_api_path(entry_api_path);
break;
}
}
if (api_path.empty()) {
if (entry_api_path.empty()) {
continue;
}
}
@ -246,16 +248,16 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
dir_entry.path().string(), &api_path_data);
if (api_path_data.empty()) {
const auto cfg = config_.get_encrypt_config();
if (not process_directory_entry(dir_entry, cfg, api_path)) {
if (not process_directory_entry(dir_entry, cfg, entry_api_path)) {
continue;
}
} else {
api_path =
entry_api_path =
json::parse(api_path_data).at("api_path").get<std::string>();
}
}
auto file = create_api_file(api_path, dir_entry.is_directory(),
auto file = create_api_file(entry_api_path, dir_entry.is_directory(),
dir_entry.path().string());
directory_item di{};
@ -464,13 +466,13 @@ auto encrypt_provider::get_filesystem_item(const std::string &api_path,
}
if (directory) {
std::string api_path{};
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &api_path);
if (api_path.empty()) {
std::string db_api_path{};
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &db_api_path);
if (db_api_path.empty()) {
return api_error::item_not_found;
}
fsi.api_parent = utils::path::get_parent_api_path(api_path);
fsi.api_path = api_path;
fsi.api_parent = utils::path::get_parent_api_path(db_api_path);
fsi.api_path = db_api_path;
fsi.directory = true;
fsi.size = 0U;
fsi.source_path = source_path;

View File

@ -961,8 +961,8 @@ void sia_provider::remove_deleted_files() {
if (get_item_meta(iterator->key().ToString(), meta) == api_error::success) {
if (utils::string::to_bool(meta[META_DIRECTORY])) {
bool exists{};
auto res = is_directory(iterator->key().ToString(), exists);
if (res != api_error::success) {
if (is_directory(iterator->key().ToString(), exists) !=
api_error::success) {
continue;
}
if (not exists) {
@ -973,8 +973,7 @@ void sia_provider::remove_deleted_files() {
}
bool exists{};
auto res = is_file(iterator->key().ToString(), exists);
if (res != api_error::success) {
if (is_file(iterator->key().ToString(), exists) != api_error::success) {
continue;
}
if (not exists) {

View File

@ -162,8 +162,8 @@ TEST_F(directory_db_test, get_file) {
api_file file{};
EXPECT_EQ(api_error::success,
db_->get_file("/cow.txt", file, [](api_file &file) {
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
db_->get_file("/cow.txt", file, [](api_file &cur_file) {
EXPECT_STREQ("/cow.txt", cur_file.api_path.c_str());
}));
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
}

View File

@ -89,9 +89,9 @@ TEST(open_file, properly_initializes_state_based_on_chunk_size) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
file_manager::open_file o(1u, 0U, fsi, mp, um);
@ -143,15 +143,15 @@ TEST(open_file, will_change_source_path_if_file_size_is_greater_than_0) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
.WillOnce([&fsi](const std::string &, const std::string &,
const std::string &source_path) -> api_error {
EXPECT_STRNE(fsi.source_path.c_str(), source_path.c_str());
const std::string &source_path2) -> api_error {
EXPECT_STRNE(fsi.source_path.c_str(), source_path2.c_str());
return api_error::success;
});
@ -248,9 +248,9 @@ TEST(open_file, write_with_incomplete_download) {
EXPECT_CALL(um, store_resume)
.Times(2)
.WillRepeatedly([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
.WillRepeatedly([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
data_buffer data = {10, 9, 8};
@ -325,9 +325,9 @@ TEST(open_file, write_new_file) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
std::size_t bytes_written{};
@ -414,9 +414,9 @@ TEST(open_file, write_new_file_multiple_chunks) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
std::size_t bytes_written{};
@ -478,13 +478,13 @@ TEST(open_file, resize_file_to_0_bytes) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_EQ(api_error::success, o.resize(0u));
@ -532,9 +532,9 @@ TEST(open_file, resize_file_by_full_chunk) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_EQ(api_error::success, o.resize(test_chunk_size * 3u));
@ -583,9 +583,9 @@ TEST(open_file, can_add_handle) {
.WillOnce(Return(api_error::success));
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
event_capture capture(
@ -642,9 +642,9 @@ TEST(open_file, can_remove_handle) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
.WillOnce(Return(api_error::success));

View File

@ -461,10 +461,10 @@ TEST(file_manager, download_is_stored_after_write_if_partially_downloaded) {
});
EXPECT_CALL(mp, set_item_meta("/test_write_partial_download.txt", _))
.WillOnce(
[](const std::string &, const api_meta_map &meta) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty()));
[](const std::string &, const api_meta_map &meta2) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty()));
return api_error::success;
});
EXPECT_CALL(mp, upload_file).Times(0u);
@ -611,10 +611,10 @@ TEST(file_manager, upload_occurs_after_write_if_fully_downloaded) {
});
EXPECT_CALL(mp, set_item_meta("/test_write_full_download.txt", _))
.WillOnce(
[](const std::string &, const api_meta_map &meta) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty()));
[](const std::string &, const api_meta_map &meta2) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty()));
return api_error::success;
});
std::size_t bytes_written{};
@ -977,11 +977,11 @@ TEST(file_manager, evict_file_fails_if_file_is_uploading) {
.WillRepeatedly(Return(api_error::success));
EXPECT_CALL(mp, upload_file)
.WillOnce([](const std::string &api_path,
const std::string &source_path,
const std::string &source_path2,
const std::string &encryption_token,
stop_type & /*stop_requested*/) -> api_error {
EXPECT_STREQ("/test_evict.txt", api_path.c_str());
EXPECT_FALSE(source_path.empty());
EXPECT_FALSE(source_path2.empty());
EXPECT_TRUE(encryption_token.empty());
std::this_thread::sleep_for(3s);
return api_error::success;

View File

@ -113,8 +113,8 @@ public:
const get_name_callback &get_name,
const get_token_callback &get_token, api_file &file) {
auto f = std::find_if(list.begin(), list.end(),
[&api_path](const auto &f) -> bool {
return f.api_path == api_path;
[&api_path](const auto &cur_file) -> bool {
return cur_file.api_path == api_path;
});
if (f == list.end()) {
return api_error::item_not_found;

View File

@ -30,8 +30,8 @@ TEST(lock_data, lock_and_unlock) {
EXPECT_EQ(lock_result::success, l.grab_lock());
std::thread([]() {
lock_data l(provider_type::sia, "1");
EXPECT_EQ(lock_result::locked, l.grab_lock(10));
lock_data l2(provider_type::sia, "1");
EXPECT_EQ(lock_result::locked, l2.grab_lock(10));
}).join();
}

View File

@ -25,16 +25,16 @@
namespace repertory {
TEST(packet, encrypt_and_decrypt) {
packet packet;
packet.encode("test");
packet.encrypt("moose");
packet test_packet;
test_packet.encode("test");
test_packet.encrypt("moose");
std::uint32_t size{};
EXPECT_EQ(0, packet.decode(size));
EXPECT_EQ(0, packet.decrypt("moose"));
EXPECT_EQ(0, test_packet.decode(size));
EXPECT_EQ(0, test_packet.decrypt("moose"));
std::string data;
EXPECT_EQ(0, packet.decode(data));
EXPECT_EQ(0, test_packet.decode(data));
EXPECT_STREQ("test", data.c_str());
}