# Pastebin oPwDE5pt # There must be an apt-cacher-ng installation on the host. proxy_url=http://$(shell ip -br address show dev eth0 | awk '{print $$3}' | cut -d / -f 1):3142 # Packages that are not required for building snapd but are useful for interactive development. packages=git sbuild mc devscripts avahi-daemon ssh vim-nox rsync # Helpful function for running a command on the remote machine. # Assumes that the target name ends with machine name, like below. remote=multipass exec $* -- PHONY: help help: @echo "Availale targets" @echo " create-NAME: create a multipass virtual machine" @echo " prepare-NAME: prepare a virtual machine for building packages" @echo " destroy-NAME: destroy a multipass virtual machine" @echo " build-on-NAME: copy a source package and build it on a virtual machine" @echo @echo "Available names are: debian-9 debian-10" @echo "NOTE: You must provide the source package yourself" .PHONY: create-debian-9 create-debian-9: multipass launch -n debian-9 -c 8 -m 4G https://cdimage.debian.org/mirror/cdimage/openstack/current/debian-9.6.4-20190118-openstack-amd64.qcow2 .PHONY: create-debian-10 create-debian-10: multipass launch -n debian-10 -c 8 -m 4G https://cdimage.debian.org/mirror/cdimage/openstack/testing/debian-testing-openstack-amd64.qcow2 .PHONY: prepare-debian-9 prepare-debian-10 prepare-debian-9 prepare-debian-10: prepare-%: $(remote) sudo mkdir -p /etc/apt/apt.conf.d/ $(remote) sudo sh -c 'echo "Acquire::HTTP::Proxy \"$(proxy_url)\";" > /etc/apt/apt.conf.d/00proxy' -$(remote) sudo apt-get update $(remote) sudo apt-get dist-upgrade -y $(remote) sudo apt-get install -y $(packages) $(remote) sudo apt-get autoremove -y $(remote) sudo sbuild-adduser $(shell $(remote) whoami) $(remote) cp /usr/share/doc/sbuild/examples/example.sbuildrc /home/multipass/.sbuildrc #$(remote) sudo rm -f /etc/schroot/chroot.d/sid-amd64-sbuild-* #$(remote) sudo rm -rf /srv/chroot/sid-amd64-sbuild # NOTE: the chroot is always for sid, this is mainly to test the impact of the kernel. $(remote) sudo sbuild-createchroot --include=eatmydata,ccache,gnupg sid /srv/chroot/sid-amd64-sbuild $(proxy_url)/debian .PHONY: destroy-debian-9 destroy-debian-10 destroy-debian-9 destroy-debian-10: destroy-debian-%: multipass delete $* multipass purge build-on-debian-9 build-on-debian-10: build-on-%: multipass copy-files snapd_*.debian.tar.xz snapd_*.dsc snapd_*.orig.tar.xz snapd-*.tar.gz $*:/home/multipass/ $(remote) sbuild -d sid snapd_$(shell ls *.dsc | sort -r -n | head -n 1).dsc