Retain version string in downloaded package names

This commit is contained in:
Disassembler 2019-02-24 13:38:52 +01:00
parent 57db520dbb
commit 65f5bc18c0
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -77,10 +77,11 @@ class PkgMgr:
def download_package(self, name, item): def download_package(self, name, item):
# Download tar.xz package and verify its hash. Can raise InvalidSignature # Download tar.xz package and verify its hash. Can raise InvalidSignature
tmp_archive = '/tmp/{}.tar.xz'.format(name) pkg_filename = '{}_{}-{}.tar.xz'.format(name, self.online_packages[name]['version'], self.online_packages[name]['release'])
r = self.get_repo_resource('{}.tar.xz'.format(name), True) res = self.get_repo_resource(pkg_filename, True)
tmp_archive = os.path.join('/tmp', pkg_filename)
with open(tmp_archive, 'wb') as f: 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: if chunk:
item.bytes_downloaded += f.write(chunk) item.bytes_downloaded += f.write(chunk)
# Verify hash # Verify hash
@ -88,7 +89,8 @@ class PkgMgr:
def unpack_package(self, name): def unpack_package(self, name):
# Unpack archive # 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) subprocess.run(['tar', 'xJf', tmp_archive], cwd='/', check=True)
os.unlink(tmp_archive) os.unlink(tmp_archive)