It was not tested before because of the missing newline at the end of
`packages/packages_by_dep_dag.txt` and of how `read` works in bash.
Also:
- Allow empty lines in packages_by_dep_dag.txt and divide it into layers, so
that packages in each layer depend only on packages in the layers above.
- Fix type annotations and use of re-exported imports