Refactor checking for empty package dir, and avoid checking empty for every package
'origin' is not ready for commit here