From 648d8a405519aa59f28b34f8248a17136894f5dc Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 00:22:56 +0530 Subject: [PATCH 1/6] Update common_build_utils.sh --- cov_docker_script/common_build_utils.sh | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cov_docker_script/common_build_utils.sh b/cov_docker_script/common_build_utils.sh index 0bb9f88..0f3d9da 100755 --- a/cov_docker_script/common_build_utils.sh +++ b/cov_docker_script/common_build_utils.sh @@ -129,6 +129,35 @@ apply_patch() { return 0 fi + if [[ "$type" == "patch_file" ]]; then + # For patch_file type, 'search' parameter contains the patch file path + local patch_file="$search" + local repo_dir="$file" + + # Expand environment variables in patch file path + patch_file=$(eval echo "$patch_file") + + if [[ ! -f "$patch_file" ]]; then + err "Patch file not found: $patch_file" + return 1 + fi + + log "Applying patch file: $patch_file to $repo_dir" + + pushd "$repo_dir" >/dev/null || return 1 + + # Apply the patch using patch -p1 + if ! patch -p1 < "$patch_file"; then + err "Failed to apply patch file: $patch_file" + popd >/dev/null + return 1 + fi + + popd >/dev/null + ok "Patch file applied successfully" + return 0 + fi + if [[ ! -f "$file" ]]; then err "Patch target not found: $file" return 1 From 4e1ceea4d2374e00e83701f8c16d44ac9f6e65fb Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 00:23:25 +0530 Subject: [PATCH 2/6] Update setup_dependencies.sh --- cov_docker_script/setup_dependencies.sh | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh index 7a5828f..1a8479e 100755 --- a/cov_docker_script/setup_dependencies.sh +++ b/cov_docker_script/setup_dependencies.sh @@ -24,6 +24,69 @@ fi check_dependencies || exit 1 +# Apply source patches for a dependency +apply_dependency_patches() { + local index=$1 + local repo_dir=$2 + local name=$3 + + local patch_count + patch_count=$(jq -r ".dependencies.repos[$index].source_patches // [] | length" "$CONFIG_FILE") + + if [[ "$patch_count" -eq 0 ]]; then + return 0 + fi + + step "Applying source patches for $name ($patch_count patches)" + + local i=0 + while [[ $i -lt $patch_count ]]; do + local file search replace type content patch_file + file=$(jq -r ".dependencies.repos[$index].source_patches[$i].file" "$CONFIG_FILE") + type=$(jq -r ".dependencies.repos[$index].source_patches[$i].type // \"replace\"" "$CONFIG_FILE") + + if [[ "$type" == "patch_file" ]]; then + # For patch_file type, get the patch file path + patch_file=$(jq -r ".dependencies.repos[$index].source_patches[$i].patch_file" "$CONFIG_FILE") + + # Expand $HOME and $BUILD_DIR in patch file path + local expanded_patch_file=$(expand_path "$patch_file") + + # For patch_file, 'file' should point to the repo directory, and patch file goes in 'search' param + if ! apply_patch "$repo_dir" "$expanded_patch_file" "" "$type" ""; then + err "Failed to apply patch $((i+1))/$patch_count for $name" + return 1 + fi + else + # For replace/create types + search=$(jq -r ".dependencies.repos[$index].source_patches[$i].search // \"\"" "$CONFIG_FILE") + replace=$(jq -r ".dependencies.repos[$index].source_patches[$i].replace // \"\"" "$CONFIG_FILE") + content=$(jq -r ".dependencies.repos[$index].source_patches[$i].content // \"\"" "$CONFIG_FILE") + + # Expand $HOME in file path, then resolve relative paths from repo_dir + local expanded_file=$(expand_path "$file") + local target_file + if [[ "$expanded_file" = /* ]]; then + # Absolute path - use as is + target_file="$expanded_file" + else + # Relative path - prepend repo_dir + target_file="$repo_dir/$expanded_file" + fi + + if ! apply_patch "$target_file" "$search" "$replace" "$type" "$content"; then + err "Failed to apply patch $((i+1))/$patch_count for $name" + return 1 + fi + fi + + i=$((i + 1)) + done + + ok "Applied $patch_count patches for $name" + return 0 +} + # Initialize environment initialize_environment() { print_banner "Dependency Setup" @@ -196,6 +259,12 @@ process_dependency() { return 1 fi + # Apply source patches + if ! apply_dependency_patches "$index" "$repo_dir" "$name"; then + err "Failed to apply patches for $name" + return 1 + fi + # Copy headers if ! process_headers "$index" "$repo_dir" "$name"; then err "Failed to copy headers for $name" From 87d683ae35a1dcd7e1a1559142a6047941261043 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 00:39:41 +0530 Subject: [PATCH 3/6] Update common_build_utils.sh --- cov_docker_script/common_build_utils.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cov_docker_script/common_build_utils.sh b/cov_docker_script/common_build_utils.sh index 0f3d9da..53b4ced 100755 --- a/cov_docker_script/common_build_utils.sh +++ b/cov_docker_script/common_build_utils.sh @@ -49,8 +49,15 @@ clone_repo() { return 0 fi + # Use GITHUB_TOKEN if available and repo is from github.com + local clone_url="$repo" + if [[ -n "$GITHUB_TOKEN" ]] && [[ "$repo" == *"github.com"* ]]; then + # Replace https://github.com with https://TOKEN@github.com + clone_url="${repo//https:\/\/github.com/https://${GITHUB_TOKEN}@github.com}" + fi + log "Cloning $name (branch: $branch)" - if ! git clone --branch "$branch" "$repo" "$dest" --depth 1; then + if ! git clone --branch "$branch" "$clone_url" "$dest" --depth 1; then err "Failed to clone $name" return 1 fi From 25255f7f3d21674775d2dd31b3c67a6582cb190c Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 00:53:04 +0530 Subject: [PATCH 4/6] Update setup_dependencies.sh --- cov_docker_script/setup_dependencies.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh index 1a8479e..fb544d2 100755 --- a/cov_docker_script/setup_dependencies.sh +++ b/cov_docker_script/setup_dependencies.sh @@ -259,6 +259,14 @@ process_dependency() { return 1 fi + # Debug: List directory structure for entservices-testframework + if [[ "$name" == "entservices-testframework" ]]; then + log "Directory structure of entservices-testframework:" + find "$repo_dir" -maxdepth 3 -type d | head -20 + log "Looking for patches:" + find "$repo_dir" -name "*.patch" -o -name "patches" -type d | head -10 + fi + # Apply source patches if ! apply_dependency_patches "$index" "$repo_dir" "$name"; then err "Failed to apply patches for $name" From 2a9bf28f7cf8930ee342571c1a99c825f59bef77 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 00:57:54 +0530 Subject: [PATCH 5/6] Update setup_dependencies.sh --- cov_docker_script/setup_dependencies.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh index fb544d2..1c59385 100755 --- a/cov_docker_script/setup_dependencies.sh +++ b/cov_docker_script/setup_dependencies.sh @@ -262,9 +262,9 @@ process_dependency() { # Debug: List directory structure for entservices-testframework if [[ "$name" == "entservices-testframework" ]]; then log "Directory structure of entservices-testframework:" - find "$repo_dir" -maxdepth 3 -type d | head -20 - log "Looking for patches:" - find "$repo_dir" -name "*.patch" -o -name "patches" -type d | head -10 + ls -laR "$repo_dir" | head -100 + log "Searching for all files:" + find "$repo_dir" -type f | head -50 fi # Apply source patches From 91e540cb61773f54c10d03c36c508503680e11d1 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:57:44 +0530 Subject: [PATCH 6/6] Update setup_dependencies.sh --- cov_docker_script/setup_dependencies.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cov_docker_script/setup_dependencies.sh b/cov_docker_script/setup_dependencies.sh index 1c59385..1a8479e 100755 --- a/cov_docker_script/setup_dependencies.sh +++ b/cov_docker_script/setup_dependencies.sh @@ -259,14 +259,6 @@ process_dependency() { return 1 fi - # Debug: List directory structure for entservices-testframework - if [[ "$name" == "entservices-testframework" ]]; then - log "Directory structure of entservices-testframework:" - ls -laR "$repo_dir" | head -100 - log "Searching for all files:" - find "$repo_dir" -type f | head -50 - fi - # Apply source patches if ! apply_dependency_patches "$index" "$repo_dir" "$name"; then err "Failed to apply patches for $name"