diff options
author | EuAndreh <eu@euandre.org> | 2021-07-15 14:56:58 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-07-15 15:22:12 -0300 |
commit | 42354876de823f52a431eac900d360c074c6198d (patch) | |
tree | 0b640a85a4375d51c01b9f05937eb562e776a5bf /aux/ci/ci-build.sh | |
parent | TODOs.md: Add #task-f4807694-2187-5cb5-115e-c5970a052f1f (diff) | |
download | git-permalink-42354876de823f52a431eac900d360c074c6198d.tar.gz git-permalink-42354876de823f52a431eac900d360c074c6198d.tar.xz |
aux/lib.sh: Add mkstemp and mkdtemp, and copy uuid over
The tests were relying on the unspecified and non-standartized
behaviour of "mktemp". Now they use "mkstemp()", a shim sh function to
provide the expected behaviour, and an accompanying "mkdtemp()"
function is also defined.
To further decouple from specific implementations and OS-behaviours and
quirks, a aux/lib.sh file containing both those functions was added.
Its purpose is to also allow code under aux/ to not depend on specific
behaviour.
"mkdtemp()" had to be replicated in aux/ci/ci-build.sh, since it runs
outside the repository.
Diffstat (limited to 'aux/ci/ci-build.sh')
-rwxr-xr-x | aux/ci/ci-build.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh index be97866..74e9558 100755 --- a/aux/ci/ci-build.sh +++ b/aux/ci/ci-build.sh @@ -7,6 +7,13 @@ read -r _ SHA _ # oldrev newrev refname FILENAME="$(date -Is)-$SHA.log" LOGFILE="$LOGS_DIR/$FILENAME" +mkdtemp() { + name="$(echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + { echo "Starting CI job at: $(date -Is)" @@ -35,7 +42,7 @@ EOF unset GIT_DIR REMOTE="$PWD" - cd "$(mktemp -d)" + cd "$(mkdtemp)" git clone "$REMOTE" . git config --global user.email git@euandre.org git config --global user.name 'EuAndreh CI' |