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
This commit is contained in:
parent
701cc6b7ea
commit
bcb098e384
9
CHANGES
9
CHANGES
|
@ -10,6 +10,15 @@ in the release notes and/or placed into UPDATING.
|
|||
|
||||
All ports committers are allowed to commit to this file.
|
||||
|
||||
20211122:
|
||||
AUTHOR: bapt@FreeBSD.org
|
||||
|
||||
The default compression for INDEX file as fetch via make fetchindex has
|
||||
switched from .bz2 to .xz (.zst is also available).
|
||||
|
||||
The .bz2 format is still available but is considered deprecated and may
|
||||
be removed in the futur.
|
||||
|
||||
20211010:
|
||||
AUTHOR: bapt@FreeBSD.org
|
||||
|
||||
|
|
18
Makefile
18
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user