关于devtools每次准备干净chroot的过程慢,可以考虑做一个btrfs镜像挂载到/var/lib/archbuild,先清空/var/lib/archbuild,制作如下:
truncate -s 20G /var/archbuild.img
mkfs.btrfs /var/archbuild.img
mount -o discard,compress=lzo,autodefrag /var/archbuild.img /var/lib/archbuild
echo "/var/archbuild.img /var/lib/archbuild btrfs defaults,discard,compress=lzo,autodefrag 0 0" >> /etc/fstab

如果有足够内存,可以考虑使用tmpfs,制作如下:
mkdir -p /mnt/chroots/arch
mount -t tmpfs -o defaults,size=20G /mnt/chroots/arch
extra-x86_64-build -c -r /mnt/chroots/arch最后写入/etc/fstab,作开机挂载

另外,关于devtools,编译程序时,某些程式需要依赖库,可以考虑制作本地pacman仓库,制作如下:
mkdir /archLocalRepo
把需要的制作本地仓库的软件包复制到以上目录,再生成仓库的index:
repo-add /archLocalRepo/archLocalRepo.db.tar.gz /archLocalRepo/*

会在目录生成出archLocalRepo.db,再/usr/share/devtools/pacman-extra.conf末尾配置本地源,如下:
[archLocalRepo]
SigLevel = Optional TrustAll
Server = file:///archLocalRepo

另外关于devtools其他问题:
如何传入makepkg的命令行参数,比如如果我想跳过测试?
extra-x86_64-build -- -- --nocheck

某个目标的chroot损坏了,如何清空重来?
extra-x86_64-build -c

软件包的依赖不在官方仓库中,如何把这个包"塞"到编译环境中?
extra-x86_64-build -- -I /var/cache/pacman/pkg/your-package-0-x86_64.pkg.tar.xz

最后devtools的目标仓库和对应的命令和配置文件,如下:
目标仓库
架构
使用的编译命令
Pacman使用的配置文件
extra/community
x86_64
extra-x86_64-build
/usr/share/devtools/pacman-extra.conf
testing/community-testing
x86_64
testing-x86_64-build
/usr/share/devtools/pacman-testing.conf
staging/community-staging 
x86_64
staging-x86_64-build
/usr/share/devtools/pacman-staging.conf
multilib
x86_64
multilib-build
/usr/share/devtools/pacman-multilib.conf
multilib-testing
x86_64
multilib-testing-build
/usr/share/devtools/pacman-multilib-testing.conf
multilib-staging
x86_64
multilib-staging-build
/usr/share/devtools/pacman-multilib-staging.conf


暂时写到这里,以后再添加

参考连接:
https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_clean_chroot
https://www.vultr.com/docs/building-packages-on-arch-linux
09-25 17:06