From 215dd01a446d0d22f476384cbfa77a77fa757bfa Mon Sep 17 00:00:00 2001 From: Jackeagle <116548-Jackeagle@users.noreply.gitlab.e.foundation> Date: Fri, 28 Feb 2025 01:37:34 -0500 Subject: [PATCH 1/2] build-community: Show full repo init command Signed-off-by: Jackeagle --- build-community.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-community.sh b/build-community.sh index 6060ace..30b1930 100755 --- a/build-community.sh +++ b/build-community.sh @@ -152,7 +152,7 @@ for branch in ${BRANCH_NAME//,/ }; do echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" TAG_PREFIX="refs/tags/" fi - + echo "repo init -u $REPO -b ${TAG_PREFIX}$branch" yes | repo init -u "$REPO" -b "${TAG_PREFIX}$branch" &>>"$repo_log" fi -- GitLab From 8cb3a0b650ad77cebee609b91df222889b0eeb14 Mon Sep 17 00:00:00 2001 From: Jackeagle <116548-Jackeagle@users.noreply.gitlab.e.foundation> Date: Fri, 28 Feb 2025 01:37:52 -0500 Subject: [PATCH 2/2] build-community.sh: Fixed incorrect tag detection logic in repo init. - Previously, the API search used substring matching, causing false positives (e.g., 'a14' incorrectly matched 'v2.8-beta.2-a14'). - Now, we fetch all tags and use exact matching (`grep -Fx`) to determine if BRANCH_NAME is a tag. Signed-off-by: Jackeagle --- build-community.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/build-community.sh b/build-community.sh index 30b1930..1b4ac01 100755 --- a/build-community.sh +++ b/build-community.sh @@ -144,18 +144,26 @@ for branch in ${BRANCH_NAME//,/ }; do done echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" + if [ "$LOCAL_MIRROR" = true ]; then - yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>>"$repo_log" + repo_cmd="yes | repo init -u \"$REPO\" --reference \"$MIRROR_DIR\" -b \"$branch\"" else - TAG_PREFIX="" - if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -q "${BRANCH_NAME}"; then - echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" - TAG_PREFIX="refs/tags/" - fi - echo "repo init -u $REPO -b ${TAG_PREFIX}$branch" - yes | repo init -u "$REPO" -b "${TAG_PREFIX}$branch" &>>"$repo_log" + TAG_PREFIX="" + + # Fetch all tags and check for an exact match + TAG_MATCH=$(curl -s --fail https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -Fx "${BRANCH_NAME}") + + if [ -n "$TAG_MATCH" ]; then + echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefixing with refs/tags/ for 'repo init'" | tee -a "$repo_log" + TAG_PREFIX="refs/tags/" + fi + + repo_cmd="yes | repo init -u \"$REPO\" -b \"${TAG_PREFIX}$branch\"" fi + echo ">> [$(date)] Running: $repo_cmd" | tee -a "$repo_log" + eval "$repo_cmd" &>>"$repo_log" || { echo ">> [$(date)] ERROR: Failed to initialize repository" | tee -a "$repo_log"; exit 1; } + # Copy local manifests to the appropriate folder in order take them into consideration echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" mkdir -p .repo/local_manifests -- GitLab