archbuild: only use base-devel to new chroot

Since TODO [1] which state:
It would be good for base-devel to install everything needed for a build chroot
we can remove base and sudo

[1] https://www.archlinux.org/todo/add-more-to-base-devel/

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
makechrootpkg: Stat chrootdir type after existancy

Move detection of chrootdir type after have check if the directory exists.

This avoid the following messages when -r is not given
stat: cannot read file system information for '': No such file or directory

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
use nspawn to bind mount needed directories

systemd-nspawn is capable of doing this as of systemd-198. Doing this
means we can remove all of our home grown chroot mount/umount logic, as
it's all performed by pacstrap or systemd-nspawn.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
mkarchroot: Create working directory if needed
mkarchroot: code cleanup
Simplify update call as pacman does no longer support SyncFirst
Sync pacman.conf and makepkg.conf with pacman 4.1
Only try to use btrfs snapshots if chroots are on a btrfs partition
Bump the chroot version as we changed the default package set
Prepare release
mkarchroot: Fix creation of btrfs snapshot and remove force option
makechrootpkg: Add option to build in temp chroot

Add option -T to build in a temporary chroot. This apply to any kind of
filesytem and allow to easily parrallelize builds.

This patch also simplify how $default_copy and $copy are defined.

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Prepare release
mkarchroot: Refactor chroot running into a new script

Separates the two features of mkarchroot. Provides users of the new
arch-nspawn with the full feature set of systemd-nspawn.

For example, this can be used to bind custom directories into the chroot.
arch-nspawn: Set machine name

Recent changes to systemd-nspawn have it take the machine name from
the chroot dir name, which isn't unique enough for our setup.
lib/common.sh: Introduce locking helper functions

Reduces code duplication.

With makechrootpkg not calling mkarchroot anymore,
the lock handover protocol is unneeded.

arch-nspawn does not do any locking, so add protection to archbuild.
makechrootpkg: Remove add_to_db feature

I don't think this is much use in our common workflow. Our pacman
configs don't even make a reference to /repo.
makechrootpkg: Avoid parsing PKGBUILD and support VCS sources

 - Ensure sources are available before entering chroot
 - Bind STARTDIR and SRCDEST into the chroot read-only
 - Refactor makechrootpkg and introduce meaningful functions

Avoids copying stuff from/to the chroot as much as possible. With
VCS sources these copies can get quite expensive.
arch-nspawn: setarch to CARCH

Allows calling makechrootpkg without worrying about the architecture
makechrootpkg: Ensure we have a writable PKGBUILD

For pkgver updates.