pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/oorexx



Module Name:    pkgsrc
Committed By:   rhialto
Date:           Fri Jan 17 17:44:22 UTC 2025

Modified Files:
        pkgsrc/lang/oorexx: Makefile distinfo
        pkgsrc/lang/oorexx/patches: patch-CMakeLists.txt
Added Files:
        pkgsrc/lang/oorexx/patches: patch-rexxapi_server_APIServer.cpp
            patch-rexxapi_server_platform_unix_APIService.cpp

Log Message:
lang/oorexx: stop rxapi server which is started during the build.

This adds some patches so that the rxapi command gets an argument to tell it
to stop a currently running rxapi server.
Reported upstream as https://mastodon.social/@dec_hl/113843692204297339


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/lang/oorexx/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/oorexx/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/lang/oorexx/patches/patch-rexxapi_server_APIServer.cpp \
    pkgsrc/lang/oorexx/patches/patch-rexxapi_server_platform_unix_APIService.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/oorexx/Makefile
diff -u pkgsrc/lang/oorexx/Makefile:1.4 pkgsrc/lang/oorexx/Makefile:1.5
--- pkgsrc/lang/oorexx/Makefile:1.4     Wed Jan  8 14:37:36 2025
+++ pkgsrc/lang/oorexx/Makefile Fri Jan 17 17:44:22 2025
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2025/01/08 14:37:36 rhialto Exp $
+# $NetBSD: Makefile,v 1.5 2025/01/17 17:44:22 rhialto Exp $
 #
 
 DISTNAME=      oorexx-5.0.0-12583
 PKGNAME=       ${DISTNAME:C/-[0-9]*$//}
+PKGREVISION=   1
 CATEGORIES=    lang
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=oorexx/oorexx/${PKGVERSION_NOREV}/}
 MASTER_SITES+= ${MASTER_SITE_SOURCEFORGE:=oorexx/oorexx-docs/${PKGVERSION_NOREV}/}

Index: pkgsrc/lang/oorexx/distinfo
diff -u pkgsrc/lang/oorexx/distinfo:1.1 pkgsrc/lang/oorexx/distinfo:1.2
--- pkgsrc/lang/oorexx/distinfo:1.1     Tue Apr  2 18:59:15 2024
+++ pkgsrc/lang/oorexx/distinfo Fri Jan 17 17:44:22 2025
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1 2024/04/02 18:59:15 rhialto Exp $
+$NetBSD: distinfo,v 1.2 2025/01/17 17:44:22 rhialto Exp $
 
 BLAKE2s (ooRexx-5.0.0-pdf.zip) = 3921164b946553f5af2ab2880b88ff3f60b4089ccdc4da67d7b28ca00d7742f3
 SHA512 (ooRexx-5.0.0-pdf.zip) = 9ba7cc5f80590a75b9b59545d8ce3c2ae6a29cb4440d3c06ce4987cbf56946d6302da37f82ffc01a04a539ec80d797c9c611b8a623154c103c7139a34f0ea8a0
@@ -6,4 +6,6 @@ Size (ooRexx-5.0.0-pdf.zip) = 17985018 b
 BLAKE2s (oorexx-5.0.0-12583.tar.gz) = 0d889b43ce033718ba530dccfa5e4ae2732968a9de1d7b850b4b0d5db8854d0e
 SHA512 (oorexx-5.0.0-12583.tar.gz) = 141af22e0a99731d50492940d5db55cc59099e5a7fa8acba918d1ae82bcd6e2983fb0ca71bbbf044cc4fc89e740c8a0ac81237eea5812d7a570f825bba5d08b9
 Size (oorexx-5.0.0-12583.tar.gz) = 6398458 bytes
-SHA1 (patch-CMakeLists.txt) = 4a9a7883c344766f62e92fca5241ce6cd6835baa
+SHA1 (patch-CMakeLists.txt) = f0e93b60861cf48a0ce452bae0c2694af8fb5755
+SHA1 (patch-rexxapi_server_APIServer.cpp) = 36d33ec3afc9488eba93cb7f0554da5329953a8f
+SHA1 (patch-rexxapi_server_platform_unix_APIService.cpp) = efa9af95c8f6f69b4aef0ca087cf57591b211a0d

Index: pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt
diff -u pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt:1.1 pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt:1.2
--- pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt:1.1 Tue Apr  2 18:59:16 2024
+++ pkgsrc/lang/oorexx/patches/patch-CMakeLists.txt     Fri Jan 17 17:44:22 2025
@@ -1,8 +1,10 @@
-$NetBSD: patch-CMakeLists.txt,v 1.1 2024/04/02 18:59:16 rhialto Exp $
+$NetBSD: patch-CMakeLists.txt,v 1.2 2025/01/17 17:44:22 rhialto Exp $
 
 Doesn't respect CMAKE_INSTALL_MANDIR.
+Add a command to terminate rxapi after it was started.
+    https://sourceforge.net/p/oorexx/bugs/1993/
 
---- CMakeLists.txt.orig        2024-03-28 19:06:54.459436295 +0000
+--- CMakeLists.txt.orig        2023-04-19 14:25:14.000000000 +0000
 +++ CMakeLists.txt
 @@ -290,7 +290,7 @@ else ()
     set (INSTALL_INCLUDE_DIR include)
@@ -13,3 +15,11 @@ Doesn't respect CMAKE_INSTALL_MANDIR.
  endif ()
  
  # Set compiler and linker flags common to all build environments
+@@ -1035,6 +1035,7 @@ endif ()
+ # Build the rexx.img file
+ add_custom_command(OUTPUT ${ORX_IMAGE_OUTPUT_LOCATION}/rexx.img
+            COMMAND $<TARGET_FILE:rexximage> ${ORX_IMAGE_OUTPUT_LOCATION}/rexx.img
++           COMMAND $<TARGET_FILE:rxapi> stop
+            DEPENDS rexximage rxapi ${image_class_files} ${platform_rexx_img_depends}
+            WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ 

Added files:

Index: pkgsrc/lang/oorexx/patches/patch-rexxapi_server_APIServer.cpp
diff -u /dev/null pkgsrc/lang/oorexx/patches/patch-rexxapi_server_APIServer.cpp:1.1
--- /dev/null   Fri Jan 17 17:44:22 2025
+++ pkgsrc/lang/oorexx/patches/patch-rexxapi_server_APIServer.cpp       Fri Jan 17 17:44:22 2025
@@ -0,0 +1,20 @@
+$NetBSD: patch-rexxapi_server_APIServer.cpp,v 1.1 2025/01/17 17:44:22 rhialto Exp $
+
+Make terminateServer() resistant to being called more than once.
+    https://sourceforge.net/p/oorexx/bugs/1993/
+
+--- rexxapi/server/APIServer.cpp.orig  2025-01-14 14:01:33.240245578 +0000
++++ rexxapi/server/APIServer.cpp
+@@ -64,8 +64,10 @@ void APIServer::initServer(ServerConnect
+ void APIServer::terminateServer()
+ {
+     // flip the sign over to the closed side.
+-    connectionManager->disconnect();
+-    delete connectionManager;
++    if (connectionManager) {
++      connectionManager->disconnect();
++      delete connectionManager;
++    }
+     connectionManager = NULL;
+     serverActive = false;
+ }
Index: pkgsrc/lang/oorexx/patches/patch-rexxapi_server_platform_unix_APIService.cpp
diff -u /dev/null pkgsrc/lang/oorexx/patches/patch-rexxapi_server_platform_unix_APIService.cpp:1.1
--- /dev/null   Fri Jan 17 17:44:22 2025
+++ pkgsrc/lang/oorexx/patches/patch-rexxapi_server_platform_unix_APIService.cpp        Fri Jan 17 17:44:22 2025
@@ -0,0 +1,70 @@
+$NetBSD: patch-rexxapi_server_platform_unix_APIService.cpp,v 1.1 2025/01/17 17:44:22 rhialto Exp $
+
+A combination of changes to make it possible to terminate the rxapi process
+which is auto-started:
+- use the lock file as a pid-file,
+- add a command line argument "stop" that sends SIGTERM to the pid from the
+  pidfile,
+- let the signal handler continue running so that cleanup code can run.
+https://sourceforge.net/p/oorexx/bugs/1993/
+
+--- rexxapi/server/platform/unix/APIService.cpp.orig   2023-04-19 14:25:29.000000000 +0000
++++ rexxapi/server/platform/unix/APIService.cpp
+@@ -64,7 +64,8 @@ void Stop(int signo)
+ {
+     apiServer.terminateServer();     // shut everything down
+ 
+-    exit(1);
++    /* Do not exit here, but let the main loop finish and the epilog code clean
++     * up the lock file. */
+ }
+ 
+ 
+@@ -118,9 +119,15 @@ void releaseLock (const char *lockFileNa
+  */
+ int main(int argc, char *argv[])
+ {
++    int stopflag = 0;
++
+     if (argc > 1)
+     {
+-        printf("rxapi: no args allowed\n");
++      if (strcmp(argv[1], "stop") == 0) {
++          stopflag = 1;
++      } else {
++          printf("rxapi: no args allowed\n");
++      }
+     }
+ 
+     // a buffer for generating the name
+@@ -138,10 +145,30 @@ int main(int argc, char *argv[])
+     int fd;
+     if ((fd = acquireLock(lockFileName)) == -1)
+     {
++      if (stopflag) {
++          FILE *f = fopen(lockFileName, "r");
++          long pid = 0;
++
++          if (f && fscanf(f, "%ld", &pid) == 1 && (pid_t)pid > 1 &&
++              kill((pid_t)pid, SIGTERM) == 0) {
++              exit(0);
++          }
++          exit(1);
++      }
+         printf("rxapi: lockfile is locked by another rxapi instance; exiting\n");
+         return EACCES;
+     }
++    if (stopflag) {
++      printf("rxapi: no server is running.\n");
++      releaseLock(lockFileName, fd);   // release the exclusive lock
++      exit(1);
++    }
+     printf("rxapi: lockfile lock acquired\n");
++    {
++      char pidstring[32];
++      sprintf(pidstring, "%ld\n", (long)getpid());
++      write(fd, pidstring, strlen(pidstring));
++    }
+ 
+     struct sigaction sa;
+ 



Home | Main Index | Thread Index | Old Index