diff --git a/cmake/Modules/FindYAJL.cmake b/cmake/Modules/FindYAJL.cmake new file mode 100644 index 00000000..65e15693 --- /dev/null +++ b/cmake/Modules/FindYAJL.cmake @@ -0,0 +1,31 @@ +# - Find YAJL +# This module finds an installed YAJL package. +# +# It sets the following variables: +# YAJL_FOUND - Set to false, or undefined, if YAJL isn't found. +# YAJL_INCLUDE_DIR - The YAJL include directory. +# YAJL_LIBRARY - The YAJL library to link against. + +FIND_PATH(YAJL_INCLUDE_DIR yajl/yajl_gen.h) +FIND_LIBRARY(YAJL_LIBRARY NAMES yajl) + +IF (YAJL_INCLUDE_DIR AND YAJL_LIBRARY) + SET(YAJL_FOUND TRUE) +ENDIF (YAJL_INCLUDE_DIR AND YAJL_LIBRARY) + +IF (YAJL_FOUND) + + # show which YAJL was found only if not quiet + IF (NOT YAJL_FIND_QUIETLY) + MESSAGE(STATUS "Found YAJL: ${YAJL_LIBRARY}") + ENDIF (NOT YAJL_FIND_QUIETLY) + +ELSE (YAJL_FOUND) + + # fatal error if YAJL is required but not found + IF (YAJL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find YAJL") + ENDIF (YAJL_FIND_REQUIRED) + +ENDIF (YAJL_FOUND) + diff --git a/libgrive/CMakeLists.txt b/libgrive/CMakeLists.txt index 3cc15742..62186017 100644 --- a/libgrive/CMakeLists.txt +++ b/libgrive/CMakeLists.txt @@ -6,6 +6,7 @@ find_package(LibGcrypt REQUIRED) find_package(JSONC REQUIRED) find_package(CURL REQUIRED) find_package(EXPAT REQUIRED) +find_package(YAJL REQUIRED) find_package(Boost 1.40.0 COMPONENTS program_options filesystem unit_test_framework system REQUIRED) find_package(BFD) find_package(CppUnit) @@ -41,6 +42,7 @@ include_directories( ${libgrive_SOURCE_DIR}/src ${libgrive_SOURCE_DIR}/test ${GDBM_INCLUDE_DIR} + ${YAJL_INCLUDE_DIR} ${OPT_INCS} ) @@ -80,7 +82,7 @@ add_definitions( add_library( grive STATIC ${LIBGRIVE_SRC} ${OPT_SRC} ) target_link_libraries( grive - yajl + ${YAJL_LIBRARY} ${CURL_LIBRARIES} ${JSONC_LIBRARY} ${LIBGCRYPT_LIBRARIES} diff --git a/libgrive/src/protocol/AuthAgent.cc b/libgrive/src/protocol/AuthAgent.cc index 745f274c..b878ea0a 100644 --- a/libgrive/src/protocol/AuthAgent.cc +++ b/libgrive/src/protocol/AuthAgent.cc @@ -139,7 +139,7 @@ bool AuthAgent::CheckRetry( long response ) // HTTP 500 and 503 should be temperory. just wait a bit and retry if ( response == 500 || response == 503 ) { - Log( "resquest failed due to temperory error: %1%. retrying in 5 seconds", + Log( "request failed due to temperory error: %1%. retrying in 5 seconds", response, log::warning ) ; os::Sleep( 5 ) ; @@ -149,7 +149,7 @@ bool AuthAgent::CheckRetry( long response ) // HTTP 401 Unauthorized. the auth token has been expired. refresh it else if ( response == 401 ) { - Log( "resquest failed due to auth token expired: %1%. refreshing token", + Log( "request failed due to auth token expired: %1%. refreshing token", response, log::warning ) ; m_auth.Refresh() ;