From df3e5c893d0f4d02e99a3d2f171e3d98817d5266 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 20 Oct 2019 16:47:15 +0100 Subject: arch-proxy.py: support zstd compressed packages "The imminent release of pacman 5.2 brings build tools with support for compressing packages with zstd. [..] If you use custom scripts make sure these do not rely on hardcoded file extensions. The zstd package file extension will be .pkg.tar.zst." https://www.archlinux.org/news/required-update-to-recent-libarchive/ --- arch-proxy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch-proxy.py b/arch-proxy.py index a8f5fd0..1ce6fa8 100755 --- a/arch-proxy.py +++ b/arch-proxy.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Arch Linux packages proxy # -# Proxies requests, caching files with ".pkg.tar.xz" suffix. +# Proxies requests, caching files with ".pkg.tar.*" suffix. # If the cached file exists, serve that file. # Otherwise, try to download file (as normally) and optionally cache it with # ".download" extension. If the file exists and the file is not being @@ -241,7 +241,9 @@ class RequestHandler(http.server.BaseHTTPRequestHandler): def is_cacheable(self): """Whether the requested file should be cached.""" - return self.path.endswith(".pkg.tar.xz") + # Support .pkg.tar.xz, .pkg.tar.zst, etc. + basename = os.path.splitext(self.path)[0] + return basename.endswith(".pkg.tar") def is_date_sensitive_request(self): """Whether the resource is ephemeral.""" -- cgit v1.2.1