Rework locating config file for checkconfig and upgrade-master.

This changes the logic of checkconfig so that,
1. If a file is passed, that file is used.
2. If a directory is passed containing `buildbot.tac`, that file is
   loaded and `configfile` is defined there, that file is used.
3. If `buildbot.tac` doesn't exist, or doesn't define `configfile`,
   `master.cfg` from that directory is used.

The logic for upgrade-master is similar, except only directories are
supported, so (1) is skipped.
Report `SyntaxError` or `ImportError` from `checkconfig` and `upgrade-master`.
Merge 'locate-config': Rework locating config file for checkconfig and upgrade-master.

This changes the logic of checkconfig so that,
1. If a file is passed, that file is used.
2. If a directory is passed containing buildbot.tac, that file is
loaded and configfile is defined there, that file is used.
3. If buildbot.tac doesn't exist, or doesn't define configfile,
master.cfg from that directory is used.

The logic for upgrade-master is similar, except only directories are
supported, so (1) is skipped.