Add foreign archs detection tool

* Add foreign archs detection tool and add some tests for it.
* Refactor tests on current arch as well to isolate from dpkg results on the
  running host.