diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/return-assignment | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/return-assignment b/bin/return-assignment index 01aa6d7..e73bec4 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -86,6 +86,14 @@ if ! verbose_flock -s -n 8; then exit 1 fi +clean_up_tmp_dir() { + cd "${base_dir}" + rm -rf --one-file-system "${tmp_dir}" +} + +tmp_dir=$(mktemp -d "${work_dir}/tmp.return-assignment.XXXXXXXXXX") +trap clean_up_tmp_dir EXIT + if [ "$6" = 'ERROR' ]; then # the build failed on the build slave @@ -261,7 +269,7 @@ if [ "$6" = 'ERROR' ]; then done | \ sort -k2,2 -k1nr,1 | \ uniq -f1 > \ - "${broken_haskell_packages}" + "${tmp_dir}/broken-haskell-packages" # now we look if the broken packages have been rebuilt in the meantime haskell_rebuild_packages=$( @@ -269,7 +277,7 @@ if [ "$6" = 'ERROR' ]; then { printf 'CREATE TEMPORARY TABLE `broken`(`time_stamp` BIGINT,`pkgname` VARCHAR(64),UNIQUE KEY `pkgname`(`pkgname`),KEY `time_stamp`(`time_stamp`));\n' printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `broken`(`time_stamp`,`pkgname`);\n' \ - "${broken_haskell_packages}" + "${tmp_dir}/broken-haskell-packages" printf 'SELECT DISTINCT `broken`.`pkgname`' printf ' FROM `broken`' printf ' WHERE NOT EXISTS (' @@ -446,14 +454,7 @@ if [ -z "${build_assignment_id}" ]; then exit 2 fi -clean_up_tmp_dir() { - cd "${base_dir}" - rm -rf --one-file-system "${tmp_dir}" -} - -tmp_dir=$(mktemp -d "${work_dir}/tmp.return-assignment.XXXXXXXXXX") cd "${tmp_dir}" -trap clean_up_tmp_dir EXIT export TMPDIR="${tmp_dir}" |