Update 'gen-packages' script.

This makes the script treat the 'archtrack' package as a special
exception. It also fixes a few major bugs.