Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packio: migrate to Conan v2, drop old versions #25392

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 41 additions & 42 deletions recipes/packio/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
sources:
1.0.1:
sha256: 873ebd2ce8c8dbf8a4e7b777b1aa735fe4da3863131a5d6c938e339ee7e0a4d1
url: https://github.com/qchateau/packio/archive/1.0.1.tar.gz
1.0.2:
sha256: 040389f2de4a6da5df1cc323cdd80bc21bfc6a7f9bb9e56090d1ea0b1260226d
url: https://github.com/qchateau/packio/archive/1.0.2.tar.gz
1.1.0:
sha256: fb8baeeb903335b71b4241433faaff895e42e671da1c15b100e24b060f1d3784
url: https://github.com/qchateau/packio/archive/1.1.0.tar.gz
1.1.1:
sha256: 5f77bcbb843cc7dd7731c37db586e9e4f3997ebf04a8d1eccb9eae21841c7e55
url: https://github.com/qchateau/packio/archive/1.1.1.tar.gz
1.2.0:
sha256: b459c50a2ae7b90b45cd99a727dcd133e48602634571378491533148e642c511
url: https://github.com/qchateau/packio/archive/1.2.0.tar.gz
1.2.1:
sha256: 1b3f1654e8321148dd58172fcc6807451382dff30bb803967449a318b33101c5
url: https://github.com/qchateau/packio/archive/1.2.1.tar.gz
1.3.0:
sha256: adb723ef14b4a3ec41e9a7c17c48c8ee58712604b678b24f44e6a8aa471f18e5
url: https://github.com/qchateau/packio/archive/1.3.0.tar.gz
2.0.0:
sha256: b647b3088830c127a1d5d475a95476cc00c81675244cf7d17c9ca1f12e88740e
url: https://github.com/qchateau/packio/archive/2.0.0.tar.gz
2.0.1:
sha256: 081d378be922262c39218e115eabdf77f257e4773928011dff95795b8146b520
url: https://github.com/qchateau/packio/archive/2.0.1.tar.gz
2.1.0:
sha256: d13be083cd5a133b02fdd1da0d89fb75988c16109ccdcd631d53f9ca2457ad42
url: https://github.com/qchateau/packio/archive/2.1.0.tar.gz
"2.2.0":
url: "https://github.com/qchateau/packio/archive/2.2.0.tar.gz"
sha256: "ac9f33d5e8dd92bd3cdec106e10453424060bae9c4cd97281aa5d20fb20476f7"
"2.5.0":
url: "https://github.com/qchateau/packio/archive/refs/tags/2.5.0.tar.gz"
sha256: "5aa29313ac37be2fb66ff01af9413d9f9931cd4566f1400b00fac107552558ae"
"2.4.1":
url: "https://github.com/qchateau/packio/archive/refs/tags/2.4.1.tar.gz"
sha256: "c115548146d6da432048265037b30f77ba6ad7a39350693c4fb36fd896bc7a4b"
"2.3.0":
url: "https://github.com/qchateau/packio/archive/2.3.0.tar.gz"
url: "https://github.com/qchateau/packio/archive/refs/tags/2.3.0.tar.gz"
sha256: "4ef3bc76934855cc1a17eb00311bb42f5f14f616c75d4d1cc35151efcc988358"
"2.4.0":
url: "https://github.com/qchateau/packio/archive/2.4.0.tar.gz"
sha256: "2815d7772ef8d2360c5e15de7738ec7267e1e54a7afb817bf42a18a9f100ff52"
"2.2.0":
url: "https://github.com/qchateau/packio/archive/refs/tags/2.2.0.tar.gz"
sha256: "ac9f33d5e8dd92bd3cdec106e10453424060bae9c4cd97281aa5d20fb20476f7"
"2.1.0":
url: "https://github.com/qchateau/packio/archive/refs/tags/2.1.0.tar.gz"
sha256: "d13be083cd5a133b02fdd1da0d89fb75988c16109ccdcd631d53f9ca2457ad42"
patches:
"2.4.1":
url: "https://github.com/qchateau/packio/archive/2.4.1.tar.gz"
sha256: "c115548146d6da432048265037b30f77ba6ad7a39350693c4fb36fd896bc7a4b"
"2.5.0":
url: "https://github.com/qchateau/packio/archive/2.5.0.tar.gz"
sha256: "5aa29313ac37be2fb66ff01af9413d9f9931cd4566f1400b00fac107552558ae"
- patch_file: "patches/0001-fix-boost-json-namespace.patch"
patch_description: "Replace BOOST_JSON_NS_BEGIN for Boost 1.82+ compatibility"
patch_type: "backport"

Check warning on line 21 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 21)
patch_source: "https://github.com/qchateau/packio/commit/6ed35ba444dc22a5bc4c3c84989f7b8357a28e5b"
"2.3.0":
- patch_file: "patches/0001-fix-boost-json-namespace.patch"
patch_description: "Replace BOOST_JSON_NS_BEGIN for Boost 1.82+ compatibility"
patch_type: "backport"

Check warning on line 26 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 26)
patch_source: "https://github.com/qchateau/packio/commit/6ed35ba444dc22a5bc4c3c84989f7b8357a28e5b"
"2.2.0":
- patch_file: "patches/0001-fix-boost-json-namespace.patch"
patch_description: "Replace BOOST_JSON_NS_BEGIN for Boost 1.82+ compatibility"
patch_type: "backport"

Check warning on line 31 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 31)
patch_source: "https://github.com/qchateau/packio/commit/6ed35ba444dc22a5bc4c3c84989f7b8357a28e5b"
- patch_file: "patches/0002-fix-boost-json-value-regression.patch"
patch_description: "Fix std::hash<boost::json::value>"
patch_type: "backport"

Check warning on line 35 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 35)
patch_source: "https://github.com/qchateau/packio/commit/d1e0b30378ccafc96da039cf5fc9ffa754e4c2fe"
"2.1.0":
- patch_file: "patches/0001-fix-boost-json-namespace.patch"
patch_description: "Fix std::hash<boost::json::value>"
patch_type: "backport"

Check warning on line 40 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 40)
patch_source: "https://github.com/qchateau/packio/commit/d1e0b30378ccafc96da039cf5fc9ffa754e4c2fe"
- patch_file: "patches/0002-fix-boost-json-value-regression.patch"
patch_description: "Fix std::hash<boost::json::value>"
patch_type: "backport"

Check warning on line 44 in recipes/packio/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 44)
patch_source: "https://github.com/qchateau/packio/commit/d1e0b30378ccafc96da039cf5fc9ffa754e4c2fe"
127 changes: 66 additions & 61 deletions recipes/packio/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import os
from conan import ConanFile
from conan.tools import files, scm, build
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches
from conan.tools.layout import basic_layout
from conan.tools.scm import Version

required_conan_version = ">=1.51.1"


class PackioConan(ConanFile):
Expand All @@ -11,7 +16,8 @@ class PackioConan(ConanFile):
homepage = "https://github.com/qchateau/packio"
description = "An asynchronous msgpack-RPC and JSON-RPC library built on top of Boost.Asio."
topics = ("rpc", "msgpack", "json", "asio", "async", "cpp17", "cpp20", "coroutines")
settings = "compiler"
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True
options = {
"standalone_asio": [True, False],
Expand All @@ -27,81 +33,80 @@ class PackioConan(ConanFile):
}

@property
def _source_subfolder(self):
return "source_subfolder"
def _min_cppstd(self):
return "17"

@property
def _compilers_minimum_version(self):
if scm.Version(self.version) < "2.4.0":
if Version(self.version) < "2.4.0":
return {
"apple-clang": 10,
"clang": 6,
"gcc": 7,
"Visual Studio": 16,
"apple-clang": "10",
"clang": "6",
"gcc": "7",
"Visual Studio": "16",
"msvc": "192",
}
return {
"apple-clang": 13,
"clang": 11,
"gcc": 9,
"Visual Studio": 16,
"apple-clang": "13",
"clang": "11",
"gcc": "9",
"Visual Studio": "16",
"msvc": "192",
}

def config_options(self):
if scm.Version(self.version) < "1.2.0":
del self.options.standalone_asio
if scm.Version(self.version) < "2.0.0":
del self.options.msgpack
del self.options.nlohmann_json
if scm.Version(self.version) < "2.1.0":
del self.options.boost_json

def requirements(self):
if self.options.get_safe("msgpack") or scm.Version(self.version) < "2.0.0":
self.requires("msgpack/3.2.1")
def export_sources(self):
export_conandata_patches(self)

if self.options.get_safe("nlohmann_json"):
self.requires("nlohmann_json/3.9.1")
def layout(self):
basic_layout(self, src_folder="src")

# defaults to True if using boost.asio, False if using asio
if self.options.get_safe("boost_json") == "default":
self.options.boost_json = not self.options.standalone_asio
def package_id(self):
self.info.clear()

if self.options.get_safe("boost_json") or not self.options.get_safe("standalone_asio"):
self.requires("boost/1.75.0")
@property
def _use_boost_json(self):
# defaults to True if using boost.asio, False if using asio
if self.options.boost_json == "default":
return not self.options.standalone_asio
return self.options.boost_json

if self.options.get_safe("standalone_asio"):
self.requires("asio/1.18.1")
def requirements(self):
if self.options.msgpack:
self.requires("msgpack-cxx/6.1.1")
if self.options.nlohmann_json:
self.requires("nlohmann_json/3.11.3")
if self._use_boost_json or not self.options.standalone_asio:
self.requires("boost/1.83.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are newer versions not compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It avoids a conflict with boost/1.83.0 in msgpack-cxx. It built fine with Boost 1.85.0 otherwise.

if self.options.standalone_asio:
self.requires("asio/1.31.0")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.",
)

def source(self):
files.get(conanfile=self, **self.conan_data["sources"][self.version])
extracted_dir = "packio-" + self.version
os.rename(extracted_dir, self._source_subfolder)

def configure(self):
if self.settings.compiler.cppstd:
build.check_min_cppstd(self, "17")
get(self, **self.conan_data["sources"][self.version], strip_root=True)

minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version:
if scm.Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration("packio requires C++17, which your compiler does not support.")
else:
self.output.warn("packio requires C++17. Your compiler is unknown. Assuming it supports C++17.")
def build(self):
pass

def package(self):
self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder)
self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include"))

def package_id(self):
self.info.header_only()
apply_conandata_patches(self)
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))

def package_info(self):
if scm.Version(self.version) < "2.1.0":
if self.options.get_safe("standalone_asio"):
self.cpp_info.defines.append("PACKIO_STANDALONE_ASIO")
else:
# Starting from 2.1.0, preprocessor defines can be defined to 0 to force-disable
self.cpp_info.defines.append(f"PACKIO_STANDALONE_ASIO={1 if self.options.get_safe('standalone_asio') else 0}")
self.cpp_info.defines.append(f"PACKIO_HAS_MSGPACK={1 if self.options.get_safe('msgpack') else 0}")
self.cpp_info.defines.append(f"PACKIO_HAS_NLOHMANN_JSON={1 if self.options.get_safe('nlohmann_json') else 0}")
self.cpp_info.defines.append(f"PACKIO_HAS_BOOST_JSON={1 if self.options.get_safe('boost_json') else 0}")
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
# Preprocessor defines can be defined to 0 to force-disable
self.cpp_info.defines = [
f"PACKIO_STANDALONE_ASIO={1 if self.options.standalone_asio else 0}",
f"PACKIO_HAS_MSGPACK={1 if self.options.msgpack else 0}",
f"PACKIO_HAS_NLOHMANN_JSON={1 if self.options.nlohmann_json else 0}",
f"PACKIO_HAS_BOOST_JSON={1 if self._use_boost_json else 0}",
]
35 changes: 35 additions & 0 deletions recipes/packio/all/patches/0001-fix-boost-json-namespace.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 6ed35ba444dc22a5bc4c3c84989f7b8357a28e5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20M=C3=BCllenhaupt?=
<muellni@users.noreply.github.com>
Date: Wed, 10 May 2023 10:39:03 +0200
Subject: [PATCH] replace boost::json namespace macro

---
include/packio/json_rpc/converters.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/packio/json_rpc/converters.h b/include/packio/json_rpc/converters.h
index f8a176e..99dfa33 100644
--- a/include/packio/json_rpc/converters.h
+++ b/include/packio/json_rpc/converters.h
@@ -23,7 +23,8 @@ std::tuple<Args...> json_to_tuple(
} // json_rpc
} // packio

-BOOST_JSON_NS_BEGIN
+namespace boost {
+namespace json {

template <typename... Args>
std::tuple<Args...> tag_invoke(value_to_tag<std::tuple<Args...>>, const value& jv)
@@ -40,6 +41,7 @@ void tag_invoke(value_from_tag, value& jv, CStr&& from)
jv.emplace_string().assign(std::forward<CStr>(from));
}

-BOOST_JSON_NS_END
+} // json
+} // boost

-#endif // PACKIO_JSON_RPC_CONVERTERS_H
\ No newline at end of file
+#endif // PACKIO_JSON_RPC_CONVERTERS_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From d1e0b30378ccafc96da039cf5fc9ffa754e4c2fe Mon Sep 17 00:00:00 2001
From: Quentin Chateau <quentin.chateau@gmail.com>
Date: Fri, 16 Dec 2022 20:58:08 +0100
Subject: [PATCH] packio: fix std::hash<boost::json::value>

---
include/packio/json_rpc/hash.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/packio/json_rpc/hash.h b/include/packio/json_rpc/hash.h
index 9f6e3dd..b4c8977 100644
--- a/include/packio/json_rpc/hash.h
+++ b/include/packio/json_rpc/hash.h
@@ -6,6 +6,9 @@
#define PACKIO_JSON_RPC_HASH_H

#include <boost/json.hpp>
+#include <boost/version.hpp>
+
+#if BOOST_VERSION < 107700

namespace packio {
namespace json_rpc {
@@ -72,4 +75,6 @@ struct hash<boost::json::value> {

} // std

+#endif // BOOST_VERSION < 107700
+
#endif // PACKIO_JSON_RPC_HASH_H
16 changes: 0 additions & 16 deletions recipes/packio/all/test_package/1.0.x-1.1.x.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions recipes/packio/all/test_package/1.2.x.cpp

This file was deleted.

20 changes: 6 additions & 14 deletions recipes/packio/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(TestPackage CXX)
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
find_package(packio REQUIRED CONFIG)

if (PACKIO_VERSION VERSION_LESS "1.2.0")
add_executable(main 1.0.x-1.1.x.cpp)
elseif (PACKIO_VERSION VERSION_LESS "2.0.0")
add_executable(main 1.2.x.cpp)
else ()
add_executable(main latest.cpp)
endif ()

target_link_libraries(main ${CONAN_LIBS})
set_property(TARGET main PROPERTY CXX_STANDARD 17)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE packio::packio)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
Loading
Loading