From c0a36eb4ecb76325267996df78df6940068c33dd Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Apr 06 2016 08:24:08 +0000 Subject: get_repo_md: handle gzip correctly Our gzip files aren't tarballs, so let's not treat them as such. This patch makes get_repo_md use gzip instead of tarfile to extract the gzip databases. Signed-off-by: Patrick Uiterwijk --- diff --git a/mdapi-get_repo_md b/mdapi-get_repo_md index e6e7152..8e90f3d 100755 --- a/mdapi-get_repo_md +++ b/mdapi-get_repo_md @@ -179,10 +179,15 @@ def decompress_db(name, archive, location): data = stream_xz.read() with open(location, 'wb') as stream: stream.write(data) - elif archive.endswith('.gz'): + elif archive.endswith('.tar.gz'): import tarfile with tarfile.open(archive) as tar: tar.extractall(path=location) + elif archive.endswith('.gz'): + import gzip + with open(location, 'wb') as out: + with gzip.open(archive, 'rb') as inp: + out.write(inp.read()) elif archive.endswith('.bz2'): import bz2 with open(location, 'wb') as out: