Sun Apr 28 18:07:33 2024 UTC (49d)
mk: pass --no-xattrs to tar by default

Slightly improve the GITHUB_SUBMODULES change which _always_ overrode
EXTRACT_OPTS_TAR.


(wiz)
diff -r1.21 -r1.22 pkgsrc/mk/extract/extract
diff -r1.44 -r1.45 pkgsrc/mk/extract/extract.mk

cvs diff -r1.21 -r1.22 pkgsrc/mk/extract/extract (switch to unified diff)

--- pkgsrc/mk/extract/extract 2022/01/06 10:30:50 1.21
+++ pkgsrc/mk/extract/extract 2024/04/28 18:07:33 1.22
@@ -1,367 +1,367 @@ @@ -1,367 +1,367 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: extract,v 1.21 2022/01/06 10:30:50 schmonz Exp $ 3# $NetBSD: extract,v 1.22 2024/04/28 18:07:33 wiz Exp $
4# 4#
5# Copyright (c) 2006 The NetBSD Foundation, Inc. 5# Copyright (c) 2006 The NetBSD Foundation, Inc.
6# All rights reserved. 6# All rights reserved.
7# 7#
8# This code is derived from software contributed to The NetBSD Foundation 8# This code is derived from software contributed to The NetBSD Foundation
9# by Johnny C. Lam. 9# by Johnny C. Lam.
10# 10#
11# Redistribution and use in source and binary forms, with or without 11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions 12# modification, are permitted provided that the following conditions
13# are met: 13# are met:
14# 1. Redistributions of source code must retain the above copyright 14# 1. Redistributions of source code must retain the above copyright
15# notice, this list of conditions and the following disclaimer. 15# notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright 16# 2. Redistributions in binary form must reproduce the above copyright
17# notice, this list of conditions and the following disclaimer in the 17# notice, this list of conditions and the following disclaimer in the
18# documentation and/or other materials provided with the distribution. 18# documentation and/or other materials provided with the distribution.
19# 19#
20# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE. 30# POSSIBILITY OF SUCH DAMAGE.
31# 31#
32 32
33###################################################################### 33######################################################################
34# 34#
35# NAME 35# NAME
36# extract -- extract distfile, regardless of format 36# extract -- extract distfile, regardless of format
37# 37#
38# SYNOPSIS 38# SYNOPSIS
39# extract [options] distfile [file ...] 39# extract [options] distfile [file ...]
40# 40#
41# DESCRIPTION 41# DESCRIPTION
42# extract will unpack the contents of the named distfile into the 42# extract will unpack the contents of the named distfile into the
43# current working directory. If any optional files are specified then 43# current working directory. If any optional files are specified then
44# only they will be extracted from the distfile, provided that the 44# only they will be extracted from the distfile, provided that the
45# underlying tool supports this ability. If the distfile's file 45# underlying tool supports this ability. If the distfile's file
46# extension doesn't match any known archive format's, then the 46# extension doesn't match any known archive format's, then the
47# distfile is simply copied into the current working directory. If 47# distfile is simply copied into the current working directory. If
48# "-" is given as the distfile, then standard input is used as the 48# "-" is given as the distfile, then standard input is used as the
49# contents of the archive, provided that the underlying tool supports 49# contents of the archive, provided that the underlying tool supports
50# this ability. 50# this ability.
51# 51#
52# OPTIONS 52# OPTIONS
53# -c format Force interpretation of the distfile's compression 53# -c format Force interpretation of the distfile's compression
54# format to be the specified format. Valid formats 54# format to be the specified format. Valid formats
55# are: gzip, bzip, compress, and none. 55# are: gzip, bzip, compress, and none.
56# 56#
57# -d dir Extract the files into the specified dir instead 57# -d dir Extract the files into the specified dir instead
58# of the current working directory. If the directory 58# of the current working directory. If the directory
59# doesn't exist, then it is created along with any 59# doesn't exist, then it is created along with any
60# intermediate directories using the current umask. 60# intermediate directories using the current umask.
61# 61#
62# -f format Force interpretation of the distfile's archive 62# -f format Force interpretation of the distfile's archive
63# format to be the specified format. 63# format to be the specified format.
64# 64#
65# -t tarprog This specifies the tool to use to extract tar/ustar 65# -t tarprog This specifies the tool to use to extract tar/ustar
66# archives, and may be either "tar" or "pax", or the 66# archives, and may be either "tar" or "pax", or the
67# full path to the program. 67# full path to the program.
68# 68#
69# -X excludefile excludefile is a list of file patterns to exclude 69# -X excludefile excludefile is a list of file patterns to exclude
70# from extraction. If the -X option is specified 70# from extraction. If the -X option is specified
71# then any optional files listed on the command line 71# then any optional files listed on the command line
72# are ignored. 72# are ignored.
73# 73#
74# -x This causes the optional files listed on the 74# -x This causes the optional files listed on the
75# command line to be excluded from extraction, 75# command line to be excluded from extraction,
76# provided the underlying tool supports this 76# provided the underlying tool supports this
77# ability. 77# ability.
78# 78#
79# ENVIRONMENT 79# ENVIRONMENT
80# EXTRACT_OPTS_BIN 80# EXTRACT_OPTS_BIN
81# EXTRACT_OPTS_LHA 81# EXTRACT_OPTS_LHA
82# EXTRACT_OPTS_PAX 82# EXTRACT_OPTS_PAX
83# EXTRACT_OPTS_RAR 83# EXTRACT_OPTS_RAR
84# EXTRACT_OPTS_RPM 84# EXTRACT_OPTS_RPM
85# EXTRACT_OPTS_TAR 85# EXTRACT_OPTS_TAR
86# EXTRACT_OPTS_ZIP 86# EXTRACT_OPTS_ZIP
87# EXTRACT_OPTS_ZSTD 87# EXTRACT_OPTS_ZSTD
88# EXTRACT_OPTS_ZOO 88# EXTRACT_OPTS_ZOO
89# These variables set additional arguments passed to the 89# These variables set additional arguments passed to the
90# underlying extraction tool to unpack their respective 90# underlying extraction tool to unpack their respective
91# archive formats. 91# archive formats.
92# 92#
93###################################################################### 93######################################################################
94 94
95set -e # exit on errors 95set -e # exit on errors
96set -u # treat undefined variables as errors 96set -u # treat undefined variables as errors
97 97
98: ${BZCAT:=bzcat} 98: ${BZCAT:=bzcat}
99: ${CAT:=cat} 99: ${CAT:=cat}
100: ${CP:=cp} 100: ${CP:=cp}
101: ${ECHO:=echo} 101: ${ECHO:=echo}
102: ${GEM:="gem unpack"} 102: ${GEM:="gem unpack"}
103: ${GZCAT:="gzip -cd"} 103: ${GZCAT:="gzip -cd"}
104: ${LHA:=lha} 104: ${LHA:=lha}
105: ${LZCAT:="lzip -cd"} 105: ${LZCAT:="lzip -cd"}
106: ${MKDIR:=mkdir} 106: ${MKDIR:=mkdir}
107: ${PAX:=pax} 107: ${PAX:=pax}
108: ${RM:=rm} 108: ${RM:=rm}
109: ${RPM2PKG:=rpm2pkg} 109: ${RPM2PKG:=rpm2pkg}
110: ${SH:=sh} 110: ${SH:=sh}
111: ${TAR:=tar} 111: ${TAR:=tar}
112: ${TEST:=test} 112: ${TEST:=test}
113: ${UNRAR:=unrar} 113: ${UNRAR:=unrar}
114: ${UNZIP_CMD:=unzip} 114: ${UNZIP_CMD:=unzip}
115: ${UNZOO:=unzoo} 115: ${UNZOO:=unzoo}
116: ${P7ZA:="7za x"} 116: ${P7ZA:="7za x"}
117: ${P7ZA_SO:="7za x -so"} 117: ${P7ZA_SO:="7za x -so"}
118: ${ZSTD:="zstd"} 118: ${ZSTD:="zstd"}
119 119
120: ${TMPDIR:=/tmp} 120: ${TMPDIR:=/tmp}
121 121
122self="${0##*/}" 122self="${0##*/}"
123 123
124usage() { 124usage() {
125 ${ECHO} 1>&2 "usage: $self [-c format] [-d dir] [-f format] [-t tarprog] [-X excludefile | -x] distfile [file ...]" 125 ${ECHO} 1>&2 "usage: $self [-c format] [-d dir] [-f format] [-t tarprog] [-X excludefile | -x] distfile [file ...]"
126} 126}
127 127
128exclude=no 128exclude=no
129exclude_file= 129exclude_file=
130exclude_flag= 130exclude_flag=
131extract_dir=. 131extract_dir=.
132extract_using=tar 132extract_using=tar
133format= 133format=
134cformat= 134cformat=
135 135
136# Process optional arguments 136# Process optional arguments
137while ${TEST} $# -gt 0; do 137while ${TEST} $# -gt 0; do
138 case "$1" in 138 case "$1" in
139 -c) cformat="$2"; shift 2 ;; 139 -c) cformat="$2"; shift 2 ;;
140 -d) extract_dir="$2"; shift 2 ;; 140 -d) extract_dir="$2"; shift 2 ;;
141 -f) format="$2"; shift 2 ;; 141 -f) format="$2"; shift 2 ;;
142 -t) extract_using="$2"; shift 2 ;; 142 -t) extract_using="$2"; shift 2 ;;
143 -X) exclude_file="$2"; shift 2 ;; 143 -X) exclude_file="$2"; shift 2 ;;
144 -x) exclude=yes; shift ;; 144 -x) exclude=yes; shift ;;
145 --) shift; break ;; 145 --) shift; break ;;
146 -?*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}" 146 -?*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}"
147 usage 147 usage
148 exit 1 148 exit 1
149 ;; 149 ;;
150 *) break ;; 150 *) break ;;
151 esac 151 esac
152done 152done
153 153
154case "$extract_using" in 154case "$extract_using" in
155/*tar|/*pax) tarprog="$extract_using" ;; 155/*tar|/*pax) tarprog="$extract_using" ;;
156*tar) tarprog="${TAR}" ;; 156*tar) tarprog="${TAR}" ;;
157*pax) tarprog="${PAX}" ;; 157*pax) tarprog="${PAX}" ;;
158*) tarprog="${TAR}" ;; 158*) tarprog="${TAR}" ;;
159esac 159esac
160 160
161if ${TEST} -n "$exclude_file" -a ! -f "$exclude_file"; then 161if ${TEST} -n "$exclude_file" -a ! -f "$exclude_file"; then
162 ${ECHO} 1>&2 "$self: exclude file missing: $exclude_file" 162 ${ECHO} 1>&2 "$self: exclude file missing: $exclude_file"
163 exit 1 163 exit 1
164fi 164fi
165 165
166# Process required arguments 166# Process required arguments
167${TEST} $# -gt 0 || { usage; exit 1; } 167${TEST} $# -gt 0 || { usage; exit 1; }
168distfile="$1"; shift 168distfile="$1"; shift
169 169
170# Make distfile an absolute path, because we will change the current 170# Make distfile an absolute path, because we will change the current
171# directory soon. 171# directory soon.
172case "$distfile" in 172case "$distfile" in
173/*) ;; 173/*) ;;
174*) distfile=`exec pwd`/"$distfile" 174*) distfile=`exec pwd`/"$distfile"
175 ;; 175 ;;
176esac 176esac
177 177
178# Derive the compression format of the archive based on the file extension. 178# Derive the compression format of the archive based on the file extension.
179case "$distfile" in 179case "$distfile" in
180*.gz|*.tgz|*.z|*.crate) _cformat=gzip ;; 180*.gz|*.tgz|*.z|*.crate) _cformat=gzip ;;
181*.7z) _cformat=7z ;; 181*.7z) _cformat=7z ;;
182*.bz2|*.tbz|*.tbz2|*.bz) _cformat=bzip ;; 182*.bz2|*.tbz|*.tbz2|*.bz) _cformat=bzip ;;
183*.lz) _cformat=lzip ;; 183*.lz) _cformat=lzip ;;
184*.lzma) _cformat=lzma ;; 184*.lzma) _cformat=lzma ;;
185*.xz|*.txz) _cformat=xz ;; 185*.xz|*.txz) _cformat=xz ;;
186*.Z) _cformat=compress ;; 186*.Z) _cformat=compress ;;
187*) _cformat=none ;; 187*) _cformat=none ;;
188esac 188esac
189${TEST} -n "$cformat" || cformat="$_cformat" 189${TEST} -n "$cformat" || cformat="$_cformat"
190 190
191# Derive the command to decompress the file and write the contents to 191# Derive the command to decompress the file and write the contents to
192# stdout, based on the file extension. 192# stdout, based on the file extension.
193# 193#
194case "$cformat" in 194case "$cformat" in
195gzip|compress) decompress_cat="${GZCAT}" ;; 195gzip|compress) decompress_cat="${GZCAT}" ;;
1967z) decompress_cat="${P7ZA_SO}" ;; 1967z) decompress_cat="${P7ZA_SO}" ;;
197bzip) decompress_cat="${BZCAT}" ;; 197bzip) decompress_cat="${BZCAT}" ;;
198lzip) decompress_cat="${LZCAT}" ;; 198lzip) decompress_cat="${LZCAT}" ;;
199lzma) decompress_cat="${XZCAT}" ;; 199lzma) decompress_cat="${XZCAT}" ;;
200xz) decompress_cat="${XZCAT}" ;; 200xz) decompress_cat="${XZCAT}" ;;
201none) decompress_cat="${CAT}" ;; 201none) decompress_cat="${CAT}" ;;
202*) decompress_cat="${CAT}" ;; 202*) decompress_cat="${CAT}" ;;
203esac 203esac
204 204
205# Derive the format of the archive based on the file extension. 205# Derive the format of the archive based on the file extension.
206case "$distfile" in 206case "$distfile" in
207*.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) 207*.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)
208 _format=tar ;; 208 _format=tar ;;
209*.cpio|*.cpio.gz|*.cpio.bz2) 209*.cpio|*.cpio.gz|*.cpio.bz2)
210 _format=cpio ;; 210 _format=cpio ;;
211*.shar.gz|*.shar.bz2|*.shar.Z|*.shar|*.shr.gz|*.shr.bz2|*.shr.Z|*.shr) 211*.shar.gz|*.shar.bz2|*.shar.Z|*.shar|*.shr.gz|*.shr.bz2|*.shr.Z|*.shr)
212 _format=shar ;; 212 _format=shar ;;
213*.zip|*.ZIP) _format=zip ;; 213*.zip|*.ZIP) _format=zip ;;
214*.lha|*.lzh) _format=lha ;; 214*.lha|*.lzh) _format=lha ;;
215*.Z|*.bz2|*.gz|*.z) 215*.Z|*.bz2|*.gz|*.z)
216 _format=compressed ;; 216 _format=compressed ;;
217*.zoo) _format=zoo ;; 217*.zoo) _format=zoo ;;
218*.rar) _format=rar ;; 218*.rar) _format=rar ;;
219*.rpm) _format=rpm ;; 219*.rpm) _format=rpm ;;
220*.bin|*.sh) _format=jre-bin ;; 220*.bin|*.sh) _format=jre-bin ;;
221*.gem) _format=gem ;; 221*.gem) _format=gem ;;
222*.7z) _format=7z ;; 222*.7z) _format=7z ;;
223*.zst) _format=zstd ;; 223*.zst) _format=zstd ;;
224*) _format=none ;; 224*) _format=none ;;
225esac 225esac
226${TEST} -n "$format" || format="$_format" 226${TEST} -n "$format" || format="$_format"
227 227
228case "$format" in 228case "$format" in
229tar|shar) ;; 229tar|shar) ;;
230*) if ${TEST} "$distfile" = "-"; then 230*) if ${TEST} "$distfile" = "-"; then
231 ${ECHO} 1>&2 "$self: archive format cannot be given on standard input -- $format" 231 ${ECHO} 1>&2 "$self: archive format cannot be given on standard input -- $format"
232 exit 1 232 exit 1
233 fi 233 fi
234 ;; 234 ;;
235esac 235esac
236 236
237${TEST} -d "$extract_dir" || ${MKDIR} -p "$extract_dir" 237${TEST} -d "$extract_dir" || ${MKDIR} -p "$extract_dir"
238cd "$extract_dir" 238cd "$extract_dir"
239 239
240# Use the correct tool and extraction procedure to perform the extraction 240# Use the correct tool and extraction procedure to perform the extraction
241# based on the archive format. 241# based on the archive format.
242# 242#
243case "$format" in 243case "$format" in
244tar) 244tar)
245 case "$extract_using" in 245 case "$extract_using" in
246 *pax) 246 *pax)
247 : ${EXTRACT_OPTS_PAX=} 247 : ${EXTRACT_OPTS_PAX=}
248 case "$extract_using" in 248 case "$extract_using" in
249 /*) paxprog="$extract_using" ;; 249 /*) paxprog="$extract_using" ;;
250 *) paxprog="${PAX}" ;; 250 *) paxprog="${PAX}" ;;
251 esac 251 esac
252 if ${TEST} -n "$exclude_file"; then 252 if ${TEST} -n "$exclude_file"; then
253 exclude=yes 253 exclude=yes
254 set -- dummy `${CAT} "$exclude_file"`; shift 254 set -- dummy `${CAT} "$exclude_file"`; shift
255 fi 255 fi
256 ${TEST} "$exclude" = no || exclude_flag="-c" 256 ${TEST} "$exclude" = no || exclude_flag="-c"
257 $decompress_cat "$distfile" | 257 $decompress_cat "$distfile" |
258 $paxprog ${EXTRACT_OPTS_PAX} $exclude_flag -O -r ${1+"$@"} 258 $paxprog ${EXTRACT_OPTS_PAX} $exclude_flag -O -r ${1+"$@"}
259 ;; 259 ;;
260 *tar) 260 *tar)
261 : ${EXTRACT_OPTS_TAR=} 261 : ${EXTRACT_OPTS_TAR=--no-xattrs}
262 case "$extract_using" in 262 case "$extract_using" in
263 /*) tarprog="$extract_using" ;; 263 /*) tarprog="$extract_using" ;;
264 *) tarprog="${TAR}" ;; 264 *) tarprog="${TAR}" ;;
265 esac 265 esac
266 tmpfile= 266 tmpfile=
267 if ${TEST} "$exclude" = "yes"; then 267 if ${TEST} "$exclude" = "yes"; then
268 tmpfile="${TMPDIR}/$self.$$" 268 tmpfile="${TMPDIR}/$self.$$"
269 ${RM} -f "$tmpfile" 269 ${RM} -f "$tmpfile"
270 trap "\${RM} -f \"\$tmpfile\"" 0 270 trap "\${RM} -f \"\$tmpfile\"" 0
271 for i in ${1+"$@"}; do 271 for i in ${1+"$@"}; do
272 ${ECHO} "$i" >> "$tmpfile" 272 ${ECHO} "$i" >> "$tmpfile"
273 done 273 done
274 exclude_file="$tmpfile" 274 exclude_file="$tmpfile"
275 fi 275 fi
276 if ${TEST} -n "$exclude_file"; then 276 if ${TEST} -n "$exclude_file"; then
277 exclude_flag="-X $exclude_file" 277 exclude_flag="-X $exclude_file"
278 set -- dummy; shift 278 set -- dummy; shift
279 fi 279 fi
280 $decompress_cat "$distfile" | 280 $decompress_cat "$distfile" |
281 $tarprog ${EXTRACT_OPTS_TAR} $exclude_flag -xf - ${1+"$@"} 281 $tarprog ${EXTRACT_OPTS_TAR} $exclude_flag -xf - ${1+"$@"}
282 ;; 282 ;;
283 *) 283 *)
284 ${ECHO} 1>&2 "$self: unknown tar program: $extract_using" 284 ${ECHO} 1>&2 "$self: unknown tar program: $extract_using"
285 exit 1 285 exit 1
286 esac 286 esac
287 ;; 287 ;;
288 288
289cpio) 289cpio)
290 : ${EXTRACT_OPTS_PAX=} 290 : ${EXTRACT_OPTS_PAX=}
291 if ${TEST} -n "$exclude_file"; then 291 if ${TEST} -n "$exclude_file"; then
292 exclude=yes 292 exclude=yes
293 set -- dummy `${CAT} "$exclude_file"`; shift 293 set -- dummy `${CAT} "$exclude_file"`; shift
294 fi 294 fi
295 ${TEST} "$exclude" = no || exclude_flag="-c" 295 ${TEST} "$exclude" = no || exclude_flag="-c"
296 $decompress_cat "$distfile" | 296 $decompress_cat "$distfile" |
297 ${PAX} ${EXTRACT_OPTS_PAX} $exclude_flag -r ${1+"$@"} 297 ${PAX} ${EXTRACT_OPTS_PAX} $exclude_flag -r ${1+"$@"}
298 ;; 298 ;;
299 299
300shar) 300shar)
301 $decompress_cat "$distfile" | ${SH} 301 $decompress_cat "$distfile" | ${SH}
302 ;; 302 ;;
303 303
304zip) 304zip)
305 : ${EXTRACT_OPTS_ZIP=-aqo} 305 : ${EXTRACT_OPTS_ZIP=-aqo}
306 ${TEST} "$exclude" = "no" || exclude_flag="-x" 306 ${TEST} "$exclude" = "no" || exclude_flag="-x"
307 if ${TEST} -n "$exclude_file"; then 307 if ${TEST} -n "$exclude_file"; then
308 set -- dummy `${CAT} "$exclude_file"`; shift 308 set -- dummy `${CAT} "$exclude_file"`; shift
309 fi 309 fi
310 ${UNZIP_CMD} ${EXTRACT_OPTS_ZIP} "$distfile" $exclude_flag ${1+"$@"} 310 ${UNZIP_CMD} ${EXTRACT_OPTS_ZIP} "$distfile" $exclude_flag ${1+"$@"}
311 ;; 311 ;;
312 312
313lha) 313lha)
314 : ${EXTRACT_OPTS_LHA=q} 314 : ${EXTRACT_OPTS_LHA=q}
315 ${LHA} x${EXTRACT_OPTS_LHA} "$distfile" ${1+"$@"} 315 ${LHA} x${EXTRACT_OPTS_LHA} "$distfile" ${1+"$@"}
316 ;; 316 ;;
317 317
318compressed) 318compressed)
319 target="${distfile##*/}"; target="${target%.*}" 319 target="${distfile##*/}"; target="${target%.*}"
320 $decompress_cat "$distfile" > "$target" 320 $decompress_cat "$distfile" > "$target"
321 ;; 321 ;;
322 322
323zoo) 323zoo)
324 : ${EXTRACT_OPTS_ZOO=} 324 : ${EXTRACT_OPTS_ZOO=}
325 ${UNZOO} -x ${EXTRACT_OPTS_ZOO} "$distfile" ${1+"$@"} 325 ${UNZOO} -x ${EXTRACT_OPTS_ZOO} "$distfile" ${1+"$@"}
326 ;; 326 ;;
327 327
328rar) 328rar)
329 : ${EXTRACT_OPTS_RAR=-inul} 329 : ${EXTRACT_OPTS_RAR=-inul}
330 ${UNRAR} x ${EXTRACT_OPTS_RAR} "$distfile" ${1+"$@"} 330 ${UNRAR} x ${EXTRACT_OPTS_RAR} "$distfile" ${1+"$@"}
331 ;; 331 ;;
332 332
333rpm) 333rpm)
334 : ${EXTRACT_OPTS_RPM=} 334 : ${EXTRACT_OPTS_RPM=}
335 ${RPM2PKG} -d . ${EXTRACT_OPTS_RPM} "$distfile" ${1+"$@"} 335 ${RPM2PKG} -d . ${EXTRACT_OPTS_RPM} "$distfile" ${1+"$@"}
336 ;; 336 ;;
337 337
338jre-bin) 338jre-bin)
339 : ${EXTRACT_OPTS_BIN=} 339 : ${EXTRACT_OPTS_BIN=}
340 ${ECHO} yes | "$distfile" ${EXTRACT_OPTS_BIN} >/dev/null 340 ${ECHO} yes | "$distfile" ${EXTRACT_OPTS_BIN} >/dev/null
341 ;; 341 ;;
342 342
343gem) 343gem)
344 ${GEM} "$distfile" 344 ${GEM} "$distfile"
345 ;; 345 ;;
346 346
3477z) 3477z)
348 ${P7ZA} "$distfile" 348 ${P7ZA} "$distfile"
349 ;; 349 ;;
350 350
351zst) 351zst)
352 : ${EXTRACT_OPTS_ZSTD=} 352 : ${EXTRACT_OPTS_ZSTD=}
353 ${ZSTD} -d ${EXTRACT_OPTS_ZSTD} "$distfile" ${1+"$@"} 353 ${ZSTD} -d ${EXTRACT_OPTS_ZSTD} "$distfile" ${1+"$@"}
354 ;; 354 ;;
355 355
356none) 356none)
357 # By default, copy the distfile over to the current working directory. 357 # By default, copy the distfile over to the current working directory.
358 ${CP} "$distfile" . 358 ${CP} "$distfile" .
359 ;; 359 ;;
360 360
361*) 361*)
362 ${ECHO} 1>&2 "$self: archive format not recognized -- $format" 362 ${ECHO} 1>&2 "$self: archive format not recognized -- $format"
363 exit 1 363 exit 1
364 ;; 364 ;;
365esac 365esac
366 366
367exit 0 367exit 0

cvs diff -r1.44 -r1.45 pkgsrc/mk/extract/extract.mk (switch to unified diff)

--- pkgsrc/mk/extract/extract.mk 2022/11/23 13:30:38 1.44
+++ pkgsrc/mk/extract/extract.mk 2024/04/28 18:07:33 1.45
@@ -1,235 +1,235 @@ @@ -1,235 +1,235 @@
1# $NetBSD: extract.mk,v 1.44 2022/11/23 13:30:38 jperkin Exp $ 1# $NetBSD: extract.mk,v 1.45 2024/04/28 18:07:33 wiz Exp $
2# 2#
3# The following variables may be set by the package Makefile and 3# The following variables may be set by the package Makefile and
4# specify how extraction happens: 4# specify how extraction happens:
5# 5#
6# EXTRACT_DIR 6# EXTRACT_DIR
7# The directory into which the files are extracted. 7# The directory into which the files are extracted.
8# 8#
9# Default value: ${WRKDIR} 9# Default value: ${WRKDIR}
10# 10#
11# EXTRACT_DIR.${file} 11# EXTRACT_DIR.${file}
12# The directory into which the file ${file} is extracted. 12# The directory into which the file ${file} is extracted.
13# 13#
14# Default: ${EXTRACT_DIR} 14# Default: ${EXTRACT_DIR}
15# 15#
16# EXTRACT_ENV is the shell environment that is exported to the extract 16# EXTRACT_ENV is the shell environment that is exported to the extract
17# process. 17# process.
18# 18#
19# EXTRACTOR is the the the environment and path used to execute the 19# EXTRACTOR is the the the environment and path used to execute the
20# all-purpose extract script. 20# all-purpose extract script.
21# 21#
22# EXTRACT_CMD is a shell command list that extracts the contents of 22# EXTRACT_CMD is a shell command list that extracts the contents of
23# an archive named by the variable ${DOWNLOADED_DISTFILE} to the 23# an archive named by the variable ${DOWNLOADED_DISTFILE} to the
24# current working directory. The default is ${EXTRACT_CMD_DEFAULT}. 24# current working directory. The default is ${EXTRACT_CMD_DEFAULT}.
25# 25#
26# EXTRACT_OPTS is a list of options to pass to the "extract" script 26# EXTRACT_OPTS is a list of options to pass to the "extract" script
27# when using EXTRACT_CMD_DEFAULT. See the comments at the head of 27# when using EXTRACT_CMD_DEFAULT. See the comments at the head of
28# the "extract" script for a definitive list of the available 28# the "extract" script for a definitive list of the available
29# options. The default list is empty. 29# options. The default list is empty.
30# 30#
31# EXTRACT_ELEMENTS is a list of files within the distfile to extract 31# EXTRACT_ELEMENTS is a list of files within the distfile to extract
32# when using EXTRACT_CMD_DEFAULT. By default, this is empty, which 32# when using EXTRACT_CMD_DEFAULT. By default, this is empty, which
33# causes all files within the archive to be extracted. 33# causes all files within the archive to be extracted.
34# 34#
35# The following are read-only variables that may be used within a package 35# The following are read-only variables that may be used within a package
36# Makefile: 36# Makefile:
37# 37#
38# DOWNLOADED_DISTFILE represents the path to the distfile that is 38# DOWNLOADED_DISTFILE represents the path to the distfile that is
39# currently being extracted, and may be used in custom EXTRACT_CMD 39# currently being extracted, and may be used in custom EXTRACT_CMD
40# overrides, e.g. 40# overrides, e.g.
41# 41#
42# EXTRACT_CMD= ${TAIL} +25 ${DOWNLOADED_DISTFILE} > foo.pl 42# EXTRACT_CMD= ${TAIL} +25 ${DOWNLOADED_DISTFILE} > foo.pl
43# 43#
44# EXTRACT_CMD_DEFAULT uses the "extract" script to unpack archives. The 44# EXTRACT_CMD_DEFAULT uses the "extract" script to unpack archives. The
45# precise manner in which extraction occurs may be tweaked by setting 45# precise manner in which extraction occurs may be tweaked by setting
46# EXTRACT_OPTS, EXTRACT_USING and EXTRACT_ELEMENTS. 46# EXTRACT_OPTS, EXTRACT_USING and EXTRACT_ELEMENTS.
47# 47#
48 48
49EXTRACT_DIR?= ${WRKDIR} 49EXTRACT_DIR?= ${WRKDIR}
50.for f in ${EXTRACT_ONLY} 50.for f in ${EXTRACT_ONLY}
51EXTRACT_DIR.${f}?= ${EXTRACT_DIR} 51EXTRACT_DIR.${f}?= ${EXTRACT_DIR}
52.endfor 52.endfor
53 53
54_COOKIE.extract= ${WRKDIR}/.extract_done 54_COOKIE.extract= ${WRKDIR}/.extract_done
55 55
56###################################################################### 56######################################################################
57### extract (PUBLIC) 57### extract (PUBLIC)
58###################################################################### 58######################################################################
59### extract is a public target to perform extraction. 59### extract is a public target to perform extraction.
60### 60###
61_EXTRACT_TARGETS+= check-vulnerable 61_EXTRACT_TARGETS+= check-vulnerable
62_EXTRACT_TARGETS+= tools 62_EXTRACT_TARGETS+= tools
63_EXTRACT_TARGETS+= acquire-extract-lock 63_EXTRACT_TARGETS+= acquire-extract-lock
64_EXTRACT_TARGETS+= ${_COOKIE.extract} 64_EXTRACT_TARGETS+= ${_COOKIE.extract}
65_EXTRACT_TARGETS+= release-extract-lock 65_EXTRACT_TARGETS+= release-extract-lock
66 66
67.PHONY: extract 67.PHONY: extract
68.if !target(extract) 68.if !target(extract)
69. if exists(${_COOKIE.extract}) && !${_CLEANING} 69. if exists(${_COOKIE.extract}) && !${_CLEANING}
70extract: 70extract:
71 @${DO_NADA} 71 @${DO_NADA}
72. elif defined(_PKGSRC_BARRIER) 72. elif defined(_PKGSRC_BARRIER)
73extract: ${_EXTRACT_TARGETS} 73extract: ${_EXTRACT_TARGETS}
74. else 74. else
75extract: barrier 75extract: barrier
76. endif 76. endif
77.endif 77.endif
78 78
79.PHONY: acquire-extract-lock release-extract-lock 79.PHONY: acquire-extract-lock release-extract-lock
80acquire-extract-lock: acquire-lock 80acquire-extract-lock: acquire-lock
81release-extract-lock: release-lock 81release-extract-lock: release-lock
82 82
83.if exists(${_COOKIE.extract}) && !${_CLEANING} 83.if exists(${_COOKIE.extract}) && !${_CLEANING}
84${_COOKIE.extract}: 84${_COOKIE.extract}:
85 @${DO_NADA} 85 @${DO_NADA}
86.else 86.else
87${_COOKIE.extract}: real-extract 87${_COOKIE.extract}: real-extract
88.endif 88.endif
89 89
90###################################################################### 90######################################################################
91### real-extract (PRIVATE) 91### real-extract (PRIVATE)
92###################################################################### 92######################################################################
93### real-extract is a helper target onto which one can hook all of the 93### real-extract is a helper target onto which one can hook all of the
94### targets that do the actual extraction work. 94### targets that do the actual extraction work.
95### 95###
96_REAL_EXTRACT_TARGETS+= extract-check-interactive 96_REAL_EXTRACT_TARGETS+= extract-check-interactive
97_REAL_EXTRACT_TARGETS+= extract-message 97_REAL_EXTRACT_TARGETS+= extract-message
98_REAL_EXTRACT_TARGETS+= extract-vars 98_REAL_EXTRACT_TARGETS+= extract-vars
99_REAL_EXTRACT_TARGETS+= extract-dir 99_REAL_EXTRACT_TARGETS+= extract-dir
100_REAL_EXTRACT_TARGETS+= pre-extract 100_REAL_EXTRACT_TARGETS+= pre-extract
101_REAL_EXTRACT_TARGETS+= do-extract 101_REAL_EXTRACT_TARGETS+= do-extract
102_REAL_EXTRACT_TARGETS+= post-extract 102_REAL_EXTRACT_TARGETS+= post-extract
103_REAL_EXTRACT_TARGETS+= extract-cookie 103_REAL_EXTRACT_TARGETS+= extract-cookie
104_REAL_EXTRACT_TARGETS+= error-check 104_REAL_EXTRACT_TARGETS+= error-check
105 105
106.PHONY: real-extract 106.PHONY: real-extract
107real-extract: ${_REAL_EXTRACT_TARGETS} 107real-extract: ${_REAL_EXTRACT_TARGETS}
108 108
109.PHONY: extract-message 109.PHONY: extract-message
110extract-message: 110extract-message:
111 @${PHASE_MSG} "Extracting for ${PKGNAME}" 111 @${PHASE_MSG} "Extracting for ${PKGNAME}"
112 112
113.PHONY: extract-dir 113.PHONY: extract-dir
114extract-dir: 114extract-dir:
115 @${MKDIR} ${EXTRACT_DIR} 115 @${MKDIR} ${EXTRACT_DIR}
116.for f in ${EXTRACT_ONLY} 116.for f in ${EXTRACT_ONLY}
117 @${MKDIR} ${EXTRACT_DIR.${f}} 117 @${MKDIR} ${EXTRACT_DIR.${f}}
118.endfor 118.endfor
119 119
120###################################################################### 120######################################################################
121### extract-check-interactive (PRIVATE) 121### extract-check-interactive (PRIVATE)
122###################################################################### 122######################################################################
123### extract-check-interactive checks whether we must do an interactive 123### extract-check-interactive checks whether we must do an interactive
124### extraction or not. 124### extraction or not.
125### 125###
126.PHONY: extract-check-interactive 126.PHONY: extract-check-interactive
127extract-check-interactive: 127extract-check-interactive:
128.if !empty(INTERACTIVE_STAGE:Mextract) && defined(BATCH) 128.if !empty(INTERACTIVE_STAGE:Mextract) && defined(BATCH)
129 ${RUN} \ 129 ${RUN} \
130 ${ERROR_MSG} "The extract stage of this package requires user interaction"; \ 130 ${ERROR_MSG} "The extract stage of this package requires user interaction"; \
131 ${ERROR_MSG} "Please extract manually with:"; \ 131 ${ERROR_MSG} "Please extract manually with:"; \
132 ${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} extract\""; \ 132 ${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} extract\""; \
133 ${FALSE} 133 ${FALSE}
134.else 134.else
135 @${DO_NADA} 135 @${DO_NADA}
136.endif 136.endif
137 137
138###################################################################### 138######################################################################
139### extract-cookie (PRIVATE) 139### extract-cookie (PRIVATE)
140###################################################################### 140######################################################################
141### extract-cookie creates the "extract" cookie file. The contents 141### extract-cookie creates the "extract" cookie file. The contents
142### are the name of the package. 142### are the name of the package.
143### 143###
144.PHONY: extract-cookie 144.PHONY: extract-cookie
145extract-cookie: 145extract-cookie:
146 ${RUN} \ 146 ${RUN} \
147 ${TEST} ! -f ${_COOKIE.extract} || ${FALSE}; \ 147 ${TEST} ! -f ${_COOKIE.extract} || ${FALSE}; \
148 ${TEST} -d ${_COOKIE.extract:H} || ${MKDIR} ${_COOKIE.extract:H}; \ 148 ${TEST} -d ${_COOKIE.extract:H} || ${MKDIR} ${_COOKIE.extract:H}; \
149 ${ECHO} ${PKGNAME} > ${_COOKIE.extract} 149 ${ECHO} ${PKGNAME} > ${_COOKIE.extract}
150 150
151###################################################################### 151######################################################################
152### pre-extract, do-extract, post-extract (PUBLIC, override) 152### pre-extract, do-extract, post-extract (PUBLIC, override)
153###################################################################### 153######################################################################
154### {pre,do,post}-extract are the heart of the package-customizable 154### {pre,do,post}-extract are the heart of the package-customizable
155### extract targets, and may be overridden within a package Makefile. 155### extract targets, and may be overridden within a package Makefile.
156### 156###
157.PHONY: pre-extract do-extract post-extract 157.PHONY: pre-extract do-extract post-extract
158 158
159EXTRACT_ELEMENTS?= # empty 159EXTRACT_ELEMENTS?= # empty
160 160
161### 161###
162### Build the default extraction command 162### Build the default extraction command
163### 163###
164_EXTRACT_ENV+= ${EXTRACT_OPTS_BIN:D EXTRACT_OPTS_BIN=${EXTRACT_OPTS_BIN:Q}} 164_EXTRACT_ENV+= ${EXTRACT_OPTS_BIN:D EXTRACT_OPTS_BIN=${EXTRACT_OPTS_BIN:Q}}
165_EXTRACT_ENV+= ${EXTRACT_OPTS_LHA:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_LHA:Q}} 165_EXTRACT_ENV+= ${EXTRACT_OPTS_LHA:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_LHA:Q}}
166_EXTRACT_ENV+= ${EXTRACT_OPTS_PAX:D EXTRACT_OPTS_PAX=${EXTRACT_OPTS_PAX:Q}} 166_EXTRACT_ENV+= ${EXTRACT_OPTS_PAX:D EXTRACT_OPTS_PAX=${EXTRACT_OPTS_PAX:Q}}
167_EXTRACT_ENV+= ${EXTRACT_OPTS_RAR:D EXTRACT_OPTS_RAR=${EXTRACT_OPTS_RAR:Q}} 167_EXTRACT_ENV+= ${EXTRACT_OPTS_RAR:D EXTRACT_OPTS_RAR=${EXTRACT_OPTS_RAR:Q}}
168_EXTRACT_ENV+= ${EXTRACT_OPTS_RPM:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_RPM:Q}} 168_EXTRACT_ENV+= ${EXTRACT_OPTS_RPM:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_RPM:Q}}
169_EXTRACT_ENV+= ${EXTRACT_OPTS_TAR:D EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR:Q}} 169_EXTRACT_ENV+= ${EXTRACT_OPTS_TAR:D EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR:Q}}
170_EXTRACT_ENV+= ${EXTRACT_OPTS_ZIP:D EXTRACT_OPTS_ZIP=${EXTRACT_OPTS_ZIP:Q}} 170_EXTRACT_ENV+= ${EXTRACT_OPTS_ZIP:D EXTRACT_OPTS_ZIP=${EXTRACT_OPTS_ZIP:Q}}
171_EXTRACT_ENV+= ${EXTRACT_OPTS_ZSTD:D EXTRACT_OPTS_ZSTD=${EXTRACT_OPTS_ZSTD:Q}} 171_EXTRACT_ENV+= ${EXTRACT_OPTS_ZSTD:D EXTRACT_OPTS_ZSTD=${EXTRACT_OPTS_ZSTD:Q}}
172_EXTRACT_ENV+= ${EXTRACT_OPTS_ZOO:D EXTRACT_OPTS_ZOO=${EXTRACT_OPTS_ZOO:Q}} 172_EXTRACT_ENV+= ${EXTRACT_OPTS_ZOO:D EXTRACT_OPTS_ZOO=${EXTRACT_OPTS_ZOO:Q}}
173_EXTRACT_ENV+= ${TOOLS_CMDLINE_BZCAT:D BZCAT=${TOOLS_CMDLINE_BZCAT:Q}} 173_EXTRACT_ENV+= ${TOOLS_CMDLINE_BZCAT:D BZCAT=${TOOLS_CMDLINE_BZCAT:Q}}
174_EXTRACT_ENV+= ${TOOLS_CAT:D CAT=${TOOLS_CAT:Q}} 174_EXTRACT_ENV+= ${TOOLS_CAT:D CAT=${TOOLS_CAT:Q}}
175_EXTRACT_ENV+= ${TOOLS_CP:D CP=${TOOLS_CP:Q}} 175_EXTRACT_ENV+= ${TOOLS_CP:D CP=${TOOLS_CP:Q}}
176_EXTRACT_ENV+= ${TOOLS_ECHO:D ECHO=${TOOLS_ECHO:Q}} 176_EXTRACT_ENV+= ${TOOLS_ECHO:D ECHO=${TOOLS_ECHO:Q}}
177_EXTRACT_ENV+= ${TOOLS_CMDLINE.gzcat:D GZCAT=${TOOLS_CMDLINE.gzcat:Q}} 177_EXTRACT_ENV+= ${TOOLS_CMDLINE.gzcat:D GZCAT=${TOOLS_CMDLINE.gzcat:Q}}
178_EXTRACT_ENV+= ${TOOLS_LHA:D LHA=${TOOLS_LHA:Q}} 178_EXTRACT_ENV+= ${TOOLS_LHA:D LHA=${TOOLS_LHA:Q}}
179_EXTRACT_ENV+= ${TOOLS_MKDIR:D MKDIR=${TOOLS_MKDIR:Q}} 179_EXTRACT_ENV+= ${TOOLS_MKDIR:D MKDIR=${TOOLS_MKDIR:Q}}
180_EXTRACT_ENV+= ${TOOLS_RM:D RM=${TOOLS_RM:Q}} 180_EXTRACT_ENV+= ${TOOLS_RM:D RM=${TOOLS_RM:Q}}
181_EXTRACT_ENV+= ${TOOLS_RPM2PKG:D RPM2PKG=${TOOLS_RPM2PKG:Q}} 181_EXTRACT_ENV+= ${TOOLS_RPM2PKG:D RPM2PKG=${TOOLS_RPM2PKG:Q}}
182_EXTRACT_ENV+= ${TOOLS_PAX:D PAX=${TOOLS_PAX:Q}} 182_EXTRACT_ENV+= ${TOOLS_PAX:D PAX=${TOOLS_PAX:Q}}
183_EXTRACT_ENV+= ${TOOLS_SH:D SH=${TOOLS_SH:Q}} 183_EXTRACT_ENV+= ${TOOLS_SH:D SH=${TOOLS_SH:Q}}
184_EXTRACT_ENV+= ${TOOLS_TAR:D TAR=${TOOLS_TAR:Q}} 184_EXTRACT_ENV+= ${TOOLS_TAR:D TAR=${TOOLS_TAR:Q}}
185_EXTRACT_ENV+= ${TOOLS_TEST:D TEST=${TOOLS_TEST:Q}} 185_EXTRACT_ENV+= ${TOOLS_TEST:D TEST=${TOOLS_TEST:Q}}
186_EXTRACT_ENV+= ${TOOLS_UNRAR:D UNRAR=${TOOLS_UNRAR:Q}} 186_EXTRACT_ENV+= ${TOOLS_UNRAR:D UNRAR=${TOOLS_UNRAR:Q}}
187_EXTRACT_ENV+= ${TOOLS_UNZIP_CMD:D UNZIP_CMD=${TOOLS_UNZIP_CMD:Q}} 187_EXTRACT_ENV+= ${TOOLS_UNZIP_CMD:D UNZIP_CMD=${TOOLS_UNZIP_CMD:Q}}
188_EXTRACT_ENV+= ${TOOLS_UNZOO:D UNZOO=${TOOLS_UNZOO:Q}} 188_EXTRACT_ENV+= ${TOOLS_UNZOO:D UNZOO=${TOOLS_UNZOO:Q}}
189_EXTRACT_ENV+= ${TOOLS_XZCAT:D XZCAT=${TOOLS_XZCAT:Q}} 189_EXTRACT_ENV+= ${TOOLS_XZCAT:D XZCAT=${TOOLS_XZCAT:Q}}
190_EXTRACT_ENV+= ${TOOLS_7ZA:D P7ZA=${TOOLS_7ZA:Q}} 190_EXTRACT_ENV+= ${TOOLS_7ZA:D P7ZA=${TOOLS_7ZA:Q}}
191_EXTRACT_ENV+= ${TOOLS_ZSTD:D ZSTD=${TOOLS_ZSTD:Q}} 191_EXTRACT_ENV+= ${TOOLS_ZSTD:D ZSTD=${TOOLS_ZSTD:Q}}
192_EXTRACT_ENV+= ${EXTRACT_ENV} 192_EXTRACT_ENV+= ${EXTRACT_ENV}
193 193
194.if !empty(EXTRACT_USING:Mbsdtar) 194.if !empty(EXTRACT_USING:Mbsdtar)
195_EXTRACT_TAR= ${TOOLS_PATH.bsdtar} 195_EXTRACT_TAR= ${TOOLS_PATH.bsdtar}
196.elif !empty(EXTRACT_USING:Mgtar) 196.elif !empty(EXTRACT_USING:Mgtar)
197_EXTRACT_TAR= ${TOOLS_PATH.gtar} 197_EXTRACT_TAR= ${TOOLS_PATH.gtar}
198.elif !empty(EXTRACT_USING:Mnbtar) 198.elif !empty(EXTRACT_USING:Mnbtar)
199_EXTRACT_TAR= ${TOOLS_TAR} 199_EXTRACT_TAR= ${TOOLS_TAR}
200.elif !empty(EXTRACT_USING:Mpax) 200.elif !empty(EXTRACT_USING:Mpax)
201_EXTRACT_TAR= ${TOOLS_PAX} 201_EXTRACT_TAR= ${TOOLS_PAX}
202.else 202.else
203_EXTRACT_TAR= 203_EXTRACT_TAR=
204.endif 204.endif
205 205
206.if !empty(_EXTRACT_TAR) 206.if !empty(_EXTRACT_TAR)
207EXTRACT_OPTS+= -t ${_EXTRACT_TAR} 207EXTRACT_OPTS+= -t ${_EXTRACT_TAR}
208.endif 208.endif
209 209
210EXTRACTOR= \ 210EXTRACTOR= \
211 ${PKGSRC_SETENV} ${_EXTRACT_ENV} ${SH} ${PKGSRCDIR}/mk/extract/extract 211 ${PKGSRC_SETENV} ${_EXTRACT_ENV} ${SH} ${PKGSRCDIR}/mk/extract/extract
212EXTRACT_CMD_DEFAULT= \ 212EXTRACT_CMD_DEFAULT= \
213 ${EXTRACTOR} ${EXTRACT_OPTS} ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS} 213 ${EXTRACTOR} ${EXTRACT_OPTS} ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS}
214 214
215EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT} 215EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT}
216 216
217DOWNLOADED_DISTFILE= "$${extract_file}" 217DOWNLOADED_DISTFILE= "$${extract_file}"
218 218
219.if !target(do-extract) 219.if !target(do-extract)
220do-extract: ${WRKDIR} 220do-extract: ${WRKDIR}
221. for f in ${EXTRACT_ONLY} 221. for f in ${EXTRACT_ONLY}
222 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \ 222 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \
223 EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR.${f}}; export EXTRACT_OPTS_TAR; \ 223 if [ "" != "${EXTRACT_OPTS_TAR.${f}}" ]; then EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR.${f}}; export EXTRACT_OPTS_TAR; fi; \
224 cd ${WRKDIR} && cd ${EXTRACT_DIR.${f}} && ${EXTRACT_CMD} 224 cd ${WRKDIR} && cd ${EXTRACT_DIR.${f}} && ${EXTRACT_CMD}
225. endfor 225. endfor
226.endif 226.endif
227 227
228.if !target(pre-extract) 228.if !target(pre-extract)
229pre-extract: 229pre-extract:
230 @${DO_NADA} 230 @${DO_NADA}
231.endif 231.endif
232.if !target(post-extract) 232.if !target(post-extract)
233post-extract: 233post-extract:
234 @${DO_NADA} 234 @${DO_NADA}
235.endif 235.endif