Wednesday, June 08, 2022

update misc/open62541

Hi ports@

I would like to update misc/open62541 library. That is not easy
as it is not API compatible. The depending port misc/p5-OPCUA-Open62541
compiles, but fails in make test.

So I have to fix open62541 library bugs and add p5-OPCUA-Open62541
compatiblity layer. As the latter is my module and I doubt that
anyone else uses it, I think it is acceptable that tests fail.
Updating open62541 now would allow to work in tree.

I have removed all the patches in misc/open62541 that have been
commited upstream. New patches prevent fatal compiler warnings.

Upstream has moved include/aa_tree.h, include/ms_stdint.h,
include/ziptree.h outside of the include/open62541/ directory. This
pollutes the namespace. Fortunately two of them are only used
internally and are not needed in the package. I rmeoved them from
PLIST.

But include/aa_tree.h is included in include/open62541/ header
file. What should I do?
- ignore the namespace problem
- move include/aa_tree.h to include/open62541/aa_tree.h
- paste include/aa_tree.h content into the single header file
include/open62541/plugin/nodestore.h that needs it.
- something else

ok?

bluhm

Index: Makefile
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/misc/open62541/Makefile,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 Makefile
--- Makefile 11 Mar 2022 19:38:13 -0000 1.14
+++ Makefile 8 Jun 2022 14:45:16 -0000
@@ -1,11 +1,10 @@
COMMENT = library implementation of OPC UA

-VERSION = 1.0.6
-REVISION = 0
+VERSION = 1.3.1
DISTNAME = open62541-${VERSION}
PKGNAME = open62541-${VERSION}

-SHARED_LIBS = open62541 1.0
+SHARED_LIBS = open62541 2.0

CATEGORIES = misc

@@ -21,7 +20,7 @@ WANTLIB = c m mbedcrypto mbedtls mbedx5
MASTER_SITES = https://github.com/open62541/open62541/
MASTER_SITES0 = https://github.com/OPCFoundation/UA-Nodeset/archive/
DISTFILES = open62541-{archive/refs/tags/v}${VERSION}.tar.gz \
- UA-1.04.5-2020-03-06.tar.gz:0
+ UA-1.04.10-2021-09-15.tar.gz:0

MODULES = devel/cmake

@@ -53,8 +52,7 @@ FLAVORS = ns0_full
FLAVOR ?=

.if ${FLAVOR:Mns0_full}
-CONFIGURE_ARGS += -DUA_NAMESPACE_ZERO=FULL \
- -DUA_ENABLE_MICRO_EMB_DEV_PROFILE=ON
+CONFIGURE_ARGS += -DUA_NAMESPACE_ZERO=FULL
.else
CONFIGURE_ARGS += -DUA_NAMESPACE_ZERO=REDUCED
.endif
Index: distinfo
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/misc/open62541/distinfo,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 distinfo
--- distinfo 9 Aug 2021 21:23:25 -0000 1.5
+++ distinfo 8 Jun 2022 14:45:36 -0000
@@ -1,4 +1,4 @@
-SHA256 (UA-1.04.5-2020-03-06.tar.gz) = KIty/GA+zomK1fXUBLBP7+EN5Puzx1apbXzINCtRgFM=
-SHA256 (open62541-1.0.6.tar.gz) = KZlAAlwUkpUzBkq+AETVgF6lDVKzLQWtm8DmmWVpwqY=
-SIZE (UA-1.04.5-2020-03-06.tar.gz) = 4053334
-SIZE (open62541-1.0.6.tar.gz) = 2691627
+SHA256 (UA-1.04.10-2021-09-15.tar.gz) = TaoMRz1MU01hSqnlSqhrcb7CREZnO550yF5a3SYkw5M=
+SHA256 (open62541-1.3.1.tar.gz) = 9U0QMl/Qj8FQWuo32D2qCFkSomlSHm0Bi/xBp0S6V6o=
+SIZE (UA-1.04.10-2021-09-15.tar.gz) = 5720040
+SIZE (open62541-1.3.1.tar.gz) = 3886706
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/misc/open62541/patches/patch-CMakeLists_txt,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 11 Mar 2022 19:38:13 -0000 1.4
+++ patches/patch-CMakeLists_txt 8 Jun 2022 15:01:01 -0000
@@ -1,20 +1,9 @@
-GCC 4.2.1 doesn't understand "-Wpedantic".
-
Move examples to the right place.

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
-@@ -389,7 +389,7 @@ include(CompilerFlags)
- if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
- # Compiler
- add_definitions(-std=c99 -pipe
-- -Wall -Wextra -Wpedantic
-+ -Wall -Wextra
- -Wno-static-in-inline # clang doesn't like the use of static inline methods inside static inline methods
- -Wno-overlength-strings # may happen in the nodeset compiler when complex values are directly encoded
- -Wno-unused-parameter # some methods may require unused arguments to cast to a method pointer
-@@ -1239,7 +1239,7 @@ if (UA_PACK_DEBIAN)
+@@ -1695,7 +1695,7 @@ if(UA_PACK_DEBIAN)
"examples/nodeset"
"examples/pubsub")

Index: patches/patch-arch_network_tcp_c
===================================================================
RCS file: patches/patch-arch_network_tcp_c
diff -N patches/patch-arch_network_tcp_c
--- patches/patch-arch_network_tcp_c 11 Mar 2022 19:38:13 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,247 +0,0 @@
-https://github.com/open62541/open62541/commit/30ac5ddd892e6ce82bef4de7890f06854aca9736
-
-https://github.com/open62541/open62541/commit/1654d021012b93ff669c022499fd80c47a73e72e
-
-https://github.com/open62541/open62541/commit/f9ceec7be7940495cf2ee091bed1bb5acec74551
-
-Index: arch/network_tcp.c
---- arch/network_tcp.c.orig
-+++ arch/network_tcp.c
-@@ -339,11 +339,18 @@ addServerSocket(ServerNetworkLayerTCP *layer, struct a
-
- static UA_StatusCode
- ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, const UA_String *customHostname) {
-- UA_initialize_architecture_network();
-+ UA_initialize_architecture_network();
-
- ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle;
-
- /* Get addrinfo of the server and create server sockets */
-+ char hostname[512];
-+ if(customHostname->length) {
-+ if(customHostname->length >= sizeof(hostname))
-+ return UA_STATUSCODE_BADOUTOFMEMORY;
-+ memcpy(hostname, customHostname->data, customHostname->length);
-+ hostname[customHostname->length] = '\0';
-+ }
- char portno[6];
- UA_snprintf(portno, 6, "%d", layer->port);
- struct addrinfo hints, *res;
-@@ -352,7 +359,8 @@ ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl,
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_PASSIVE;
- hints.ai_protocol = IPPROTO_TCP;
-- if(UA_getaddrinfo(NULL, portno, &hints, &res) != 0)
-+ if(UA_getaddrinfo(customHostname->length ? hostname : NULL,
-+ portno, &hints, &res) != 0)
- return UA_STATUSCODE_BADINTERNALERROR;
-
- /* There might be serveral addrinfos (for different network cards,
-@@ -442,7 +450,7 @@ ServerNetworkLayerTCP_listen(UA_ServerNetworkLayer *nl
-
- struct sockaddr_storage remote;
- socklen_t remote_size = sizeof(remote);
-- UA_SOCKET newsockfd = UA_accept((UA_SOCKET)layer->serverSockets[i],
-+ UA_SOCKET newsockfd = UA_accept(layer->serverSockets[i],
- (struct sockaddr*)&remote, &remote_size);
- if(newsockfd == UA_INVALID_SOCKET)
- continue;
-@@ -609,7 +617,6 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *c
- (TCPClientConnection*) connection->handle;
-
- UA_DateTime connStart = UA_DateTime_nowMonotonic();
-- UA_SOCKET clientsockfd = connection->sockfd;
-
- UA_ClientConfig *config = UA_Client_getConfig(client);
-
-@@ -631,22 +638,22 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *c
- /* Thus use a loop and retry until timeout is reached */
-
- /* Get a socket */
-- if(clientsockfd <= 0) {
-- clientsockfd = UA_socket(tcpConnection->server->ai_family,
-+ if(connection->sockfd == UA_INVALID_SOCKET) {
-+ connection->sockfd = UA_socket(tcpConnection->server->ai_family,
- tcpConnection->server->ai_socktype,
- tcpConnection->server->ai_protocol);
-- connection->sockfd = (UA_Int32)clientsockfd; /* cast for win32 */
-+ if(connection->sockfd == UA_INVALID_SOCKET) {
-+ UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_NETWORK,
-+ "Could not create client socket: %s", strerror(UA_ERRNO));
-+ ClientNetworkLayerTCP_close(connection);
-+ return UA_STATUSCODE_BADDISCONNECT;
-+ }
- }
-
-- if(clientsockfd == UA_INVALID_SOCKET) {
-- UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_NETWORK,
-- "Could not create client socket: %s", strerror(UA_ERRNO));
-- ClientNetworkLayerTCP_close(connection);
-- return UA_STATUSCODE_BADDISCONNECT;
-- }
-
-+
- /* Non blocking connect to be able to timeout */
-- if(UA_socket_set_nonblocking(clientsockfd) != UA_STATUSCODE_GOOD) {
-+ if(UA_socket_set_nonblocking(connection->sockfd) != UA_STATUSCODE_GOOD) {
- UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_NETWORK,
- "Could not set the client socket to nonblocking");
- ClientNetworkLayerTCP_close(connection);
-@@ -654,7 +661,7 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *c
- }
-
- /* Non blocking connect */
-- int error = UA_connect(clientsockfd, tcpConnection->server->ai_addr,
-+ int error = UA_connect(connection->sockfd, tcpConnection->server->ai_addr,
- tcpConnection->server->ai_addrlen);
-
- if ((error == -1) && (UA_ERRNO != UA_ERR_CONNECTION_PROGRESS)) {
-@@ -686,7 +693,7 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *c
- break;
-
- _os_sleep(&time,&sig);
-- error = connect(clientsockfd, tcpConnection->server->ai_addr,
-+ error = connect(connection->sockfd, tcpConnection->server->ai_addr,
- tcpConnection->server->ai_addrlen);
- if ((error == -1 && UA_ERRNO == EISCONN) || (error == 0))
- resultsize = 1;
-@@ -697,26 +704,25 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *c
- #else
- fd_set fdset;
- FD_ZERO(&fdset);
-- UA_fd_set(clientsockfd, &fdset);
-+ UA_fd_set(connection->sockfd, &fdset);
- UA_UInt32 timeout_usec = (tcpConnection->timeout - timeSinceStart)
- * 1000;
- struct timeval tmptv = { (long int) (timeout_usec / 1000000),
- (int) (timeout_usec % 1000000) };
-
-- int resultsize = UA_select((UA_Int32) (clientsockfd + 1), NULL, &fdset,
-- NULL, &tmptv);
-+ int resultsize = UA_select((UA_Int32) (connection->sockfd + 1), NULL,
-+ &fdset, NULL, &tmptv);
-

No comments:

Post a Comment