[build-in-chroot.sh] Changelog:

* Threading/parallel execution issues should be solved once and for all
  - Each process gets it's own cache directory (copy of
    /var/cache/pacman/pkg/)
  - New structure
    + Split into four distinct stages: download, build, publish. The
      download stage is mutually exclusive as it needs to touch the
      shared cache directory. The publish stage is also mutually
      exclusive for the same reason.
    + Download stage:
      1. Build a mini-chroot containing only database files (x86_64 and
         i686 databases can't both go in /var/lib/pacman/sync/ on the
         host)
      2. Remove any packages in the local repo from the host's pacman
         cache
      3. Download the base packages for the chroot into the host's
         cache
      4. Download the dependencies and build dependencies for the
         target package into the host's cache, skipping any packages
         present in the local repository
      5. Copy the host's pacman cache to a temporary directory for use
         during the build process
    + Build stage:
      1. Create chroot with base packages. All the needed packages
         should have been downloaded already
      2. Set up /etc/makepkg.conf, /etc/pacman.conf, and the sudo
         configuration
      3. Copy packaging into chroot
      4. Create new build user inside chroot and set the appropriate
         permissions
      5. Update pacman databases inside chroot and download remaining
         packages, which should only be those in the local repo and
         those that were updated between this stage and the previous
         stage
      6. Build package
    + Publish stage:
      1. Optionally copy built packages to PKGBUILD directory
      2. Remove old database for local repo
      3. Copy built packages to local repo
      4. Build database for local repo
* Avoid reading PKGBUILD files as root
* Removed locks where they were no longer required
* Make sure the mini-chroot, temporary cache directory and nobody-user-
  readable PKGBUILD are removed on exit