From 65f5bc18c00c28afc5584bb2a2250c986d744bcc Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 24 Feb 2019 13:38:52 +0100 Subject: [PATCH] Retain version string in downloaded package names --- usr/lib/python3.6/vmmgr/pkgmgr.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/lib/python3.6/vmmgr/pkgmgr.py b/usr/lib/python3.6/vmmgr/pkgmgr.py index 39941fe..9fbb63f 100644 --- a/usr/lib/python3.6/vmmgr/pkgmgr.py +++ b/usr/lib/python3.6/vmmgr/pkgmgr.py @@ -77,10 +77,11 @@ class PkgMgr: def download_package(self, name, item): # Download tar.xz package and verify its hash. Can raise InvalidSignature - tmp_archive = '/tmp/{}.tar.xz'.format(name) - r = self.get_repo_resource('{}.tar.xz'.format(name), True) + pkg_filename = '{}_{}-{}.tar.xz'.format(name, self.online_packages[name]['version'], self.online_packages[name]['release']) + res = self.get_repo_resource(pkg_filename, True) + tmp_archive = os.path.join('/tmp', pkg_filename) with open(tmp_archive, 'wb') as f: - for chunk in r.iter_content(chunk_size=65536): + for chunk in res.iter_content(chunk_size=65536): if chunk: item.bytes_downloaded += f.write(chunk) # Verify hash @@ -88,7 +89,8 @@ class PkgMgr: def unpack_package(self, name): # Unpack archive - tmp_archive = '/tmp/{}.tar.xz'.format(name) + pkg_filename = '{}_{}-{}.tar.xz'.format(name, self.online_packages[name]['version'], self.online_packages[name]['release']) + tmp_archive = os.path.join('/tmp', pkg_filename) subprocess.run(['tar', 'xJf', tmp_archive], cwd='/', check=True) os.unlink(tmp_archive)