diff --git a/update_test_binaries.sh b/update_test_binaries.sh index cddc6dd5a33592d96793c751f6fa34f6afaa3d2d..5470bec87d63bf4666a5c0286b005fbdc8699e87 100755 --- a/update_test_binaries.sh +++ b/update_test_binaries.sh @@ -44,6 +44,8 @@ if [ -z "$release" -o -z "$repository" ] ; then exit 1 fi +repository=$(readlink -f "${repository}") + if [ -n "${workdir}" ]; then mkdir -p "${workdir}" pushd "${workdir}" @@ -51,7 +53,7 @@ fi RELEASE=${release} BRANCH=${branch} -TEST=${repository} +TEST=$(basename ${repository}) SOURCES="target development" ARCHS="amd64 armhf arm64" PACKAGES="" @@ -113,11 +115,11 @@ download_extract_packages () { get_package ${PACKAGE} dpkg --extract ${PACKAGE}_*_${ARCH}.deb ${EXTRACT} fi - done < "${TEST}/external-binaries.cfg" + done < "${repository}/external-binaries.cfg" } test_repository_requires_binaries () { - [ -f "${TEST}/external-binaries.cfg" ] || return 1 + [ -f "${repository}/external-binaries.cfg" ] || return 1 return 0 } @@ -168,7 +170,7 @@ update_test_repository () { local DIR="bin" [ -n "$PREFIX" ] && DIR=$PREFIX local TARGET="${ARCH}/${DIR}" - mkdir -p "${TEST}/${TARGET}" + mkdir -p "${repository}/${TARGET}" if [ -n "$FILENAME" ]; then TARGET="${TARGET}/${FILENAME}" @@ -176,31 +178,31 @@ update_test_repository () { TARGET="${TARGET}/$(basename ${FILE})" fi - cp ${FILE} ${TEST}/${TARGET} + cp ${FILE} ${repository}/${TARGET} - git -C ${TEST} add "${TARGET}" + git -C ${repository} add "${TARGET}" # Prepare the commit message (with a new line) echo $(ls ${PACKAGE}_*_${ARCH}.deb)" ${TARGET}" >> ${TEST}-commit-msg.txt done - done < "${TEST}/external-binaries.cfg" + done < "${repository}/external-binaries.cfg" } # cleanup the target directory to not include the stalled binaries cleanup_test_repository () { local ARCH=$1 [ -z "${ARCH}" ] && exit 1 - [ -d "${TEST}/${ARCH}" ] && rm -rf "${TEST}/${ARCH}" || : + [ -d "${repository}/${ARCH}" ] && rm -rf "${repository}/${ARCH}" || : } commit_all () { - local GIT="git -C ${TEST}" + local GIT="git -C ${repository}" local CHANGES=$(${GIT} diff-index --name-only HEAD --) if [ -n "${CHANGES}" ]; then ${GIT} config --local "user.email" "testbot@apertis.org" ${GIT} config --local "user.name" "Apertis Test Bot" - ${GIT} commit -s -F ../${TEST}-commit-msg.txt -- ${ARCHS} + ${GIT} commit -s -F "${workdir}/${TEST}-commit-msg.txt" -- ${ARCHS} if [ -z "$dry_run" ]; then ${GIT} push origin HEAD:${BRANCH} fi