pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Extract .zst distfiles using archivers/zstd.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f9665b4fa0f8
branches:  trunk
changeset: 371192:f9665b4fa0f8
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Thu Jan 06 10:19:11 2022 +0000

description:
Extract .zst distfiles using archivers/zstd.

diffstat:

 mk/extract/bsd.extract-vars.mk |   5 ++++-
 mk/extract/extract             |  13 +++++++++++--
 mk/extract/extract.mk          |   4 +++-
 mk/tools/defaults.mk           |   3 ++-
 mk/tools/replace.mk            |  12 +++++++++++-
 5 files changed, 31 insertions(+), 6 deletions(-)

diffs (142 lines):

diff -r 9f9158a0b584 -r f9665b4fa0f8 mk/extract/bsd.extract-vars.mk
--- a/mk/extract/bsd.extract-vars.mk    Thu Jan 06 09:04:59 2022 +0000
+++ b/mk/extract/bsd.extract-vars.mk    Thu Jan 06 10:19:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.extract-vars.mk,v 1.20 2020/03/20 17:16:34 rillig Exp $
+# $NetBSD: bsd.extract-vars.mk,v 1.21 2022/01/06 10:19:11 schmonz Exp $
 #
 # This file configures how a package extracts its distfiles after
 # downloading them.
@@ -107,4 +107,7 @@
 .if !empty(EXTRACT_ONLY:M*.7z)
 USE_TOOLS+=    7za
 .endif
+.if !empty(EXTRACT_ONLY:M*.zst)
+USE_TOOLS+=    zstd
+.endif
 
diff -r 9f9158a0b584 -r f9665b4fa0f8 mk/extract/extract
--- a/mk/extract/extract        Thu Jan 06 09:04:59 2022 +0000
+++ b/mk/extract/extract        Thu Jan 06 10:19:11 2022 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: extract,v 1.19 2019/08/02 11:48:17 nia Exp $
+# $NetBSD: extract,v 1.20 2022/01/06 10:19:11 schmonz Exp $
 #
 # Copyright (c) 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -84,6 +84,7 @@
 #      EXTRACT_OPTS_RPM
 #      EXTRACT_OPTS_TAR
 #      EXTRACT_OPTS_ZIP
+#      EXTRACT_OPTS_ZSTD
 #      EXTRACT_OPTS_ZOO
 #              These variables set additional arguments passed to the
 #              underlying extraction tool to unpack their respective
@@ -114,6 +115,7 @@
 : ${UNZOO:=unzoo}
 : ${P7ZA:="7za x"}
 : ${P7ZA_SO:="7za x -so"}
+: ${ZSTD:="zstd"}
 
 : ${TMPDIR:=/tmp}
 
@@ -202,7 +204,7 @@
 
 # Derive the format of the archive based on the file extension.
 case "$distfile" in
-*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.txz|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z|*.crate)
+*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.txz|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z|*.tar.zst|*.crate)
                _format=tar ;;
 *.cpio|*.cpio.gz|*.cpio.bz2)
                _format=cpio ;;
@@ -218,6 +220,7 @@
 *.bin|*.sh)    _format=jre-bin ;;
 *.gem)         _format=gem ;;
 *.7z)          _format=7z ;;
+*.zst)         _format=zstd ;;
 *)             _format=none ;;
 esac
 ${TEST} -n "$format" || format="$_format"
@@ -345,6 +348,12 @@
        ${P7ZA} "$distfile"
        ;;
 
+zst)
+       ${ECHO} 1>&2 "$self: SCHMONZ: looks like $format is .zst"
+       : ${EXTRACT_OPTS_ZSTD=}
+       ${ZSTD} -d ${EXTRACT_OPTS_ZSTD} "$distfile" ${1+"$@"}
+       ;;
+
 none)
        # By default, copy the distfile over to the current working directory.
        ${CP} "$distfile" .
diff -r 9f9158a0b584 -r f9665b4fa0f8 mk/extract/extract.mk
--- a/mk/extract/extract.mk     Thu Jan 06 09:04:59 2022 +0000
+++ b/mk/extract/extract.mk     Thu Jan 06 10:19:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: extract.mk,v 1.42 2021/03/30 16:47:03 ryoon Exp $
+# $NetBSD: extract.mk,v 1.43 2022/01/06 10:19:11 schmonz Exp $
 #
 # The following variables may be set by the package Makefile and
 # specify how extraction happens:
@@ -166,6 +166,7 @@
 _EXTRACT_ENV+= ${EXTRACT_OPTS_RPM:D    EXTRACT_OPTS_LHA=${EXTRACT_OPTS_RPM:Q}}
 _EXTRACT_ENV+= ${EXTRACT_OPTS_TAR:D    EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR:Q}}
 _EXTRACT_ENV+= ${EXTRACT_OPTS_ZIP:D    EXTRACT_OPTS_ZIP=${EXTRACT_OPTS_ZIP:Q}}
+_EXTRACT_ENV+= ${EXTRACT_OPTS_ZSTD:D   EXTRACT_OPTS_ZSTD=${EXTRACT_OPTS_ZSTD:Q}}
 _EXTRACT_ENV+= ${EXTRACT_OPTS_ZOO:D    EXTRACT_OPTS_ZOO=${EXTRACT_OPTS_ZOO:Q}}
 _EXTRACT_ENV+= ${TOOLS_CMDLINE_BZCAT:D         BZCAT=${TOOLS_CMDLINE_BZCAT:Q}}
 _EXTRACT_ENV+= ${TOOLS_CAT:D           CAT=${TOOLS_CAT:Q}}
@@ -185,6 +186,7 @@
 _EXTRACT_ENV+= ${TOOLS_UNZOO:D         UNZOO=${TOOLS_UNZOO:Q}}
 _EXTRACT_ENV+= ${TOOLS_XZCAT:D         XZCAT=${TOOLS_XZCAT:Q}}
 _EXTRACT_ENV+= ${TOOLS_7ZA:D           P7ZA=${TOOLS_7ZA:Q}}
+_EXTRACT_ENV+= ${TOOLS_ZSTD:D          ZSTD=${TOOLS_ZSTD:Q}}
 _EXTRACT_ENV+= ${EXTRACT_ENV}
 
 .if !empty(EXTRACT_USING:Mbsdtar)
diff -r 9f9158a0b584 -r f9665b4fa0f8 mk/tools/defaults.mk
--- a/mk/tools/defaults.mk      Thu Jan 06 09:04:59 2022 +0000
+++ b/mk/tools/defaults.mk      Thu Jan 06 10:19:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: defaults.mk,v 1.62 2018/08/22 20:48:37 maya Exp $
+# $NetBSD: defaults.mk,v 1.63 2022/01/06 10:19:11 schmonz Exp $
 #
 # Copyright (c) 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -143,6 +143,7 @@
 _TOOLS_VARNAME.xz=             XZ
 _TOOLS_VARNAME.xzcat=          XZCAT
 _TOOLS_VARNAME.yacc=           YACC
+_TOOLS_VARNAME.zstd=           ZSTD
 
 ######################################################################
 
diff -r 9f9158a0b584 -r f9665b4fa0f8 mk/tools/replace.mk
--- a/mk/tools/replace.mk       Thu Jan 06 09:04:59 2022 +0000
+++ b/mk/tools/replace.mk       Thu Jan 06 10:19:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.292 2021/07/19 09:55:04 triaxx Exp $
+# $NetBSD: replace.mk,v 1.293 2022/01/06 10:19:11 schmonz Exp $
 #
 # Copyright (c) 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -203,6 +203,16 @@
 # command, e.g., TOOLS_TBL, TOOLS_YACC, etc., provided that "TOOL" has
 # been associated with <tool>.
 #
+.if !defined(TOOLS_IGNORE.zstd) && !empty(_USE_TOOLS:Mzstd)
+.  if !empty(PKGPATH:Marchivers/zstd)
+MAKEFLAGS+=                    TOOLS_IGNORE.zstd=
+.  elif !empty(_TOOLS_USE_PKGSRC.zstd:M[yY][eE][sS])
+TOOLS_DEPENDS.zstd?=           zstd>=1.5.0:../../archivers/zstd
+TOOLS_CREATE+=                 zstd
+TOOLS_PATH.zstd=               ${LOCALBASE}/bin/zstd
+.  endif
+.endif
+
 .if !defined(TOOLS_IGNORE.7za) && !empty(_USE_TOOLS:M7za)
 .  if !empty(PKGPATH:Marchivers/p7zip)
 MAKEFLAGS+=                    TOOLS_IGNORE.7za=



Home | Main Index | Thread Index | Old Index