diff options
author | Parian Golchin <par.golchin@gmail.com> | 2023-08-22 20:03:28 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-08-22 13:12:38 -0700 |
commit | 0697d52777cd530dc59bb05a506327c365bc78a2 (patch) | |
tree | 85ee9b9cc4516a9287fe601731b04f12b0c8263d | |
parent | 0324259cd6ff63e6d487491cffbe31552ea5a883 (diff) | |
download | meta-openembedded-0697d52777cd530dc59bb05a506327c365bc78a2.tar.gz |
json-schema-validator: Updrade to 2.2.0
Upgrade and add important patches to the release
Signed-off-by: Parian Golchin <par.golchin@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
6 files changed, 159 insertions, 62 deletions
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-Set-Json_validator-Install-off-if-it-finds-it-via-li.patch b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-Set-Json_validator-Install-off-if-it-finds-it-via-li.patch new file mode 100644 index 0000000000..6e6a4b93e8 --- /dev/null +++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-Set-Json_validator-Install-off-if-it-finds-it-via-li.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 35939115142db6cd366ab11b29692a0179338ddf Mon Sep 17 00:00:00 2001 | ||
2 | From: Parian Golchin <Parian.Golchin@iris-sensing.com> | ||
3 | Date: Fri, 18 Aug 2023 15:54:25 +0200 | ||
4 | Subject: [PATCH 1/3] Set Json_validator Install off if it finds it via linking | ||
5 | |||
6 | Upstream-Status: Inappropriate [newer version of cmake in main branch] | ||
7 | |||
8 | Signed-off-by: Parian Golchin <Parian.Golchin@iris-sensing.com> | ||
9 | --- | ||
10 | CMakeLists.txt | 3 +++ | ||
11 | 1 file changed, 3 insertions(+) | ||
12 | |||
13 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
14 | index f636734..9e4587f 100644 | ||
15 | --- a/CMakeLists.txt | ||
16 | +++ b/CMakeLists.txt | ||
17 | @@ -55,6 +55,9 @@ option(JSON_VALIDATOR_BUILD_EXAMPLES "Build examples" ${JSON_VALIDATOR_IS_TOP_LE | ||
18 | |||
19 | if(NOT TARGET nlohmann_json::nlohmann_json) | ||
20 | find_package(nlohmann_json REQUIRED) | ||
21 | +else() | ||
22 | + message(STATUS "Found nlohmann_json::nlohmann_json-target - linking with it") | ||
23 | + set(JSON_VALIDATOR_INSTALL OFF) | ||
24 | endif() | ||
25 | |||
26 | target_link_libraries( | ||
27 | -- | ||
28 | 2.25.1 | ||
29 | |||
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch deleted file mode 100644 index 4b1184a394..0000000000 --- a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0001-cmake-Use-GNUInstallDirs.patch +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | From e0b1ad02c678513412aba95a1b2fb4005c3c0452 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 19 Mar 2022 22:40:49 -0700 | ||
4 | Subject: [PATCH] cmake: Use GNUInstallDirs | ||
5 | |||
6 | This helps it make it platform independent, some platforms e.g. | ||
7 | ppc64/linux use /usr/lib64 for system libraries | ||
8 | |||
9 | Upstream-Status: Submitted [https://github.com/pboettch/json-schema-validator/pull/197] | ||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | CMakeLists.txt | 8 +++++--- | ||
13 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
16 | index c4cc218..594dc5f 100644 | ||
17 | --- a/CMakeLists.txt | ||
18 | +++ b/CMakeLists.txt | ||
19 | @@ -122,11 +122,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
20 | endif() | ||
21 | endif() | ||
22 | |||
23 | +include(GNUInstallDirs) | ||
24 | + | ||
25 | if(JSON_VALIDATOR_INSTALL) | ||
26 | install(TARGETS nlohmann_json_schema_validator | ||
27 | EXPORT ${PROJECT_NAME}Targets | ||
28 | - LIBRARY DESTINATION lib | ||
29 | - ARCHIVE DESTINATION lib | ||
30 | + LIBRARY DESTINATION ${LIBDIR} | ||
31 | + ARCHIVE DESTINATION ${LIBDIR} | ||
32 | RUNTIME DESTINATION bin) | ||
33 | |||
34 | install(FILES src/nlohmann/json-schema.hpp | ||
35 | @@ -155,7 +157,7 @@ if(JSON_VALIDATOR_INSTALL) | ||
36 | # Set Up the Project Targets and Config Files for CMake | ||
37 | |||
38 | # Set the install path to the cmake config files | ||
39 | - set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}) | ||
40 | + set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) | ||
41 | |||
42 | # Create the ConfigVersion file | ||
43 | include(CMakePackageConfigHelpers) # write_basic_package_version_file | ||
44 | -- | ||
45 | 2.35.1 | ||
46 | |||
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0002-Fix-assumed-signed-char.patch b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0002-Fix-assumed-signed-char.patch new file mode 100644 index 0000000000..2ee0a39126 --- /dev/null +++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0002-Fix-assumed-signed-char.patch | |||
@@ -0,0 +1,71 @@ | |||
1 | From 2065015da40cf79dd8ec9e3f186538e17c3b592f Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
3 | Date: Wed, 30 Nov 2022 13:07:29 -0800 | ||
4 | Subject: [PATCH 2/3] Fix assumed signed char | ||
5 | |||
6 | The code assumes that char is signed, but whether char is signed or | ||
7 | unsigned is implementation defined. On some architectures like PowerPC, | ||
8 | GCC treats char as unsigned resulting in compile errors: | ||
9 | |||
10 | smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing] | ||
11 | |||
12 | Fix this by specifying signed char. | ||
13 | |||
14 | Upstream-Status: Accepted [https://github.com/pboettch/json-schema-validator/commit/491ac44026e08f31790f5cacffa62e168bb35e32] | ||
15 | |||
16 | Signed-off-by: Parian Golchin <Parian.Golchin@iris-sensing.com> | ||
17 | --- | ||
18 | src/smtp-address-validator.cpp | 16 ++++++++-------- | ||
19 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
20 | |||
21 | diff --git a/src/smtp-address-validator.cpp b/src/smtp-address-validator.cpp | ||
22 | index a63ead0..3903b51 100644 | ||
23 | --- a/src/smtp-address-validator.cpp | ||
24 | +++ b/src/smtp-address-validator.cpp | ||
25 | @@ -63,7 +63,7 @@ static const short _address_key_offsets[] = { | ||
26 | 1363, 1365, 1367, 1368, 1370, 1388, 0 | ||
27 | }; | ||
28 | |||
29 | -static const char _address_trans_keys[] = { | ||
30 | +static const signed char _address_trans_keys[] = { | ||
31 | -32, -19, -16, -12, 34, 45, 61, 63, | ||
32 | -62, -33, -31, -17, -15, -13, 33, 39, | ||
33 | 42, 43, 47, 57, 65, 90, 94, 126, | ||
34 | @@ -711,7 +711,7 @@ bool is_address(const char* p, const char* pe) | ||
35 | { | ||
36 | int _klen; | ||
37 | unsigned int _trans = 0; | ||
38 | - const char * _keys; | ||
39 | + const signed char * _keys; | ||
40 | const signed char * _acts; | ||
41 | unsigned int _nacts; | ||
42 | _resume: {} | ||
43 | @@ -728,9 +728,9 @@ bool is_address(const char* p, const char* pe) | ||
44 | |||
45 | _klen = (int)_address_single_lengths[cs]; | ||
46 | if ( _klen > 0 ) { | ||
47 | - const char *_lower = _keys; | ||
48 | - const char *_upper = _keys + _klen - 1; | ||
49 | - const char *_mid; | ||
50 | + const signed char *_lower = _keys; | ||
51 | + const signed char *_upper = _keys + _klen - 1; | ||
52 | + const signed char *_mid; | ||
53 | while ( 1 ) { | ||
54 | if ( _upper < _lower ) { | ||
55 | _keys += _klen; | ||
56 | @@ -752,9 +752,9 @@ bool is_address(const char* p, const char* pe) | ||
57 | |||
58 | _klen = (int)_address_range_lengths[cs]; | ||
59 | if ( _klen > 0 ) { | ||
60 | - const char *_lower = _keys; | ||
61 | - const char *_upper = _keys + (_klen<<1) - 2; | ||
62 | - const char *_mid; | ||
63 | + const signed char *_lower = _keys; | ||
64 | + const signed char *_upper = _keys + (_klen<<1) - 2; | ||
65 | + const signed char *_mid; | ||
66 | while ( 1 ) { | ||
67 | if ( _upper < _lower ) { | ||
68 | _trans += (unsigned int)_klen; | ||
69 | -- | ||
70 | 2.25.1 | ||
71 | |||
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0003-For-root-value-use-empty-pointer.patch b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0003-For-root-value-use-empty-pointer.patch new file mode 100644 index 0000000000..e0d0cf8ce9 --- /dev/null +++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator/0003-For-root-value-use-empty-pointer.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From fa49c29942763285c51b7d2dea417d9f51e4961f Mon Sep 17 00:00:00 2001 | ||
2 | From: Sven Fink <sven.fink@wipotec.com> | ||
3 | Date: Fri, 13 Jan 2023 09:15:42 +0100 | ||
4 | Subject: [PATCH 3/3] For root value, use empty pointer | ||
5 | |||
6 | Upstream-Status: Accepted [https://github.com/pboettch/json-schema-validator/commit/59c9d6200bf3cd54b4fc717ec1660c91eddb4d1a] | ||
7 | |||
8 | Signed-off-by: Parian Golchin <Parian.Golchin@iris-sensing.com> | ||
9 | --- | ||
10 | src/json-validator.cpp | 8 ++++++++ | ||
11 | 1 file changed, 8 insertions(+) | ||
12 | |||
13 | diff --git a/src/json-validator.cpp b/src/json-validator.cpp | ||
14 | index 7f34553..3c73d98 100644 | ||
15 | --- a/src/json-validator.cpp | ||
16 | +++ b/src/json-validator.cpp | ||
17 | @@ -553,6 +553,9 @@ class type_schema : public schema | ||
18 | else_->validate(ptr, instance, patch, e); | ||
19 | } | ||
20 | } | ||
21 | + if (instance.is_null()) { | ||
22 | + patch.add(nlohmann::json::json_pointer{}, default_value_); | ||
23 | + } | ||
24 | } | ||
25 | |||
26 | protected: | ||
27 | @@ -1134,6 +1137,11 @@ public: | ||
28 | propertyNames_ = schema::make(attr.value(), root, {"propertyNames"}, uris); | ||
29 | sch.erase(attr); | ||
30 | } | ||
31 | + | ||
32 | + attr = sch.find("default"); | ||
33 | + if (attr != sch.end()) { | ||
34 | + set_default_value(*attr); | ||
35 | + } | ||
36 | } | ||
37 | }; | ||
38 | |||
39 | -- | ||
40 | 2.25.1 | ||
41 | |||
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb deleted file mode 100644 index 00d26d7b34..0000000000 --- a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.1.0.bb +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | SUMMARY = "JSON schema validator for JSON for Modern C++" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c441d022da1b1663c70181a32225d006" | ||
4 | |||
5 | SRC_URI = "git://github.com/pboettch/json-schema-validator;branch=master;protocol=https \ | ||
6 | file://0001-cmake-Use-GNUInstallDirs.patch \ | ||
7 | " | ||
8 | SRCREV = "27fc1d094503623dfe39365ba82581507524545c" | ||
9 | |||
10 | S = "${WORKDIR}/git" | ||
11 | |||
12 | DEPENDS += "nlohmann-json" | ||
13 | |||
14 | inherit cmake | ||
15 | EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF" | ||
16 | |||
diff --git a/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.2.0.bb b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.2.0.bb new file mode 100644 index 0000000000..6f0b424024 --- /dev/null +++ b/meta-oe/recipes-devtools/json-schema-validator/json-schema-validator_2.2.0.bb | |||
@@ -0,0 +1,18 @@ | |||
1 | SUMMARY = "JSON schema validator for JSON for Modern C++" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c441d022da1b1663c70181a32225d006" | ||
4 | |||
5 | SRC_URI = "git://github.com/pboettch/json-schema-validator;branch=main;protocol=https \ | ||
6 | file://0001-Set-Json_validator-Install-off-if-it-finds-it-via-li.patch \ | ||
7 | file://0002-Fix-assumed-signed-char.patch \ | ||
8 | file://0003-For-root-value-use-empty-pointer.patch \ | ||
9 | " | ||
10 | |||
11 | SRCREV = "6b17782d6a5d1dee5d2c4fc5d25ffb1123913431" | ||
12 | |||
13 | S = "${WORKDIR}/git" | ||
14 | |||
15 | DEPENDS += "nlohmann-json" | ||
16 | |||
17 | inherit cmake | ||
18 | EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON -DJSON_VALIDATOR_BUILD_TESTS=OFF -DJSON_VALIDATOR_BUILD_EXAMPLES=OFF" | ||