From b4ab993a041adc321a2ac13478b5dc0ca82f92b2 Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Mon, 11 Jul 2022 12:02:35 +0200
Subject: [PATCH] Resolve "Remove CASTOR to CTA migration tools RPM"

---
 .gitmodules                          |  7 +++----
 cmdline/restore_files/CMakeLists.txt |  2 +-
 eos_cta/CMakeLists.txt               | 22 +++++++++++-----------
 eos_cta/grpc-proto                   |  1 +
 xroot_plugins/CMakeLists.txt         |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)
 create mode 160000 eos_cta/grpc-proto

diff --git a/.gitmodules b/.gitmodules
index ba41b979ed..bafddfc0da 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,7 +1,6 @@
 [submodule "xrootd-ssi-protobuf-interface"]
 	path = xrootd-ssi-protobuf-interface
-   url = https://:@gitlab.cern.ch:8443/eos/xrootd-ssi-protobuf-interface.git
-#   branch = stable
-[submodule "migration/grpc-proto"]
-	path = migration/grpc-proto
+	url = https://:@gitlab.cern.ch:8443/eos/xrootd-ssi-protobuf-interface.git
+[submodule "eos_cta/grpc-proto"]
+	path = eos_cta/grpc-proto
 	url = https://:@gitlab.cern.ch:8443/eos/grpc-proto.git
diff --git a/cmdline/restore_files/CMakeLists.txt b/cmdline/restore_files/CMakeLists.txt
index ff4f872346..dea348c803 100644
--- a/cmdline/restore_files/CMakeLists.txt
+++ b/cmdline/restore_files/CMakeLists.txt
@@ -28,7 +28,7 @@ include_directories(${XRD_SSI_PB_DIR}/include ${XRD_SSI_PB_DIR}/eos_cta/include)
 include_directories(${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS})
 
 add_executable(cta-restore-deleted-files RestoreFilesCmdLineArgs.cpp RestoreFilesCmdMain.cpp CmdLineTool.cpp RestoreFilesCmd.cpp)
-target_link_libraries(cta-restore-deleted-files ${PROTOBUF3_LIBRARIES} ${GRPC_LIBRARY} ${GRPC_GRPC++_LIBRARY} XrdSsiPbEosCta XrdSsiLib XrdUtils ctacommon EosMigration EosGrpcClient)
+target_link_libraries(cta-restore-deleted-files ${PROTOBUF3_LIBRARIES} ${GRPC_LIBRARY} ${GRPC_GRPC++_LIBRARY} XrdSsiPbEosCta XrdSsiLib XrdUtils ctacommon EosCtaGrpc EosGrpcClient)
 set_property (TARGET cta-restore-deleted-files APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
 
 
diff --git a/eos_cta/CMakeLists.txt b/eos_cta/CMakeLists.txt
index b10e0c4468..50c60f43f2 100644
--- a/eos_cta/CMakeLists.txt
+++ b/eos_cta/CMakeLists.txt
@@ -22,25 +22,25 @@ include_directories(${PROTOBUF3_INCLUDE_DIRS})
 # Select protobuf files
 set(PROTOBUF_EOS_CTA_DIR ${XRD_SSI_PB_DIR}/eos_cta/protobuf)
 file(GLOB ProtoFilesEosCta "${PROTOBUF_EOS_CTA_DIR}/*.proto")
-set(PROTOBUF_MIGRATION_DIR ${PROJECT_SOURCE_DIR}/migration/grpc-proto/protobuf)
-file(GLOB ProtoFilesMigration "${PROTOBUF_MIGRATION_DIR}/*.proto")
+set(PROTOBUF_EOS_CTA_GRPC_DIR ${PROJECT_SOURCE_DIR}/eos_cta/grpc-proto/protobuf)
+file(GLOB ProtoFilesEosCtaGrpc "${PROTOBUF_EOS_CTA_GRPC_DIR}/*.proto")
 
 # Compile protobufs
-set(PROTOBUF3_INCLUDE_PATH ${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF_MIGRATION_DIR})
+set(PROTOBUF3_INCLUDE_PATH ${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF_EOS_CTA_GRPC_DIR})
 PROTOBUF3_GENERATE_CPP(ProtoSourcesEosCta ProtoHeadersEosCta ${ProtoFilesEosCta})
-PROTOBUF3_GENERATE_CPP(ProtoSourcesMigration ProtoHeadersMigration ${ProtoFilesMigration})
+PROTOBUF3_GENERATE_CPP(ProtoSourcesEosCtaGrpc ProtoHeadersEosCtaGrpc ${ProtoFilesEosCtaGrpc})
 
 # Compile gRPC code
 set(GRPC_PROTOBUF_PATH "${CMAKE_BINARY_DIR}/eos_cta/")
-grpc_generate_cpp(ProtoGrpcSourcesMigration ProtoGrpcHeadersMigration ${GRPC_PROTOBUF_PATH} ${ProtoFilesMigration})
+grpc_generate_cpp(ProtoGrpcSourcesEosCtaGrpc ProtoGrpcHeadersEosCtaGrpc ${GRPC_PROTOBUF_PATH} ${ProtoFilesEosCtaGrpc})
 
 set_source_files_properties(
   ${ProtoSourcesEosCta} ${ProtoHeadersEosCta}
-  ${ProtoSourcesMigration} ${ProtoHeadersMigration}
-  ${ProtoGrpcSourcesMigration} ${ProtoGrpcHeadersMigration}
+  ${ProtoSourcesEosCtaGrpc} ${ProtoHeadersEosCtaGrpc}
+  ${ProtoGrpcSourcesEosCtaGrpc} ${ProtoGrpcHeadersEosCtaGrpc}
   PROPERTIES GENERATED TRUE)
 
-foreach(PROTO_SRC ${ProtoSourcesEosCta} ${ProtoSourcesMigration} ${ProtoGrpcSourcesMigration})
+foreach(PROTO_SRC ${ProtoSourcesEosCta} ${ProtoSourcesEosCtaGrpc} ${ProtoGrpcSourcesEosCtaGrpc})
   set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -fPIC -Wno-narrowing -Wno-implicit-fallthrough")
 endforeach(PROTO_SRC)
 
@@ -50,8 +50,8 @@ set_target_properties(XrdSsiPbEosCta PROPERTIES
   POSITION_INDEPENDENT_CODE TRUE)
 target_link_libraries(XrdSsiPbEosCta ${PROTOBUF3_LIBRARIES})
 
-add_library(EosMigration ${ProtoSourcesMigration} ${ProtoGrpcSourcesMigration})
-set_target_properties(EosMigration PROPERTIES
+add_library(EosCtaGrpc ${ProtoSourcesEosCtaGrpc} ${ProtoGrpcSourcesEosCtaGrpc})
+set_target_properties(EosCtaGrpc PROPERTIES
   LINKER_LANGUAGE CXX
   POSITION_INDEPENDENT_CODE TRUE)
-target_link_libraries(EosMigration ${PROTOBUF3_GRPC_LIBRARIES})
+target_link_libraries(EosCtaGrpc ${PROTOBUF3_GRPC_LIBRARIES})
diff --git a/eos_cta/grpc-proto b/eos_cta/grpc-proto
new file mode 160000
index 0000000000..07bb6a537a
--- /dev/null
+++ b/eos_cta/grpc-proto
@@ -0,0 +1 @@
+Subproject commit 07bb6a537a71f043590ec4155e89a64d224c1d24
diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt
index 678d09994b..9a7933f40e 100644
--- a/xroot_plugins/CMakeLists.txt
+++ b/xroot_plugins/CMakeLists.txt
@@ -38,7 +38,7 @@ add_library(XrdSsiCta MODULE XrdSsiCtaServiceProvider.cpp XrdSsiCtaRequestProc.c
                              ../cmdline/CtaAdminCmdParse.cpp
                              GrpcClient.cpp GrpcEndpoint.cpp)
 target_link_libraries(XrdSsiCta ${XROOTD_XRDSSI_LIB} XrdSsiLib XrdSsiPbEosCta ctascheduler ctacommon ctaobjectstore ctacatalogue
-                      EosMigration ${GRPC_LIBRARY} ${GRPC_GRPC++_LIBRARY})
+                      EosCtaGrpc ${GRPC_LIBRARY} ${GRPC_GRPC++_LIBRARY})
 set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
 if (OCCI_SUPPORT)
   set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
-- 
GitLab