updpkgsums: use a throwaway build dir

This prevents updpkgsums from potentially dirtying an otherwise pristine
directory (likely $PWD) when makepkg creates the srclinks.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dave Reisner 2014-09-07 12:37:34 -04:00 committed by Allan McRae
parent ee207d7c7b
commit d9cf14ff1d
1 changed files with 2 additions and 0 deletions

View File

@ -79,6 +79,8 @@ fi
# Generate the new sums and try to unlink the file before writing stdin back
# into it. This final precaution shouldn't fail based on the previous checks,
# but it's better to be extra careful before unlinking files.
export BUILDDIR=$(mktemp -d --tmpdir updpkgsums.XXXXXX)
trap "rm -rf '$BUILDDIR'" EXIT
newsums=$(makepkg -g -p "$buildfile") && rm -f "$buildfile" &&
exec awk -v newsums="$newsums" '
/^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*(#.*)?$/ {