hacking: add make vmoverlay for faster hacking

For the regular hack/build/test cycles, creating a new deployment each
time becomes overkill. We add a new `make vmoverlay` target which
directly overlays the newly built binaries on an unlocked system.

We also make rsync smarter so that we can afford to not `make clean`
everytime while still allowing the host's repo to be fully configured.

Closes: #360
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2016-06-28 16:22:49 -04:00 committed by Atomic Bot
parent d718b820ef
commit 4fc6dd8b97
4 changed files with 42 additions and 8 deletions

View File

@ -38,13 +38,22 @@ container). We're hoping to improve this workflow soon.
Hacking
=======
The `make vmbuild` command will automatically sync the
current files to the VM, build `rpm-ostree` and install it
into a new deployment, and finally reboot the VM to use it.
The `make vmoverlay` command will automatically sync the
current files to the VM, unlock the current deployment,
build `rpm-ostree`, and install it.
If you need to test on a locked deployment with the updated
`rpm-ostree` baked into the tree, you can use the `make
vmbuild` command, which will install `rpm-ostree` into a new
deployment and reboot the VM to use it.
For convenience, the `make vmshell` command does the same
but additionally places you in a shell, ready to test your
changes.
as `make vmbuild` but additionally places you in a shell,
ready to test your changes.
Note that by default, all the commands above try to re-use
the same configuration files to save speed. If you want to
force a cleanup, you can use `VMCLEAN=1`.
Testing
=======

View File

@ -85,6 +85,7 @@ check-local:
vmbuild:
@if [ -z "$(SKIP_VMBUILD)" ]; then \
vagrant up && \
( [ -z "$(VMCLEAN)" ] || vagrant ssh -c "rm -rf sync" ) && \
vagrant rsync && \
vagrant ssh -c "cd sync/vagrant && \
make install VERSION=$$(git describe)" && \
@ -92,6 +93,14 @@ vmbuild:
sleep 2; \
fi
vmoverlay:
vagrant up && \
( [ -z "$(VMCLEAN)" ] || vagrant ssh -c "rm -rf sync" ) && \
vagrant rsync && \
vagrant ssh -c "cd sync/vagrant && make ofsinstall" && \
vagrant ssh -c "systemctl daemon-reload && \
systemctl restart rpm-ostreed"
vmshell: vmbuild
vagrant ssh

7
Vagrantfile vendored
View File

@ -21,7 +21,12 @@ Vagrant.configure(2) do |config|
# containers)
config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
config.vm.synced_folder ".", "/root/sync", type: "rsync",
rsync__exclude: [".git/", "vagrant/*.tar.gz"]
rsync__exclude: [".git/", "vagrant/*.tar.gz"],
# override the default args so that
# (1) we don't use --delete (otherwise we will have to regen each time)
# (2) we can tell rsync to skip ignored files
rsync__args: ["--verbose", "--archive", "-z", "--filter", ":- .gitignore"]
config.vm.provider "libvirt" do |libvirt, override|
libvirt.cpus = 2

View File

@ -10,8 +10,13 @@ buildimg:
sudo docker build -t $(BUILDER_IMG) -f Dockerfile.builder .
build:
$(BUILDER_RUN) ./autogen.sh --prefix=/usr --libdir=/usr/lib64
$(BUILDER_RUN) sh -c 'make clean && make -j 4'
if ! test -f ../configure; then \
$(BUILDER_RUN) env NOCONFIGURE=1 ./autogen.sh; \
fi
if ! test -f ../Makefile; then \
$(BUILDER_RUN) ./configure --prefix=/usr --libdir=/usr/lib64; \
fi
$(BUILDER_RUN) sh -c make -j 4
install: build
sudo sh checkout.sh
@ -19,3 +24,9 @@ install: build
-v /ostree/repo/tmp/vmcheck.ro/usr:/host/usr \
$(BUILDER_IMG) sudo make install DESTDIR=/host
sudo VERSION=$(VERSION) sh commit_and_deploy.sh
ofsinstall: build
ostree admin unlock || :
$(BUILDER_ARGS) -v /etc:/host/etc \
-v /usr:/host/usr \
$(BUILDER_IMG) sudo make install DESTDIR=/host