Refactor archive.py to make adding parent directories easier to understand (#551)
Refactor archive.py to make adding parent directories easier to understand (#551)

* Refactor archive.py to make adding parent directories easier to understand.

This is a precursor PR to cleaning up the use of './' in pkg_tar and
pkg_deb. The followups may require more changes to the tar writer,
and doing this refactor first will make anything downstream easier to
reason about.

The core of this change is to change adding the parent tree from
a recursive call of add_file to an iterative one building up a
path from root to tail. The recursion had difficult to understand
termination conditions, with checks sprinkled in a few places.
The refactoring makes the concept clearer.
bazelbuild/rules_pkg,bazelbuild/rules_pkg,bazelbuild/rules_pkg