Copilot commented on code in PR #13497:
URL: https://github.com/apache/trafficserver/pull/13497#discussion_r3720726830


##########
cmake/proxy-verifier.cmake:
##########
@@ -35,22 +36,29 @@ if(NOT PROXY_VERIFIER_HASH)
   message(FATAL_ERROR "PROXY_VERIFIER_HASH Required")
 endif()
 
-# GIT_COMMON_DIR is set by the top-level CMakeLists.txt.
-if(NOT GIT_COMMON_DIR)
-  message(FATAL_ERROR "GIT_COMMON_DIR not set. This should be set by the 
top-level CMakeLists.txt")
+# Prefer the git common directory (set by the top-level CMakeLists.txt) so the 
download is shared by
+# every worktree and build directory of the same clone. It isn't always 
available -- a source tree
+# exported without .git, or a worktree whose common directory sits outside the 
paths visible to the
+# build, such as when the worktree alone is mapped into a container. Fall back 
to the build
+# directory, which always exists and is writable, rather than failing the 
configure.
+if(GIT_COMMON_DIR)
+  set(PV_DEST_DIR "${GIT_COMMON_DIR}")
+else()
+  set(PV_DEST_DIR "${CMAKE_BINARY_DIR}")
+  message(STATUS "GIT_COMMON_DIR not set, storing proxy-verifier in the build 
directory instead")
 endif()
 
 # Convert to absolute path (handles relative .git from regular non-worktree 
clones).
-get_filename_component(GIT_COMMON_DIR "${GIT_COMMON_DIR}" ABSOLUTE BASE_DIR 
"${CMAKE_SOURCE_DIR}")
+get_filename_component(PV_DEST_DIR "${PV_DEST_DIR}" ABSOLUTE BASE_DIR 
"${CMAKE_SOURCE_DIR}")
 
-# Download proxy-verifier to git common directory.
-set(PV_ARCHIVE ${GIT_COMMON_DIR}/proxy-verifier/proxy-verifier.tar.gz)
+# Download proxy-verifier to the destination directory.
+set(PV_ARCHIVE ${PV_DEST_DIR}/proxy-verifier/proxy-verifier.tar.gz)
 file(
   DOWNLOAD 
https://ci.trafficserver.apache.org/bintray/proxy-verifier-${PROXY_VERIFIER_VERSION}.tar.gz
 ${PV_ARCHIVE}
   EXPECTED_HASH ${PROXY_VERIFIER_HASH}
   SHOW_PROGRESS
 )
-file(ARCHIVE_EXTRACT INPUT ${PV_ARCHIVE} DESTINATION ${GIT_COMMON_DIR})
+file(ARCHIVE_EXTRACT INPUT ${PV_ARCHIVE} DESTINATION ${PV_DEST_DIR})

Review Comment:
   `file(DOWNLOAD ...)` will fail if the parent directory for `${PV_ARCHIVE}` 
does not exist (e.g., `${PV_DEST_DIR}/proxy-verifier`). Since the new fallback 
commonly points at a fresh build directory, this is more likely to happen now. 
Create `${PV_DEST_DIR}/proxy-verifier` (e.g., via `file(MAKE_DIRECTORY ...)`) 
before downloading.



##########
cmake/proxy-verifier.cmake:
##########
@@ -15,14 +15,15 @@
 #
 #######################
 
-# This will download and extract proxy-verifier to git common directory and 
setup variables to point to it.
+# This will download and extract proxy-verifier to PV_DEST_DIR and setup 
variables to point to it.

Review Comment:
   Use the correct verb form `set up` instead of `setup` in this comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to