repotest: clean up via trap
In the case of early exit, the script could leave tempfiles laying
around. Use `trap` to ensure they're properly cleaned up.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I403dcacbd15227e445d50ccb2c2627675376fdcd
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index 1111d0d..0a2f4fb 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -11,6 +11,7 @@
patch_files_tmp=$(mktemp)
allowed_patches_tmp=$(mktemp)
+trap "rm $patch_files_tmp $allowed_patches_tmp" exit
git -C "$obmc_dir" ls-files -- \
'*.patch' \
@@ -64,11 +65,7 @@
meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-version-parsing-update-AUX-revision-info.patch
" | sort > $allowed_patches_tmp
-
-
files_diff=$(comm -23 $patch_files_tmp $allowed_patches_tmp)
-rm $allowed_patches_tmp
-rm $patch_files_tmp
files_count=$(echo -n "$files_diff" | grep -c '^' || true)
if [[ $files_count -ne 0 ]]; then