From c888aaae19de1e337b80d2dc2601ed09c49e3e36 Mon Sep 17 00:00:00 2001 From: Rick Farina Date: Fri, 18 Mar 2022 09:14:22 -0400 Subject: net-wireless/rtl_433: fix tests Upstream fixed the issue, take their commit and remove test restriction Signed-off-by: Rick Farina --- .../files/rtl_433-21.12-test-visibility.patch | 155 +++++++++++++++++++++ net-wireless/rtl_433/rtl_433-21.12.ebuild | 4 +- net-wireless/rtl_433/rtl_433-9999.ebuild | 3 +- 3 files changed, 158 insertions(+), 4 deletions(-) create mode 100644 net-wireless/rtl_433/files/rtl_433-21.12-test-visibility.patch (limited to 'net-wireless/rtl_433') diff --git a/net-wireless/rtl_433/files/rtl_433-21.12-test-visibility.patch b/net-wireless/rtl_433/files/rtl_433-21.12-test-visibility.patch new file mode 100644 index 000000000000..01626361f5cc --- /dev/null +++ b/net-wireless/rtl_433/files/rtl_433-21.12-test-visibility.patch @@ -0,0 +1,155 @@ +From eda74c17dba1cfed7bcbb0654251cb0cd4e1f4b2 Mon Sep 17 00:00:00 2001 +From: "Christian W. Zuckschwerdt" +Date: Thu, 17 Mar 2022 08:55:49 +0100 +Subject: [PATCH] minor: Add visibility to dynamic lib exports (closes #2010) + +Co-authored-by: "Rick Farina (Zero_Chaos)" +--- + include/data.h | 58 ++++++++++++++++++++++++++++---------------- + src/CMakeLists.txt | 2 +- + tests/CMakeLists.txt | 2 +- + 3 files changed, 39 insertions(+), 23 deletions(-) + +diff --git a/include/data.h b/include/data.h +index 34fe79525..e892c7fa2 100644 +--- a/include/data.h ++++ b/include/data.h +@@ -21,6 +21,22 @@ + #ifndef INCLUDE_DATA_H_ + #define INCLUDE_DATA_H_ + ++#if defined _WIN32 || defined __CYGWIN__ ++ #ifdef data_EXPORTS ++ #define R_API __stdcall __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. ++ #else ++ #define R_API __stdcall __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. ++ #endif ++ #define R_API_CALLCONV __stdcall ++#else ++ #if __GNUC__ >= 4 ++ #define R_API __attribute__((visibility ("default"))) ++ #else ++ #define R_API ++ #endif ++ #define R_API_CALLCONV ++#endif ++ + #include + + typedef enum { +@@ -87,19 +103,19 @@ typedef struct data { + + @return A constructed data_t* object or NULL if there was a memory allocation error. + */ +-data_t *data_make(const char *key, const char *pretty_key, ...); ++R_API data_t *data_make(const char *key, const char *pretty_key, ...); + + /** Adds to a structured data object, by appending data. + + @see data_make() + */ +-data_t *data_append(data_t *first, const char *key, const char *pretty_key, ...); ++R_API data_t *data_append(data_t *first, const char *key, const char *pretty_key, ...); + + /** Adds to a structured data object, by prepending data. + + @see data_make() + */ +-data_t *data_prepend(data_t *first, const char *key, const char *pretty_key, ...); ++R_API data_t *data_prepend(data_t *first, const char *key, const char *pretty_key, ...); + + /** Constructs an array from given data of the given uniform type. + +@@ -110,28 +126,28 @@ data_t *data_prepend(data_t *first, const char *key, const char *pretty_key, ... + @return The constructed data array object, typically placed inside a data_t or NULL + if there was a memory allocation error. + */ +-data_array_t *data_array(int num_values, data_type_t type, void *ptr); ++R_API data_array_t *data_array(int num_values, data_type_t type, void *ptr); + + /** Releases a data array. */ +-void data_array_free(data_array_t *array); ++R_API void data_array_free(data_array_t *array); + + /** Retain a structure object, returns the structure object passed in. */ +-data_t *data_retain(data_t *data); ++R_API data_t *data_retain(data_t *data); + + /** Releases a structure object if retain is zero, decrement retain otherwise. */ +-void data_free(data_t *data); ++R_API void data_free(data_t *data); + + struct data_output; + + typedef struct data_output { +- void (*print_data)(struct data_output *output, data_t *data, char const *format); +- void (*print_array)(struct data_output *output, data_array_t *data, char const *format); +- void (*print_string)(struct data_output *output, const char *data, char const *format); +- void (*print_double)(struct data_output *output, double data, char const *format); +- void (*print_int)(struct data_output *output, int data, char const *format); +- void (*output_start)(struct data_output *output, char const *const *fields, int num_fields); +- void (*output_flush)(struct data_output *output); +- void (*output_free)(struct data_output *output); ++ void (R_API_CALLCONV *print_data)(struct data_output *output, data_t *data, char const *format); ++ void (R_API_CALLCONV *print_array)(struct data_output *output, data_array_t *data, char const *format); ++ void (R_API_CALLCONV *print_string)(struct data_output *output, const char *data, char const *format); ++ void (R_API_CALLCONV *print_double)(struct data_output *output, double data, char const *format); ++ void (R_API_CALLCONV *print_int)(struct data_output *output, int data, char const *format); ++ void (R_API_CALLCONV *output_start)(struct data_output *output, char const *const *fields, int num_fields); ++ void (R_API_CALLCONV *output_flush)(struct data_output *output); ++ void (R_API_CALLCONV *output_free)(struct data_output *output); + } data_output_t; + + /** Setup known field keys and start output, used by CSV only. +@@ -141,19 +157,19 @@ typedef struct data_output { + strings not. The list may contain duplicates and they are eliminated. + @param num_fields number of fields + */ +-void data_output_start(struct data_output *output, char const *const *fields, int num_fields); ++R_API void data_output_start(struct data_output *output, char const *const *fields, int num_fields); + + /** Prints a structured data object, flushes the output if applicable. */ +-void data_output_print(struct data_output *output, data_t *data); ++R_API void data_output_print(struct data_output *output, data_t *data); + +-void data_output_free(struct data_output *output); ++R_API void data_output_free(struct data_output *output); + + /* data output helpers */ + +-void print_value(data_output_t *output, data_type_t type, data_value_t value, char const *format); ++R_API void print_value(data_output_t *output, data_type_t type, data_value_t value, char const *format); + +-void print_array_value(data_output_t *output, data_array_t *array, char const *format, int idx); ++R_API void print_array_value(data_output_t *output, data_array_t *array, char const *format, int idx); + +-size_t data_print_jsons(data_t *data, char *dst, size_t len); ++R_API size_t data_print_jsons(data_t *data, char *dst, size_t len); + + #endif // INCLUDE_DATA_H_ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b050dd597..443393e67 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -253,7 +253,7 @@ if(MSVC) + target_sources(rtl_433 PRIVATE getopt/getopt.c) + endif() + +-add_library(data data.c abuf.c term_ctl.c) ++add_library(data data.c abuf.c) + target_link_libraries(data ${NET_LIBRARIES}) + + target_link_libraries(rtl_433 +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index aaae3d498..9a3a14302 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -1,7 +1,7 @@ + ######################################################################## + # Compile test cases + ######################################################################## +-add_executable(data-test data-test.c ../src/output_file.c) ++add_executable(data-test data-test.c ../src/output_file.c ../src/term_ctl.c) + + target_link_libraries(data-test data) + diff --git a/net-wireless/rtl_433/rtl_433-21.12.ebuild b/net-wireless/rtl_433/rtl_433-21.12.ebuild index 61394dce0c3e..7e127adedfde 100644 --- a/net-wireless/rtl_433/rtl_433-21.12.ebuild +++ b/net-wireless/rtl_433/rtl_433-21.12.ebuild @@ -24,11 +24,11 @@ DEPEND="rtlsdr? ( net-wireless/rtl-sdr:= soapysdr? ( net-wireless/soapysdr:= ) dev-libs/openssl:=" RDEPEND="${DEPEND}" -# https://github.com/merbanan/rtl_433/issues/2010 -RESTRICT="test" +RESTRICT="!test? ( test )" PATCHES=( "${FILESDIR}/${P}-CVE.patch" + "${FILESDIR}/${P}-test-visibility.patch" ) src_configure() { diff --git a/net-wireless/rtl_433/rtl_433-9999.ebuild b/net-wireless/rtl_433/rtl_433-9999.ebuild index 99a3058c63d4..74f846b96d6d 100644 --- a/net-wireless/rtl_433/rtl_433-9999.ebuild +++ b/net-wireless/rtl_433/rtl_433-9999.ebuild @@ -27,8 +27,7 @@ DEPEND="rtlsdr? ( net-wireless/rtl-sdr:= soapysdr? ( net-wireless/soapysdr:= ) dev-libs/openssl:=" RDEPEND="${DEPEND}" -# https://github.com/merbanan/rtl_433/issues/2010 -RESTRICT="test" +RESTRICT="!test? ( test )" src_configure() { mycmakeargs=( -- cgit v1.2.3-65-gdbad