From 1780541c369176296aabaab2da2d8a01991a0245 Mon Sep 17 00:00:00 2001 From: z4yx Date: Sun, 19 Apr 2020 18:55:09 +0800 Subject: [PATCH] add support of Packages.xz --- apt-sync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apt-sync.py b/apt-sync.py index 5fbf4a1..16fa505 100755 --- a/apt-sync.py +++ b/apt-sync.py @@ -10,6 +10,7 @@ import tempfile import argparse import bz2 import gzip +import lzma import time from email.utils import parsedate_to_datetime from pathlib import Path @@ -141,7 +142,9 @@ def apt_mirror(base_url: str, dist: str, repo: str, arch: str, dest_base_dir: Pa if pkgidx_content is None: print("getting packages index content") suffix = pkgidx_file.suffix - if suffix == '.bz2': + if suffix == '.xz': + pkgidx_content = lzma.decompress(content).decode('utf-8') + elif suffix == '.bz2': pkgidx_content = bz2.decompress(content).decode('utf-8') elif suffix == '.gz': pkgidx_content = gzip.decompress(content).decode('utf-8')