build: Fix exception if we don't have a previous build
build: Write a modified.json

This ensures we don't trigger smoketest/etc. if the trees haven't
changed.