diff --git a/swh/loader/npm/client.py b/swh/loader/npm/client.py --- a/swh/loader/npm/client.py +++ b/swh/loader/npm/client.py @@ -157,7 +157,6 @@ path = os.path.join(self.temp_dir, version) os.makedirs(path, exist_ok=True) filepath = os.path.join(path, package_source_data['filename']) - self.log.debug('Package local path: %s' % filepath) # download tarball url = package_source_data['url'] @@ -181,6 +180,9 @@ # uncompress tarball tarball.uncompress(filepath, path) + # remove tarball + os.remove(filepath) + # do not archive useless tarball root directory package_path = os.path.join(path, 'package') # some old packages use their name as root directory @@ -192,6 +194,8 @@ if not os.path.exists(package_path): package_path = path + self.log.debug('Package local path: %s' % package_path) + package_source_data.update(hashes) # parse package.json file to add its content to revision metadata diff --git a/swh/loader/npm/loader.py b/swh/loader/npm/loader.py --- a/swh/loader/npm/loader.py +++ b/swh/loader/npm/loader.py @@ -244,6 +244,9 @@ package_source_data['sha1']) self.known_versions[package_key] = revision['id'] + self.log.debug('Removing unpacked package files at %s' % dir_path) + shutil.rmtree(dir_path) + return not self.done def _target_from_version(self, version, sha1):