main/*: remove ubports leftovers

Related: #357
This commit is contained in:
Oliver Smith 2019-09-16 22:28:58 +02:00
parent 1ff97c82e9
commit 0d9b581c86
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
13 changed files with 0 additions and 1505 deletions

View file

@ -1,31 +0,0 @@
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=cmake-extras
pkgver=0_git20190219
_commit="365500ed7903180d034b64e06d0c0cdd9de2162f"
pkgrel=0
pkgdesc="A collection of add-ons for the CMake build tool"
url="https://github.com/ubports/cmake-extras"
arch="noarch"
license="GPL-3.0"
depends="cmake"
makedepends="cmake"
options="!check" # No testsuite
source="$pkgname-$_commit.tar.gz::https://github.com/ubports/$pkgname/archive/$_commit.tar.gz
Use_gtest_cmake_from_mir.patch
qmlplugindump_path.patch"
builddir="$srcdir/$pkgname-$_commit"
build() {
cd "$builddir"
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
make
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
sha512sums="79c8224fd96368ca68534c90178c16178e668bc0655ea42d139fcee4a995c92bc9b6c20f2b6cd0df2bc38cc009f9e15306513d06a3f095c5f344994cae4cb01c cmake-extras-365500ed7903180d034b64e06d0c0cdd9de2162f.tar.gz
996334490e062868b2dd24a0d2d688d95877343ae2db6a06efc580d14ffe1d00f0c9277be0929b9c7c859aef2dea0be68ddc49a7495ad16eaa0a156838f8bca9 Use_gtest_cmake_from_mir.patch
e55bd3ae7372b33534d239f7e959af0eba5687aba0386613381e4f9fc840f89213f5ae92544b7e969943d46e815d49c66fd24c29c44fd4166bb3a6bf81e1ac7e qmlplugindump_path.patch"

View file

@ -1,171 +0,0 @@
diff --git a/src/GMock/GMockConfig.cmake b/src/GMock/GMockConfig.cmake
index 2078030..77ba4a3 100644
--- a/src/GMock/GMockConfig.cmake
+++ b/src/GMock/GMockConfig.cmake
@@ -1,92 +1,77 @@
-# Copyright (C) 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Build with system gmock and embedded gtest
-#
-# Usage:
-#
-# find_package(GMock)
-#
-# ...
-#
-# target_link_libraries(
-# my-target
-# ${GTEST_BOTH_LIBRARIES}
-# )
-#
-# NOTE: Due to the way this package finder is implemented, do not attempt
-# to find the GMock package more than once.
-
-find_package(Threads)
-
-if (EXISTS "/usr/src/googletest")
- # As of version 1.8.0
- set(GMOCK_SOURCE_DIR "/usr/src/googletest/googlemock" CACHE PATH "gmock source directory")
- set(GMOCK_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/include" CACHE PATH "gmock source include directory")
- set(GTEST_INCLUDE_DIRS "/usr/src/googletest/googletest/include" CACHE PATH "gtest source include directory")
+include(FindPackageHandleStandardArgs)
+
+find_package(GTest)
+
+pkg_check_modules (GTEST REQUIRED "gtest >= 1.8.0")
+pkg_check_modules (GTEST_MAIN REQUIRED "gtest_main >= 1.8.0")
+if (GTEST_FOUND AND GTEST_MAIN_FOUND)
+ set(GTEST_LIBRARY ${GTEST_LIBRARIES})
+ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES})
+ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
+endif()
+
+if (NOT GTEST_FOUND)
+ include(ExternalProject)
+
+ find_path(GTEST_ROOT
+ NAMES CMakeLists.txt
+ PATHS /usr/src/gtest /usr/src/googletest/googletest/
+ DOC "Path to GTest CMake project")
+
+ ExternalProject_Add(GTest PREFIX ./gtest
+ SOURCE_DIR ${GTEST_ROOT}
+ CMAKE_ARGS
+ -DCMAKE_CXX_COMPILER_WORKS=1
+ -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ INSTALL_COMMAND true
+ BUILD_BYPRODUCTS
+ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GTest-build/libgtest.a
+ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GTest-build/libgtest_main.a
+ ${CMAKE_CURRENT_BINARY_DIR}/gtest/src/GMock-build/libgmock.a)
+
+ ExternalProject_Get_Property(GTest binary_dir)
+
+ add_library(gtest UNKNOWN IMPORTED)
+ set_target_properties(gtest PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest.a)
+ add_dependencies(gtest GTest)
+ set(GTEST_LIBRARY "gtest")
+
+ add_library(gtest_main UNKNOWN IMPORTED)
+ set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest_main.a)
+ add_dependencies(gtest_main GTest)
+ set(GTEST_MAIN_LIBRARY "gtest_main")
+
+ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
+ find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h)
+ find_package_handle_standard_args(GTest GTEST_LIBRARY GTEST_BOTH_LIBRARIES GTEST_INCLUDE_DIRS)
+endif()
+
+find_file(GMOCK_SOURCE
+ NAMES gmock-all.cc
+ DOC "GMock source"
+ PATHS /usr/src/googletest/googlemock/src/ /usr/src/gmock/ /usr/src/gmock/src)
+
+if (EXISTS ${GMOCK_SOURCE})
+ find_path(GMOCK_INCLUDE_DIR gmock/gmock.h PATHS /usr/src/googletest/googlemock/include)
+
+ add_library(GMock STATIC ${GMOCK_SOURCE})
+
+ if (EXISTS /usr/src/googletest/googlemock/src)
+ set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/googletest/googlemock")
+ endif()
+
+ if (EXISTS /usr/src/gmock/src)
+ set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/gmock")
+ endif()
+
+ find_package_handle_standard_args(GMock DEFAULT_MSG GMOCK_INCLUDE_DIR)
+
+ set(GMOCK_LIBRARY GMock)
else()
- set(GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
- set(GMOCK_INCLUDE_DIRS "/usr/include" CACHE PATH "gmock source include directory")
- set(GTEST_INCLUDE_DIRS "/usr/include" CACHE PATH "gtest source include directory")
+ # Assume gmock is no longer source, we'll find out soon enough if that's wrong
+ add_custom_target(GMock)
+ string(REPLACE gtest gmock GMOCK_LIBRARY ${GTEST_LIBRARY})
endif()
-# We add -g so we get debug info for the gtest stack frames with gdb.
-# The warnings are suppressed so we get a noise-free build for gtest and gmock if the caller
-# has these warnings enabled.
-set(findgmock_cxx_flags "${CMAKE_CXX_FLAGS} -g -Wno-old-style-cast -Wno-missing-field-initializers -Wno-ctor-dtor-privacy -Wno-switch-default")
-
-set(findgmock_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/gmock")
-set(findgmock_gtest_lib "${findgmock_bin_dir}/gtest/libgtest.a")
-set(findgmock_gtest_main_lib "${findgmock_bin_dir}/gtest/libgtest_main.a")
-set(findgmock_gmock_lib "${findgmock_bin_dir}/libgmock.a")
-set(findgmock_gmock_main_lib "${findgmock_bin_dir}/libgmock_main.a")
-
-include(ExternalProject)
-ExternalProject_Add(GMock SOURCE_DIR "${GMOCK_SOURCE_DIR}"
- BINARY_DIR "${findgmock_bin_dir}"
- BUILD_BYPRODUCTS "${findgmock_gtest_lib}"
- "${findgmock_gtest_main_lib}"
- "${findgmock_gmock_lib}"
- "${findgmock_gmock_main_lib}"
- INSTALL_COMMAND ""
- CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${findgmock_cxx_flags}")
-
-add_library(gtest INTERFACE)
-target_include_directories(gtest INTERFACE ${GTEST_INCLUDE_DIRS})
-target_link_libraries(gtest INTERFACE ${findgmock_gtest_lib} ${CMAKE_THREAD_LIBS_INIT})
-add_dependencies(gtest GMock)
-
-add_library(gtest_main INTERFACE)
-target_include_directories(gtest_main INTERFACE ${GTEST_INCLUDE_DIRS})
-target_link_libraries(gtest_main INTERFACE ${findgmock_gtest_main_lib} gtest)
-
-add_library(gmock INTERFACE)
-target_include_directories(gmock INTERFACE ${GMOCK_INCLUDE_DIRS})
-target_link_libraries(gmock INTERFACE ${findgmock_gmock_lib} gtest)
-
-add_library(gmock_main INTERFACE)
-target_include_directories(gmock_main INTERFACE ${GMOCK_INCLUDE_DIRS})
-target_link_libraries(gmock_main INTERFACE ${findgmock_gmock_main_lib} gmock)
-
-set(GTEST_LIBRARIES gtest)
-set(GTEST_MAIN_LIBRARIES gtest_main)
-set(GMOCK_LIBRARIES gmock gmock_main)
-set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
-
-unset(findgmock_cxx_flags)
-unset(findgmock_bin_dir)
-unset(findgmock_gtest_lib)
-unset(findgmock_gtest_main_lib)
-unset(findgmock_gmock_lib)
-unset(findgmock_gmock_main_lib)
+set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY})

View file

@ -1,13 +0,0 @@
diff --git a/src/QmlPlugins/QmlPluginsConfig.cmake b/src/QmlPlugins/QmlPluginsConfig.cmake
index f563330..7e326bf 100644
--- a/src/QmlPlugins/QmlPluginsConfig.cmake
+++ b/src/QmlPlugins/QmlPluginsConfig.cmake
@@ -2,7 +2,7 @@
# target before loading this plugin.
if(NOT TARGET qmlplugindump)
- find_program(qmlplugindump_exe qmlplugindump)
+ find_program(qmlplugindump_exe qmlplugindump HINTS /usr/lib/qt5/bin/)
if(NOT qmlplugindump_exe)
msg(FATAL_ERROR "Could not locate qmlplugindump.")

View file

@ -1,44 +0,0 @@
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=dbus-cpp
pkgver=5.0.1_git20180409
pkgrel=2
_commit="967dc1caf0efe0a1286c308e8e8dd1bf7da5f3ee"
pkgdesc="A header-only dbus-binding leveraging C++-11"
url="https://code.launchpad.net/dbus-cpp"
arch="x86_64"
license="LGPL3"
depends="dbus libxml2 boost properties-cpp"
depends_dev="boost-dev"
makedepends="$depends_dev cmake cmake-extras libxml2-dev properties-cpp-dev dbus-dev linux-headers process-cpp-dev gtest-dev gmock"
install=""
subpackages="$pkgname-dev"
source="https://github.com/lib-cpp/dbus-cpp/archive/$_commit.tar.gz
boost_io_context.patch" # https://github.com/lib-cpp/dbus-cpp/pull/2
builddir="$srcdir/$pkgname-$_commit"
options="!check" # 53% tests passed, 7 tests failed out of 15
build() {
mkdir "$builddir"/build
cd "$builddir"/build
cmake .. \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DDBUS_CPP_VERSION_MAJOR=5 \
-DDBUS_CPP_VERSION_MINOR=0 \
-DDBUS_CPP_VERSION_PATCH=0
make
}
check() {
cd "$builddir"/build
make test
}
package() {
cd "$builddir"/build
make DESTDIR="$pkgdir" install
}
sha512sums="6db299307eb966600d488aa31db2814095c562c9c62a46b614ec1fa361f3c17900bbbe3da021629e6b7279ad99bf193393772302bfc8f6b5ea80ef3497fb7f46 967dc1caf0efe0a1286c308e8e8dd1bf7da5f3ee.tar.gz
55862c347f2aeabd00b3d547b34c7b3c5bbbb3f40a76cb2e20711c6168b4780db36436f631cf33f1b6ff48f3e6a83480db1df69cafa7e8a25e5f06df9ea53829 boost_io_context.patch"

View file

@ -1,25 +0,0 @@
diff --git a/include/core/dbus/asio/executor.h b/include/core/dbus/asio/executor.h
index d1f043e..505a55b 100644
--- a/include/core/dbus/asio/executor.h
+++ b/include/core/dbus/asio/executor.h
@@ -18,18 +18,12 @@
#ifndef CORE_DBUS_ASIO_EXECUTOR_H_
#define CORE_DBUS_ASIO_EXECUTOR_H_
+#include <boost/asio/io_service.hpp>
+
#include <core/dbus/bus.h>
#include <core/dbus/executor.h>
#include <core/dbus/visibility.h>
-namespace boost
-{
-namespace asio
-{
-class io_service;
-}
-}
-
namespace core
{
namespace dbus

View file

@ -1,591 +0,0 @@
From 137154eacd98118beef0664d47a2eae82eefd1f0 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sat, 9 Feb 2019 01:31:42 +0100
Subject: [PATCH 1/3] Port to new jsoncpp API
---
tests/http_client_load_test.cpp | 14 +++--
tests/http_client_test.cpp | 80 +++++++++++++++++-----------
tests/http_streaming_client_test.cpp | 75 +++++++++++++++-----------
3 files changed, 99 insertions(+), 70 deletions(-)
diff --git a/tests/http_client_load_test.cpp b/tests/http_client_load_test.cpp
index 79d125b..105c316 100644
--- a/tests/http_client_load_test.cpp
+++ b/tests/http_client_load_test.cpp
@@ -132,10 +132,6 @@ TEST_F(HttpClientLoadTest, async_head_request_for_existing_resource_succeeds)
auto response_verifier = [](const http::Response& response) -> bool
{
- // All endpoint data on httpbin.org is JSON encoded.
- json::Value root;
- json::Reader reader;
-
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
@@ -159,12 +155,13 @@ TEST_F(HttpClientLoadTest, async_get_request_for_existing_resource_succeeds)
{
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(url, root["url"].asString());
@@ -191,12 +188,13 @@ TEST_F(HttpClientLoadTest, async_post_request_for_existing_resource_succeeds)
{
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(payload, root["data"].asString());
diff --git a/tests/http_client_test.cpp b/tests/http_client_test.cpp
index dd37d4f..e7cdd73 100644
--- a/tests/http_client_test.cpp
+++ b/tests/http_client_test.cpp
@@ -144,7 +144,8 @@ TEST(HttpClient, get_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -152,7 +153,7 @@ TEST(HttpClient, get_request_for_existing_resource_succeeds)
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(url, root["url"].asString());
}
@@ -174,7 +175,8 @@ TEST(HttpClient, get_request_with_custom_headers_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -183,7 +185,7 @@ TEST(HttpClient, get_request_with_custom_headers_for_existing_resource_succeeds)
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
auto headers = root["headers"];
@@ -207,7 +209,8 @@ TEST(HttpClient, empty_header_values_are_handled_correctly)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -216,7 +219,7 @@ TEST(HttpClient, empty_header_values_are_handled_correctly)
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
auto headers = root["headers"];
EXPECT_EQ(std::string{}, headers["Empty"].asString());
@@ -240,7 +243,8 @@ TEST(HttpClient, get_request_for_existing_resource_guarded_by_basic_auth_succeed
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -248,7 +252,7 @@ TEST(HttpClient, get_request_for_existing_resource_guarded_by_basic_auth_succeed
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -274,7 +278,8 @@ TEST(HttpClient, DISABLED_get_request_for_existing_resource_guarded_by_digest_au
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -282,7 +287,7 @@ TEST(HttpClient, DISABLED_get_request_for_existing_resource_guarded_by_digest_au
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -323,12 +328,13 @@ TEST(HttpClient, async_get_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(url, root["url"].asString());
@@ -362,7 +368,8 @@ TEST(HttpClient, async_get_request_for_existing_resource_guarded_by_basic_authen
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
std::promise<core::net::http::Response> promise;
auto future = promise.get_future();
@@ -392,7 +399,7 @@ TEST(HttpClient, async_get_request_for_existing_resource_guarded_by_basic_authen
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -416,7 +423,8 @@ TEST(HttpClient, post_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter);
@@ -424,7 +432,7 @@ TEST(HttpClient, post_request_for_existing_resource_succeeds)
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(payload, root["data"].asString());
}
@@ -451,10 +459,11 @@ TEST(HttpClient, post_form_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ("test", root["form"]["test"].asString());
}
@@ -476,12 +485,13 @@ TEST(HttpClient, post_request_for_file_with_large_chunk_succeeds)
size);
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
auto response = request->execute(default_progress_reporter);
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -498,12 +508,13 @@ TEST(HttpClient, put_request_for_existing_resource_succeeds)
value.size());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
auto response = request->execute(default_progress_reporter);
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(payload.str(), root["data"].asString());
}
@@ -525,12 +536,13 @@ TEST(HttpClient, put_request_for_file_with_large_chunk_succeeds)
size);
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
auto response = request->execute(default_progress_reporter);
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -542,12 +554,13 @@ TEST(HttpClient, del_request_for_existing_resource_succeeds)
auto request = client->del(http::Request::Configuration::from_uri_as_string(url));
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
auto response = request->execute(default_progress_reporter);
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -615,7 +628,8 @@ const char* submit() { return "/v1/submit?key=net-cpp-testing"; }
// for API and endpoint documentation.
TEST(HttpClient, DISABLED_search_for_location_on_mozillas_location_service_succeeds)
{
- json::FastWriter writer;
+ json::StreamWriterBuilder wbuilder;
+ std::unique_ptr<json::StreamWriter> writer(wbuilder.newStreamWriter());
json::Value search;
json::Value cell;
cell["radio"] = "umts";
@@ -642,16 +656,17 @@ TEST(HttpClient, DISABLED_search_for_location_on_mozillas_location_service_succe
std::string(com::mozilla::services::location::host) +
com::mozilla::services::location::resources::v1::search();
auto request = client->post(http::Request::Configuration::from_uri_as_string(url),
- writer.write(search),
+ Json::writeString(wbuilder, search),
http::ContentType::json);
auto response = request->execute(default_progress_reporter);
- json::Reader reader;
+ json::CharReaderBuilder rbuilder;
+ std::unique_ptr<Json::CharReader> reader(rbuilder.newCharReader());
json::Value result;
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, result));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &result, NULL));
// We cannot be sure that the server has got information for the given
// cell and wifi ids. For that, we disable the test.
@@ -693,13 +708,14 @@ TEST(HttpClient, DISABLED_submit_of_location_on_mozillas_location_service_succee
submit["items"].append(item);
- json::FastWriter writer;
+ json::StreamWriterBuilder wbuilder;
+ std::unique_ptr<json::StreamWriter> writer(wbuilder.newStreamWriter());
auto client = http::make_client();
auto url =
std::string(com::mozilla::services::location::host) +
com::mozilla::services::location::resources::v1::submit();
auto request = client->post(http::Request::Configuration::from_uri_as_string(url),
- writer.write(submit),
+ Json::writeString(wbuilder, submit),
http::ContentType::json);
auto response = request->execute(default_progress_reporter);
diff --git a/tests/http_streaming_client_test.cpp b/tests/http_streaming_client_test.cpp
index 68ad100..7e9faa1 100644
--- a/tests/http_streaming_client_test.cpp
+++ b/tests/http_streaming_client_test.cpp
@@ -156,7 +156,8 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -164,7 +165,7 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_succeeds)
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(url, root["url"].asString());
}
@@ -191,7 +192,8 @@ TEST(StreamingHttpClient, get_request_with_custom_headers_for_existing_resource_
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -200,7 +202,7 @@ TEST(StreamingHttpClient, get_request_with_custom_headers_for_existing_resource_
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
auto headers = root["headers"];
@@ -229,7 +231,8 @@ TEST(StreamingHttpClient, empty_header_values_are_handled_correctly)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -238,7 +241,7 @@ TEST(StreamingHttpClient, empty_header_values_are_handled_correctly)
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
auto headers = root["headers"];
EXPECT_EQ(std::string{}, headers["Empty"].asString());
@@ -267,7 +270,8 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_guarded_by_basic_aut
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -275,7 +279,7 @@ TEST(StreamingHttpClient, get_request_for_existing_resource_guarded_by_basic_aut
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -306,7 +310,8 @@ TEST(StreamingHttpClient, DISABLED_get_request_for_existing_resource_guarded_by_
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -314,7 +319,7 @@ TEST(StreamingHttpClient, DISABLED_get_request_for_existing_resource_guarded_by_
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -361,12 +366,13 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(url, root["url"].asString());
@@ -405,7 +411,8 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_guarded_by_bas
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
std::promise<core::net::http::Response> promise;
auto future = promise.get_future();
@@ -436,7 +443,7 @@ TEST(StreamingHttpClient, async_get_request_for_existing_resource_guarded_by_bas
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// We expect authentication to work.
EXPECT_TRUE(root["authenticated"].asBool());
// With the correct user id
@@ -465,7 +472,8 @@ TEST(StreamingHttpClient, post_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
// We finally execute the query synchronously and story the response.
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
@@ -473,7 +481,7 @@ TEST(StreamingHttpClient, post_request_for_existing_resource_succeeds)
// We expect the query to complete successfully
EXPECT_EQ(core::net::http::Status::ok, response.status);
// Parsing the body of the response as JSON should succeed.
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
// The url field of the payload should equal the original url we requested.
EXPECT_EQ(payload, root["data"].asString());
}
@@ -505,10 +513,11 @@ TEST(StreamingHttpClient, post_form_request_for_existing_resource_succeeds)
// All endpoint data on httpbin.org is JSON encoded.
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ("test", root["form"]["test"].asString());
}
@@ -536,10 +545,11 @@ TEST(StreamingHttpClient, post_request_for_file_with_large_chunk_succeeds)
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -569,10 +579,11 @@ TEST(StreamingHttpClient, post_request_for_file_with_large_chunk_with_read_callb
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -596,10 +607,11 @@ TEST(StreamingHttpClient, put_request_for_existing_resource_succeeds)
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(payload.str(), root["data"].asString());
}
@@ -627,10 +639,11 @@ TEST(StreamingHttpClient, put_request_for_file_with_large_chunk_succeeds)
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -660,10 +673,11 @@ TEST(StreamingHttpClient, put_request_for_file_with_large_chunk_with_read_callba
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
@@ -682,10 +696,11 @@ TEST(StreamingHttpClient, del_request_for_existing_resource_succeeds)
auto response = request->execute(default_progress_reporter, dh->to_data_handler());
json::Value root;
- json::Reader reader;
+ json::CharReaderBuilder builder;
+ std::unique_ptr<json::CharReader> reader(builder.newCharReader());
EXPECT_EQ(core::net::http::Status::ok, response.status);
- EXPECT_TRUE(reader.parse(response.body, root));
+ EXPECT_TRUE(reader->parse(response.body.c_str(), response.body.c_str() + response.body.size(), &root, NULL));
EXPECT_EQ(url, root["url"].asString());
}
--
2.20.1

View file

@ -1,44 +0,0 @@
From e028baabc3627d5d13b9a9db2d096990ce7b7459 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sat, 9 Feb 2019 01:32:13 +0100
Subject: [PATCH 2/3] Don't bundle httpbin, don't fail silently
---
tests/CMakeLists.txt | 4 ----
tests/httpbin.h.in | 2 +-
tests/httpbin.tar.bz2 | Bin 15383 -> 0 bytes
3 files changed, 1 insertion(+), 5 deletions(-)
delete mode 100644 tests/httpbin.tar.bz2
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a21e322..0fcea99 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -14,10 +14,6 @@
#
# Authored by: Thomas Voss <thomas.voss@canonical.com>
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E tar xf ${CMAKE_CURRENT_SOURCE_DIR}/httpbin.tar.bz2
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/httpbin.h.in
${CMAKE_CURRENT_BINARY_DIR}/httpbin.h
diff --git a/tests/httpbin.h.in b/tests/httpbin.h.in
index 30703a2..0010068 100644
--- a/tests/httpbin.h.in
+++ b/tests/httpbin.h.in
@@ -42,7 +42,7 @@ struct Instance
Instance()
: server
{
- core::posix::exec("/usr/bin/python", {"@CMAKE_CURRENT_BINARY_DIR@/httpbin/run.py"}, {}, core::posix::StandardStream::stdout | core::posix::StandardStream::stderr)
+ core::posix::exec("/usr/bin/python3", {"-c", "from httpbin import app; app.run()"}, {}, core::posix::StandardStream::stdout /*| core::posix::StandardStream::stderr*/)
}
{
std::this_thread::sleep_for(std::chrono::milliseconds{1000});
--
2.20.1

View file

@ -1,30 +0,0 @@
From 8567cc6014399259bf6efa5574f0ac7e98e70094 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sat, 9 Feb 2019 01:32:44 +0100
Subject: [PATCH 3/3] Set the Content-Type header on POST, otherwise stuff
breaks
---
src/core/net/http/impl/curl/client.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/core/net/http/impl/curl/client.cpp b/src/core/net/http/impl/curl/client.cpp
index ba68cda..f49ce67 100644
--- a/src/core/net/http/impl/curl/client.cpp
+++ b/src/core/net/http/impl/curl/client.cpp
@@ -158,9 +158,12 @@ std::shared_ptr<http::impl::curl::Request> http::impl::curl::Client::post_impl(
const std::string& ct)
{
::curl::easy::Handle handle;
+ http::Header ctheader;
+ ctheader.set("Content-Type", ct);
handle.method(http::Method::post)
.url(configuration.uri.c_str())
.header(configuration.header)
+ .header(ctheader)
.post_data(payload.c_str(), ct);
handle.set_option(::curl::Option::ssl_verify_host,
--
2.20.1

View file

@ -1,42 +0,0 @@
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=net-cpp
pkgver=2.2.1_git20180409
_commit="01fc17e8ce09bcee37e83422520e4c3f26e8c8dd"
pkgrel=0
pkgdesc="A simple yet beautiful networking API for C++11"
url="https://launchpad.net/process-cpp"
arch="x86_64"
license="LGPL3 GPL3"
makedepends="cmake cmake-extras boost-dev curl-dev"
checkdepends="gtest-dev gmock process-cpp-dev properties-cpp-dev jsoncpp-dev py3-httpbin"
subpackages="$pkgname-dev"
source="https://github.com/lib-cpp/net-cpp/archive/$_commit.tar.gz
0001-Port-to-new-jsoncpp-API.patch
0002-Don-t-bundle-httpbin-don-t-fail-silently.patch
0003-Set-the-Content-Type-header-on-POST-otherwise-stuff-.patch"
builddir="$srcdir/$pkgname-$_commit"
build() {
mkdir "$builddir"/build
cd "$builddir"/build
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release
make
}
check() {
cd "$builddir"/build
env CTEST_OUTPUT_ON_FAILURE=1 make test
}
package() {
cd "$builddir"/build
make DESTDIR="$pkgdir/" install
}
sha512sums="b8aa59f6fdb6f2358a7f78845acf1af866186995613daa10a04497c3072dfbc034a552561d76c2d91c6e55b98c41bbf069052ca459531538ada4032a38d09afb 01fc17e8ce09bcee37e83422520e4c3f26e8c8dd.tar.gz
2893f20ef1028d016fccf77af6c24dbe1a7967a9e03cadbccc3cde18a0a0eb3b1f8ffb1f1b3afc7d9e4c046fb3b5d6cf907023638dcdb37273dd514c9139c99e 0001-Port-to-new-jsoncpp-API.patch
ba4c2737504ddf9475a8a4c01fe31756dbc32d3bfb00c1a10e342cd2f7989cc87466c921d8430ff7003ebf48369d5daeb0ebeefc3d2b1955142d6a35681840e7 0002-Don-t-bundle-httpbin-don-t-fail-silently.patch
357669776625f4476feaf76336a976c596572028e165d54eb5078baca42c2f8304e60a3898f4ce0b4494f9a40d303720e539a0da281f5f33159b8576b89d7d71 0003-Set-the-Content-Type-header-on-POST-otherwise-stuff-.patch"

View file

@ -1,55 +0,0 @@
From 9e25c80e0e45c21dedc785019be95c0bbff4174d Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sun, 30 Dec 2018 18:01:32 +0100
Subject: [PATCH] Musl libc fixes
---
include/core/posix/standard_stream.h | 5 +++++
src/CMakeLists.txt | 1 +
src/core/posix/signal.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/core/posix/standard_stream.h b/include/core/posix/standard_stream.h
index f50a9b7..1927fa8 100644
--- a/include/core/posix/standard_stream.h
+++ b/include/core/posix/standard_stream.h
@@ -23,6 +23,11 @@
#include <cstdint>
+// Musl uses "#define stdin (stdin)", so the enum declaration fails with a syntax error
+#undef stdin
+#undef stdout
+#undef stderr
+
namespace core
{
namespace posix
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 063ece1..2a9dc15 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,6 +45,7 @@ target_link_libraries(
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ execinfo
)
# We compile with all symbols visible by default. For the shipping library, we strip
diff --git a/src/core/posix/signal.cpp b/src/core/posix/signal.cpp
index 9c80f21..ce8bbc1 100644
--- a/src/core/posix/signal.cpp
+++ b/src/core/posix/signal.cpp
@@ -151,7 +151,7 @@ public:
{
auto result = ::read(scope.signal_fd, signal_info, sizeof(signal_info));
- for (uint i = 0; i < result / sizeof(signalfd_siginfo); i++)
+ for (unsigned int i = 0; i < result / sizeof(signalfd_siginfo); i++)
{
if (has(static_cast<core::posix::Signal>(signal_info[i].ssi_signo)))
{
--
2.20.1

View file

@ -1,41 +0,0 @@
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=process-cpp
pkgver=2.0.1_git20180409
pkgrel=2
_commit="2923b597f6fc5b49133be8c4f2ba3cbaacdb9540"
pkgdesc="C++11 library for handling processes"
url="https://launchpad.net/process-cpp"
arch="x86_64"
license="LGPL3"
depends="boost properties-cpp"
makedepends="boost-dev cmake cmake-extras doxygen properties-cpp-dev libexecinfo-dev musl-dev"
checkdepends="gtest-dev gmock"
install=""
subpackages="$pkgname-dev"
source="https://github.com/lib-cpp/process-cpp/archive/$_commit.tar.gz
0001-Musl-libc-fixes.patch" # https://github.com/lib-cpp/process-cpp/pull/1
builddir="$srcdir/$pkgname-$_commit"
build() {
mkdir "$builddir"/build
cd "$builddir"/build
cmake .. \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DPROCESS_CPP_ENABLE_DOC_GENERATION=no
make
}
check() {
cd "$builddir"/build
make test
}
package() {
cd "$builddir"/build
make DESTDIR="$pkgdir/" install
}
sha512sums="8787f9bbfb157c30c2a6ff072735344104f609ebae3385b41539fa7b24aa45eff5465ae8edf0479030ef7061256e7f1f7354621b172fa6ba196d59d275f2fad6 2923b597f6fc5b49133be8c4f2ba3cbaacdb9540.tar.gz
97b2a54e52b8f6a1839cfcdc6fb401768d731bacbe6bc920b511777e72806d844cded9ad9222b570e46cdbf692def363128c4cb4e2e291fcd4f66c081ad0c5cd 0001-Musl-libc-fixes.patch"

View file

@ -1,39 +0,0 @@
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=properties-cpp
pkgver=0.0.2_git20180409
_commit="45863e849b39c4921d6553e6d27e267a96ac7d77"
pkgrel=0
pkgdesc="A very simple convenience library for handling properties and signals in C++11"
url="https://launchpad.net/properties-cpp"
arch="noarch"
license="LGPL3"
makedepends="cmake cmake-extras"
checkdepends="gtest-dev gtest"
subpackages="$pkgname-dev"
source="$pkgname-$_commit.tar.gz::https://github.com/lib-cpp/properties-cpp/archive/$_commit.tar.gz
fixes.patch" # https://github.com/lib-cpp/properties-cpp/pull/1
builddir="$srcdir/$pkgname-$_commit"
build() {
mkdir -p "$builddir/build"
cd "$builddir/build"
cmake .. \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release
make
}
check() {
cd "$builddir"/build
make test
}
package() {
cd "$builddir/build"
make DESTDIR="$pkgdir/" install
}
sha512sums="5697b9acacb63b801ef531a3741655e67896604c5150a754d9e11f87898ee564a2707fcb8346119b7081ae725e8bbfa671e537e4985a061da7161ff7b12d5985 properties-cpp-45863e849b39c4921d6553e6d27e267a96ac7d77.tar.gz
298ccdf5222f7aad4bf25aa3d18cd4bf552c67db8a98bf473c367857b355457d38a42fae8571061f94596750856a841f2cf03d2ba11bf014a92f82ba19fd74a9 fixes.patch"

View file

@ -1,379 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c7394e..728b40a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,6 @@ project(properties-cpp)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-include(cmake/EnableCoverageReport.cmake)
include(cmake/PrePush.cmake)
include(GNUInstallDirs)
@@ -42,4 +41,5 @@ add_subdirectory(data)
add_subdirectory(include)
add_subdirectory(tests)
+# find_package(CoverageReport)
# enable_coverage_report(posix_process_test linux_process_test)
diff --git a/cmake/EnableCoverageReport.cmake b/cmake/EnableCoverageReport.cmake
deleted file mode 100644
index b109ad4..0000000
--- a/cmake/EnableCoverageReport.cmake
+++ /dev/null
@@ -1,153 +0,0 @@
-# - Creates a special coverage build type and target on GCC.
-#
-# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
-# for selected targets. Optional arguments to this function are used to filter
-# unwanted results using globbing expressions. Moreover targets with tests for
-# the source code can be specified to trigger regenerating the report if the
-# test has changed
-#
-# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
-#
-# To generate a coverage report first build the project with
-# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
-#
-# The coverage report is based on gcov. Depending on the availability of lcov
-# a HTML report will be generated and/or an XML report of gcovr is found.
-# The generated coverage target executes all found solutions. Special targets
-# exist to create e.g. only the xml report: coverage-xml.
-#
-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
-#
-# This program is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General
-# Public License as published by the Free Software Foundation;
-# either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-
-INCLUDE(ParseArguments)
-
-FIND_PACKAGE(Lcov)
-FIND_PACKAGE(gcovr)
-
-FUNCTION(ENABLE_COVERAGE_REPORT)
-
- # argument parsing
- PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
-
- SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
- SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
- SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
- SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
- SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
-
- # decide if there is any tool to create coverage data
- SET(TOOL_FOUND FALSE)
- IF(LCOV_FOUND OR GCOVR_FOUND)
- SET(TOOL_FOUND TRUE)
- ENDIF()
- IF(NOT TOOL_FOUND)
- MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
- ENDIF()
-
- STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
- IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
-
- MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
-
- # create coverage build type
- SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
- SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
- SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
-
- # instrument targets
- SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
- LINK_FLAGS --coverage)
-
- # html report
- IF (LCOV_FOUND)
-
- MESSAGE(STATUS "Enabling HTML coverage report")
-
- # set up coverage target
-
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
- COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMENT "Collecting coverage data"
- DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
- VERBATIM)
-
- # filter unwanted stuff
- LIST(LENGTH ARG_FILTER FILTER_LENGTH)
- IF(${FILTER_LENGTH} GREATER 0)
- SET(FILTER COMMAND ${LCOV_EXECUTABLE})
- FOREACH(F ${ARG_FILTER})
- SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
- ENDFOREACH()
- SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
- ELSE()
- SET(FILTER "")
- ENDIF()
-
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
- COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
- ${FILTER}
- DEPENDS ${COVERAGE_RAW_FILE}
- COMMENT "Filtering recorded coverage data for project-relevant entries"
- VERBATIM)
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
- COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
- DEPENDS ${COVERAGE_FILTERED_FILE}
- COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
- VERBATIM)
-
- ADD_CUSTOM_TARGET(coverage-html
- DEPENDS ${COVERAGE_REPORT_DIR})
-
- ENDIF()
-
- # xml coverage report
- IF(GCOVR_FOUND)
-
- MESSAGE(STATUS "Enabling XML coverage report")
-
- # gcovr cannot write directly to a file so the execution needs to
- # be wrapped in a cmake file that generates the file output
- FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
- "SET(ENV{LANG} en)\n")
- FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
- "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" --exclude=tests.* --exclude=obj-.* --exclude=cmake.* -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
-
- ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
- COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
- COMMENT "Generating coverage XML report"
- VERBATIM)
-
- ADD_CUSTOM_TARGET(coverage-xml
- DEPENDS ${COVERAGE_XML_FILE})
-
- ENDIF()
-
- # provide a global coverage target executing both steps if available
- SET(GLOBAL_DEPENDS "")
- IF(LCOV_FOUND)
- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
- ENDIF()
- IF(GCOVR_FOUND)
- LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
- ENDIF()
- IF(LCOV_FOUND OR GCOVR_FOUND)
- ADD_CUSTOM_TARGET(coverage
- DEPENDS ${GLOBAL_DEPENDS})
- ENDIF()
-
- ENDIF()
-
-ENDFUNCTION()
diff --git a/cmake/FindGtest.cmake b/cmake/FindGtest.cmake
deleted file mode 100644
index 1283174..0000000
--- a/cmake/FindGtest.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-include(ExternalProject)
-include(FindPackageHandleStandardArgs)
-
-#gtest
-set(GTEST_INSTALL_DIR /usr/src/gmock/gtest/include)
-find_path(GTEST_INCLUDE_DIR gtest/gtest.h
- HINTS ${GTEST_INSTALL_DIR})
-
-#gmock
-find_path(GMOCK_INSTALL_DIR gmock/CMakeLists.txt
- HINTS /usr/src)
-if(${GMOCK_INSTALL_DIR} STREQUAL "GMOCK_INSTALL_DIR-NOTFOUND")
- message(FATAL_ERROR "google-mock package not found")
-endif()
-
-set(GMOCK_INSTALL_DIR ${GMOCK_INSTALL_DIR}/gmock)
-find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
-
-set(GMOCK_PREFIX gmock)
-set(GMOCK_BINARY_DIR ${CMAKE_BINARY_DIR}/${GMOCK_PREFIX}/libs)
-set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
-
-set(GTEST_CMAKE_ARGS "")
-if (${MIR_IS_CROSS_COMPILING})
- set(GTEST_CMAKE_ARGS
- -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
-endif()
-
-ExternalProject_Add(
- GMock
- #where to build in source tree
- PREFIX ${GMOCK_PREFIX}
- #where the source is external to the project
- SOURCE_DIR ${GMOCK_INSTALL_DIR}
- #forward the compilers to the subproject so cross-arch builds work
- CMAKE_ARGS ${GTEST_CMAKE_ARGS}
- BINARY_DIR ${GMOCK_BINARY_DIR}
-
- #we don't need to install, so skip
- INSTALL_COMMAND ""
-)
-
-set(GMOCK_LIBRARY ${GMOCK_BINARY_DIR}/libgmock.a)
-set(GMOCK_MAIN_LIBRARY ${GMOCK_BINARY_DIR}/libgmock_main.a)
-set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY})
-set(GTEST_LIBRARY ${GTEST_BINARY_DIR}/libgtest.a)
-set(GTEST_MAIN_LIBRARY ${GTEST_BINARY_DIR}/libgtest_main.a)
-set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
-set(GTEST_ALL_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES})
-
-find_package_handle_standard_args(GTest DEFAULT_MSG
- GMOCK_INCLUDE_DIR
- GTEST_INCLUDE_DIR)
diff --git a/cmake/FindLcov.cmake b/cmake/FindLcov.cmake
deleted file mode 100644
index 70628f4..0000000
--- a/cmake/FindLcov.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-# - Find lcov
-# Will define:
-#
-# LCOV_EXECUTABLE - the lcov binary
-# GENHTML_EXECUTABLE - the genhtml executable
-#
-# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
-#
-# This program is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General
-# Public License as published by the Free Software Foundation;
-# either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PROGRAM(LCOV_EXECUTABLE lcov)
-FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
-
-# only visible in advanced view
-MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
diff --git a/cmake/Findgcovr.cmake b/cmake/Findgcovr.cmake
deleted file mode 100644
index e4c43fe..0000000
--- a/cmake/Findgcovr.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-# - Find gcovr scrip
-# Will define:
-#
-# GCOVR_EXECUTABLE - the gcovr script
-#
-# Uses:
-#
-# GCOVR_ROOT - root to search for the script
-#
-# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
-#
-# This program is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General
-# Public License as published by the Free Software Foundation;
-# either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
-
-# only visible in advanced view
-MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
diff --git a/cmake/ParseArguments.cmake b/cmake/ParseArguments.cmake
deleted file mode 100644
index e13f671..0000000
--- a/cmake/ParseArguments.cmake
+++ /dev/null
@@ -1,52 +0,0 @@
-# Parse arguments passed to a function into several lists separated by
-# upper-case identifiers and options that do not have an associated list e.g.:
-#
-# SET(arguments
-# hello OPTION3 world
-# LIST3 foo bar
-# OPTION2
-# LIST1 fuz baz
-# )
-# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
-#
-# results in 7 distinct variables:
-# * ARG_DEFAULT_ARGS: hello;world
-# * ARG_LIST1: fuz;baz
-# * ARG_LIST2:
-# * ARG_LIST3: foo;bar
-# * ARG_OPTION1: FALSE
-# * ARG_OPTION2: TRUE
-# * ARG_OPTION3: TRUE
-#
-# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
-
-MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
- SET(DEFAULT_ARGS)
- FOREACH(arg_name ${arg_names})
- SET(${prefix}_${arg_name})
- ENDFOREACH(arg_name)
- FOREACH(option ${option_names})
- SET(${prefix}_${option} FALSE)
- ENDFOREACH(option)
-
- SET(current_arg_name DEFAULT_ARGS)
- SET(current_arg_list)
- FOREACH(arg ${ARGN})
- SET(larg_names ${arg_names})
- LIST(FIND larg_names "${arg}" is_arg_name)
- IF (is_arg_name GREATER -1)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
- SET(current_arg_name ${arg})
- SET(current_arg_list)
- ELSE (is_arg_name GREATER -1)
- SET(loption_names ${option_names})
- LIST(FIND loption_names "${arg}" is_option)
- IF (is_option GREATER -1)
- SET(${prefix}_${arg} TRUE)
- ELSE (is_option GREATER -1)
- SET(current_arg_list ${current_arg_list} ${arg})
- ENDIF (is_option GREATER -1)
- ENDIF (is_arg_name GREATER -1)
- ENDFOREACH(arg)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
-ENDMACRO(PARSE_ARGUMENTS)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 180498f..cb05b48 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,7 +1,7 @@
set (OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Don't treat warnings as errors in 3rd_party/{gmock,cucumber-cpp}
string (REPLACE " -Werror " " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-find_package(Gtest REQUIRED)
+find_package(GTest REQUIRED)
include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR})
set (CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})