Change build commit tracking logic

We need to record the commit at build time, since we won't know it
afterwards.