llvm_tools: Clean up on apply_all_from_json

At present, update_chromeos_llvm_hash.py will keep
trying to apply patches from separate llvm subprojects,
to the same LLVM dir. This causes patches to stack,
so that the second time it applies the same patch
it then fails to apply.

This commit fixes the issue by cleaning up the git
directory on every stage of the loop.

This commit also fixes some type casts.

BUG=b:239279349, b:239280701
TEST=./update_chromeos_llvm_hash_unittest.py
TEST=./update_packages_and_run_tests.py \
     --extra_change_lists 1394249 1986966 \
     --chroot_path $CROS_ROOT \
     --llvm_version google3 cq

Change-Id: I6cc853d80c47fefaba4ff0b5133787b716177567
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3780679
Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Reviewed-by: Christopher Di Bella <cjdb@google.com>
Commit-Queue: Christopher Di Bella <cjdb@google.com>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
2 files changed