OOZIE-1761 Improve sharelib purging logic (puru via rohini)