summaryrefslogtreecommitdiff
path: root/arch-proxy.py
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-10-20 16:47:15 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-10-20 16:47:15 +0100
commitdf3e5c893d0f4d02e99a3d2f171e3d98817d5266 (patch)
tree563d733d5184784c21eba2608ff877d3c999026d /arch-proxy.py
parent91616baae2b271eeb551ceec0333c92d6294cf79 (diff)
downloadscripts-df3e5c893d0f4d02e99a3d2f171e3d98817d5266.tar.gz
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/
Diffstat (limited to 'arch-proxy.py')
-rwxr-xr-xarch-proxy.py6
1 files 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."""