perhaps neaten this up to reduce duplication  something like function clone and checkout git clone depth cd git checkout cd clone and checkout  builddir tmp tgt v clone and checkout  builddir tmp qemu v 