deployresult synchronization and cleanup

(1) trim the deployments on reading.  see PurgeDeploymentsTests for various scenarios being trim.
(2) instead of fail/retry, we do a proper lock on read/write to status file.  I did not do it for log.xml since there is no known race access pattern from Portal.