makechrootpkg: use a trap to cleanup throwaway build dir

If makepkg fails to download or verify sources, it will die without
cleaning up the temporary build dir. Use a trap to ensure that on
return or exit, it's done anyways.

Since we're touching this function, clean it up to avoid some
unnecessary subshelling and extra invocations. env isn't needed since
sudo treats leading key=val pairs as environment to inject.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
commitpkg: check all files at once for version control

Instead of dying at the first sight of an unversioned file, this lets
commitpkg dump all known unversioned files at once.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
makechrootpkg: Look harder for -R argument

We shouldn't be in the business of reparsing makepkg's arguments, but
since we have to treat the case of repackaging separately, do a better
job of trying to find signs of it happening. This change lets you pass
the longopt, --repackage, or multiple shortopts such as -RA, and still
get the intended effect.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>