smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

xpClassifiedRepo enhancement PATH_URL #337

Closed smanders closed 2 years ago

smanders commented 2 years ago

the current cmake function xpClassifiedRepo https://github.com/smanders/externpro/blob/22.01/modules/xpfunmac.cmake#L1552-L1582 supports cloning git repos that are filesystem based, with the PATH_UNIX and PATH_MSW options to specify a unix- and windows-based path to the git repos

a secure room that has a git server (github, gitlab, etc) for hosting classified repos needs an additional option PATH_URL to specify the URL to the repository

smanders commented 2 years ago

the updated xpClassifiedRepo function https://github.com/smanders/externpro/blob/f1decd9659822e797609d0727eda192701330295/modules/xpfunmac.cmake#L1552-L1601

smanders commented 2 years ago

Notes

plugins that use a filesystem based classified repo will need to update their REPO parameter to drop the .git suffix (you can see in the implementation above that the .git suffix is added where/when it's needed, but when we use curl to verify the URL we don't want a .git suffix, so that's why it should now be left off)

diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt
index 5c7841c..408b73d 100644
--- a/plugin/CMakeLists.txt
+++ b/plugin/CMakeLists.txt
@@ -31,7 +31,7 @@ set_property(TARGET ${plugin_name} PROPERTY FOLDER ${folder})
 #######################################
 set(repoDir ${CMAKE_CURRENT_BINARY_DIR}/kamino)
 if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
-  xpClassifiedRepo(REPO clas_external.git VERBOSE
+  xpClassifiedRepo(REPO clas_external VERBOSE
     HASH c0279b0 # Initial Kamino commit
     WORKING_TREE ${repoDir}
     PATH_UNIX /mnt/gitRepo

you can mimic a filesystem based repo for testing purposes (outside of a secure room) by mounting a directory of git repositories to /mnt/gitRepo in the container with a docker-compose.override.yml file like the following

version: '3.8'
services:
  bld:
    volumes:
      - ~/src:/bpvol/src
      - ~/src/gitrepos:/mnt/gitRepo

here's an example of changes to a plugin to point to a git repo hosted on isrhub

diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt
index 58bf526..68334b1 100644
--- a/plugin/CMakeLists.txt
+++ b/plugin/CMakeLists.txt
@@ -30,11 +30,10 @@ target_link_libraries(${plugin_name} PRIVATE Boost::filesystem PluginApi3 SARCon
 set_property(TARGET ${plugin_name} PROPERTY FOLDER ${folder})
 #######################################
 set(repoDir ${CMAKE_CURRENT_BINARY_DIR}/resources)
-xpClassifiedRepo(REPO clas_external.git VERBOSE
-  HASH 6faa583 # Fixed swapped config values
+xpClassifiedRepo(REPO nabreak VERBOSE
+  HASH c62cde3
   WORKING_TREE ${repoDir}
-  PATH_UNIX /mnt/gitRepo
-  PATH_MSW //dev-isilon.vip.local/gitrepo
+  PATH_URL isrhub.usurf.usu.edu/smanders
   )
 #######################################
 install(TARGETS ${plugin_name}
smanders commented 2 years ago

completed with commits to dev branch referenced above