Use hostname command as fallback way of getting build host name

- getHostName() may fail for number of reasons, for example when
  networking is disabled or network is down.
- hostname command is a portable way of determining host name,
  which doesn't depend on networking to be available.

For more details, see: http://stackoverflow.com/a/7800008

For example, Fedora build servers don't have networking available, not even local loopback interface (localhost). As a result host name in Gradle build is always set to "unknown". This patch fixes the problem.