Blob Blame History Raw
From b9ab79d7eb3a3eeebd8671ebe78e5fed6a3f1100 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Tue, 14 Jul 2020 08:10:00 +0200
Subject: [PATCH] Compatibility with xrootd 5.

The old client library libXrdClient is removed.
Also XrdSysDNS is removed.

Do not build the legacy XProofD file server and client (already
disabled by default - give error if someone enables it while building
with xrootd 5).

Do not build the old libNetx.

Build the new libNetNG without XrdSysDNS, use XrdNetAddr instead.
---
 cmake/modules/SearchInstalledSoftware.cmake | 15 +++++++++++++++
 net/CMakeLists.txt                          |  2 +-
 net/netxng/src/TNetXNGSystem.cxx            | 18 +++++++++++++++++-
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake
index 12f9d65371..c04b9b09fb 100644
--- a/cmake/modules/SearchInstalledSoftware.cmake
+++ b/cmake/modules/SearchInstalledSoftware.cmake
@@ -925,6 +925,21 @@ if(xrootd AND XROOTD_VERSIONNUM VERSION_GREATER 300030005)
 else()
   set(netxng OFF)
 endif()
+if(xrootd AND XROOTD_VERSIONNUM VERSION_LESS 500000000)
+  set(netx ON)
+else()
+  set(netx OFF)
+endif()
+if(xrootd AND XROOTD_VERSIONNUM VERSION_GREATER_EQUAL 500000000)
+  if(xproofd)
+    if(fail-on-missing)
+      message(FATAL_ERROR "XROOTD is version 5 or greater. The legacy xproofd servers can not be built with this version. Use -Dxproofd:BOOL=OFF to disable.")
+    else()
+      message(STATUS "XROOTD is version 5 or greater. The legacy xproofd servers can not be built with this version. Disabling 'xproofd' option.")
+      set(xproofd OFF CACHE BOOL "Disabled because xrootd version is 5 or greater" FORCE)
+    endif()
+  endif()
+endif()
 
 #---Alien support----------------------------------------------------------------
 if(alien)
diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt
index 953d9c5d6f..676eb63672 100644
--- a/net/CMakeLists.txt
+++ b/net/CMakeLists.txt
@@ -11,7 +11,7 @@ if(NOT WIN32 AND ssl)
   add_subdirectory(rpdutils)
 endif()
 
-if(xrootd)
+if(netx)
   add_subdirectory(netx)
 endif()
 
diff --git a/net/netxng/src/TNetXNGSystem.cxx b/net/netxng/src/TNetXNGSystem.cxx
index 6599aa2c2f..d30a12554f 100644
--- a/net/netxng/src/TNetXNGSystem.cxx
+++ b/net/netxng/src/TNetXNGSystem.cxx
@@ -27,7 +27,12 @@
 #include "TVirtualMutex.h"
 #include <XrdCl/XrdClFileSystem.hh>
 #include <XrdCl/XrdClXRootDResponses.hh>
+#include <XrdVersion.hh>
+#if XrdVNUMBER >= 40000
+#include <XrdNet/XrdNetAddr.hh>
+#else
 #include <XrdSys/XrdSysDNS.hh>
+#endif
 
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -352,6 +357,16 @@ Int_t TNetXNGSystem::Locate(const char *path, TString &endurl)
    TNamed *hn = 0;
    if (fgAddrFQDN.GetSize() <= 0 ||
        !(hn = dynamic_cast<TNamed *>(fgAddrFQDN.FindObject(loc)))) {
+#if XrdVNUMBER >= 40000
+      XrdNetAddr netaddr;
+      netaddr.Set(loc.Data());
+      const char* name = netaddr.Name();
+      if (name) {
+         hn = new TNamed(loc.Data(), name);
+      } else {
+         hn = new TNamed(loc, loc);
+      }
+#else
       char *addr[1] = {0}, *name[1] = {0};
       int naddr = XrdSysDNS::getAddrName(loc.Data(), 1, addr, name);
       if (naddr == 1) {
@@ -359,9 +374,10 @@ Int_t TNetXNGSystem::Locate(const char *path, TString &endurl)
       } else {
          hn = new TNamed(loc, loc);
       }
-      fgAddrFQDN.Add(hn);
       free(addr[0]);
       free(name[0]);
+#endif
+      fgAddrFQDN.Add(hn);
       if (gDebug > 0)
          Info("Locate","caching host name: %s", hn->GetTitle());
    }
-- 
2.26.2