refactor main.py, flesh out functions from main function

@stdweird, @wpoely86: please review?

The diff is going to look a bit messy, maybe you want to look at the actual new `main.py` instead...
I'm keeping this in `easyconfig.tools`, since robot has nothing to do with this (we're not resolving dependencies here yet, just figuring out what the "listed" easyconfigs are)