aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-11-22 08:12:07 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-11-22 08:18:15 +0000
commitbcb098e384dc2d5694d098975161328a2699ed07 (patch)
tree13c1485ca5a76429125cb2c8583c02d2285c369b /Makefile
parent701cc6b7eac0224f7bc26e4c300bbfbb51c19bdc (diff)
downloadports-bcb098e384dc2d5694d098975161328a2699ed07.tar.gz
ports-bcb098e384dc2d5694d098975161328a2699ed07.zip
fetchindex: make compression format configurable
Add INDEX_COMPRESSION_FORMAT as a variable a user can overwrite via /etc/make.conf to allow the compression format used for INDEX to be changed. Available compression formats are: bz2, xz and zst for now. While here change the default compression format to be .xz (the smallest), for environement where performance of unxz matters it can switched to zst. bz2 format is kept for compatibility with existing tooling. In order to simplify the code, bsdcat(1) is now used for uncompressing instead detecting the compression format manually and switch the decompression tool manually Note the bzip2 compression format is now considered as deprecated
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 13 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b2e17255f8ae..bb5edc8f6f86 100644
--- a/Makefile
+++ b/Makefile
@@ -66,17 +66,25 @@ PORTSTOP= yes
index: ${INDEXDIR}/${INDEXFILE}
-fetchindex: ${INDEXDIR}/${INDEXFILE}.bz2
- @if bunzip2 < ${INDEXDIR}/${INDEXFILE}.bz2 > ${INDEXDIR}/${INDEXFILE}.tmp ; then \
+INDEX_COMPRESSION_FORMAT?= xz
+
+.if ${INDEX_COMPRESSION_FORMAT} != xz && \
+ ${INDEX_COMPRESSION_FORMAT} != bz2 && ${INDEX_COMPRESSION_FORMAT} != zst
+.error "Invalid compression format: ${INDEX_COMPRESSION_FORMAT}, expecting xz, bz2 or zst"
+.endif
+
+fetchindex: ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}
+ @if bsdcat < ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} > ${INDEXDIR}/${INDEXFILE}.tmp ; then \
chmod a+r ${INDEXDIR}/${INDEXFILE}.tmp; \
${MV} ${INDEXDIR}/${INDEXFILE}.tmp ${INDEXDIR}/${INDEXFILE}; \
- ${RM} ${INDEXDIR}/${INDEXFILE}.bz2 \
+ ${RM} ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} \
else ; \
${RM} ${INDEXDIR}/${INDEXFILE}.tmp ; \
fi
-${INDEXDIR}/${INDEXFILE}.bz2: .PHONY
- ${FETCHINDEX} ${INDEXDIR}/${INDEXFILE}.bz2 ${MASTER_SITE_INDEX}${INDEXFILE}.bz2
+${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}: .PHONY
+ ${FETCHINDEX} ${INDEXDIR}/${INDEXFILE}.${INDEX_COMPRESSION_FORMAT} \
+ ${MASTER_SITE_INDEX}${INDEXFILE}.${INDEX_COMPRESSION_FORMAT}
MASTER_SITE_INDEX?= https://www.FreeBSD.org/ports/
SETENV?= /usr/bin/env