Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cov_docker_script/build_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_FILE="${1:-$SCRIPT_DIR/component_config.json}"
COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}"
COMPONENT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code now computes COMPONENT_DIR as two directories above SCRIPT_DIR instead of using the second parameter. However, line 60 in common_external_build.sh still passes a second parameter when calling this script. This change breaks the calling convention. Either:

  1. Restore the previous behavior: COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}"
  2. Or update all callers to not pass the second parameter and update the usage documentation

Additionally, the new calculation assumes a specific directory structure (SCRIPT_DIR is two levels deep from component root), which may not always be correct if scripts are called from different locations or if the directory structure changes.

Suggested change
COMPONENT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
COMPONENT_DIR="${2:-$(cd "$SCRIPT_DIR/.." && pwd)}"

Copilot uses AI. Check for mistakes.

# Source common utilities
source "$SCRIPT_DIR/common_build_utils.sh"
Expand Down
29 changes: 24 additions & 5 deletions cov_docker_script/common_build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ clone_repo() {
return 1
fi
ok "$name cloned successfully"

if [[ -f "$dest/.gitmodules" ]]; then
git -C "$dest" submodule update --init --recursive --remote || {
err "$name git submodule update failed"
return 1
}
ok "$name git submodule update done!"
else
ok "$name has no submodules, skipping submodule update"
fi
return 0
}

Expand All @@ -69,7 +79,7 @@ copy_headers() {

if [[ -d "$src" ]]; then
log "Copying headers: $src → $dst"
if ! find "$src" -maxdepth 1 -name "*.h" -exec cp {} "$dst/" \; 2>/dev/null; then
if ! find "$src" -maxdepth 1 -name "*.h*" -exec cp {} "$dst/" \; 2>/dev/null; then
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the pattern from ".h" to ".h*" is overly broad and will match unintended files such as .h.in, .h.orig, .h.bak, .html, etc. If the goal is to include C++ headers (.hpp, .hxx, .hh), use a more specific pattern like -name ".h" -o -name ".hpp" -o -name ".hxx" -o -name ".hh" instead.

Suggested change
if ! find "$src" -maxdepth 1 -name "*.h*" -exec cp {} "$dst/" \; 2>/dev/null; then
if ! find "$src" -maxdepth 1 \( -name "*.h" -o -name "*.hpp" -o -name "*.hxx" -o -name "*.hh" \) -exec cp {} "$dst/" \; 2>/dev/null; then

Copilot uses AI. Check for mistakes.
warn "No headers found in $src"
fi
else
Expand Down Expand Up @@ -252,15 +262,24 @@ build_meson() {
execute_commands() {
local repo_dir="$1" config_file="$2" index="$3"

pushd "$repo_dir" >/dev/null || return 1

# Read command count and commands BEFORE changing directories
local cmd_count
cmd_count=$(jq ".dependencies.repos[$index].build.commands | length" "$config_file")

# Read all commands into an array before pushd
local commands=()
local i=0
while [[ $i -lt $cmd_count ]]; do
local cmd
cmd=$(jq -r ".dependencies.repos[$index].build.commands[$i]" "$config_file")
commands+=("$(jq -r ".dependencies.repos[$index].build.commands[$i]" "$config_file")")
i=$((i + 1))
done

pushd "$repo_dir" >/dev/null || return 1

# Execute commands from the array
i=0
while [[ $i -lt $cmd_count ]]; do
local cmd="${commands[$i]}"
step "Executing: $cmd"
if ! eval "$cmd"; then
err "Command failed: $cmd"
Expand Down
2 changes: 1 addition & 1 deletion cov_docker_script/setup_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ build_repository() {
export PARENT_USR_DIR="$USR_DIR"

pushd "$repo_dir" >/dev/null || return 1
if ! "$full_script"; then
if ! "$full_script" "$CONFIG_FILE"; then
err "Build script failed"
popd >/dev/null
return 1
Expand Down
Loading