Add a bunch of fixes allowing build to work
run pkg repo on the right directory
Use fifo + read to determine when to start a new build