Fix clone dirname

This commits fix the way how the directory name for the repository clone is calculated. It fixes the problem with tarballs having the scm extension in the name.