diff options
author | agc <agc> | 1999-04-01 14:07:52 +0000 |
---|---|---|
committer | agc <agc> | 1999-04-01 14:07:52 +0000 |
commit | 0e80196c5fa544a8f2ac9cb799fbe25948361831 (patch) | |
tree | 912abdad11a5164aee0a40a8b94b48bf6cea9e79 /mk/bsd.pkg.mk | |
parent | 131321b966a315123f6c845f7317d4277e5363a2 (diff) | |
download | pkgsrc-0e80196c5fa544a8f2ac9cb799fbe25948361831.tar.gz |
Rewrite the extraction commands to be more intuitive.
In the vast majority of cases, nothing has changed (i.e. .tgz, .tar.gz,
and .tar.bz2).
EXTRACT_USING_PAX can be set as before.
For custom extractions, instead of using EXTRACT_BEFORE_ARGS,
EXTRACT_AFTER_ARGS and EXTRACT_CMD, simply set EXTRACT_CMD to be the
command needed to decompress and extract the lements from the archive.
${DOWNLOADED_DISTFILE} can be used to reference the distfile(s).
e.g. for compressed shars, where previously there was:
EXTRACT_CMD= ${GZCAT}
EXTRACT_BEFORE_ARGS=
EXTRACT_AFTER_ARGS= |sh
now use:
EXTRACT_CMD= ${GZCAT} ${DOWNLOADED_DISTFILE} | ${SH}
Diffstat (limited to 'mk/bsd.pkg.mk')
-rw-r--r-- | mk/bsd.pkg.mk | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 127344237ef..978f4dcf419 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.239 1999/04/01 07:29:14 agc Exp $ +# $NetBSD: bsd.pkg.mk,v 1.240 1999/04/01 14:07:55 agc Exp $ # # This file is in the public domain. # @@ -266,31 +266,35 @@ PATCH_ARGS+= -C PATCH_DIST_ARGS+= -C .endif +# New decompress and extract definitions + # If the archive has a .bz2 suffix, use bzip2 to extract information # If EXTRACT_USING_PAX is defined, use pax in preference to (GNU) tar, # and append 2 tar blocks of zero bytes on the end, in case the archive # was written with a buggy version of GNU tar. EXTRACT_SUFX?= .tar.gz -.if (${EXTRACT_SUFX} == ".tar.bz2") + +.if ${EXTRACT_SUFX} == ".tar.bz2" .if exists(/usr/bin/bzcat) BZCAT= /usr/bin/bzcat .else BZCAT= ${LOCALBASE}/bin/bzcat BUILD_DEPENDS+= ${BZCAT}:${PKGSRCDIR}/archivers/bzip2 .endif # !exists bzcat -EXTRACT_CMD?= ${EXTRACT_SUBSHELL_OPEN} ${BZCAT} -EXTRACT_BEFORE_ARGS?= < -.else # suffix != .tar.bz2 -EXTRACT_CMD?= ${EXTRACT_SUBSHELL_OPEN} ${GZCAT} -EXTRACT_BEFORE_ARGS?= < +DECOMPRESS_CMD?= ${BZCAT} +.else +DECOMPRESS_CMD?= ${GZCAT} +.endif + +# If this is empty, then everything gets extracted. +EXTRACT_ELEMENTS?= + .if defined(EXTRACT_USING_PAX) -EXTRACT_SUBSHELL_OPEN= ( -EXTRACT_AFTER_ARGS?= ; dd if=/dev/zero bs=10k count=2 ) | ${PAX} -r +EXTRACT_CMD?= (${DECOMPRESS_CMD} ${DOWNLOADED_DISTFILE} ; dd if=/dev/zero bs=10k count=2) | ${PAX} -r ${EXTRACT_ELEMENTS} .else -EXTRACT_AFTER_ARGS?= | /usr/bin/tar -xf - -.endif # !pax -.endif # suffix != .tar.bz2 +EXTRACT_CMD?= ${DECOMPRESS_CMD} ${DOWNLOADED_DISTFILE} | /usr/bin/tar xf - ${EXTRACT_ELEMENTS} +.endif # Figure out where the local mtree file is .if !defined(MTREE_FILE) @@ -1020,6 +1024,8 @@ mirror-distfiles: # Extract +DOWNLOADED_DISTFILE= ${_DISTDIR}/$$file + .if !target(do-extract) do-extract: .ifndef NO_WRKDIR @@ -1036,7 +1042,7 @@ do-extract: ${_PKG_SILENT}${_PKG_DEBUG} \ for file in "" ${EXTRACT_ONLY}; do \ if [ "X$$file" = X"" ]; then continue; fi; \ - (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS}); \ + (cd ${WRKDIR} && ${EXTRACT_CMD}); \ done .endif |