| # SPDX-FileCopyrightText: 2018-2022 Open Networking Foundation |
| # SPDX-License-Identifier: Apache-2.0 |
| # downloads a patch to within an already checked out repo tree |
| # verify that we have repo installed |
| command -v repo >/dev/null 2>&1 || { echo "repo not found, please install it" >&2; exit 1; } |
| echo "BASEDIR: ${BASEDIR}" |
| echo "GERRIT_PROJECT: ${GERRIT_PROJECT}" |
| echo "GERRIT_CHANGE_NUMBER: ${GERRIT_CHANGE_NUMBER}" |
| echo "GERRIT_PATCHSET_NUMBER: ${GERRIT_PATCHSET_NUMBER}" |
| echo "Checking out a patchset with repo, using repo version:" |
| PROJECT_PATH=$(xmllint --xpath "string(//project[@name=\"${GERRIT_PROJECT}\"]/@path)" .repo/manifests/default.xml) |
| if [ -z "$PROJECT_PATH" ] |
| echo "WARNING: Project not in repo! Not downloading the changeset." |
| echo "Project Path: $PROJECT_PATH" |
| repo download "${PROJECT_PATH}" "$GERRIT_CHANGE_NUMBER/${GERRIT_PATCHSET_NUMBER}" |