puppetlabs/packaging — pull request #114 by MosesMendoza (2013-03-07 18:34:39+00:00)
Title: Successfully clean up mock root after builds

Currently we just use rm_rf to clean the random build root, and this poses two
problems. 1) because of the -f flag, we don't see any failures to rm and 2)
because the mock root has files owned by root, we don't actually remove it.
This commit updates mock clean up to attempt a sudo command (in this case, just
echoing a status) and use its success/failure to determine if the user has sudo
privileges. If so, we sudo rm the build root. If not, we print an error that
the build root is not getting cleaned.

Signed-off-by: Moses Mendoza