Subject: pkg/6901: there is no easy way how to handle bzip2ped archives
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <jdolecek@per4mance.cz>
List: netbsd-bugs
Date: 01/28/1999 16:52:52
>Number:         6901
>Category:       pkg
>Synopsis:       there is no easy way how to handle bzip2ped archives
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 28 08:05:02 1999
>Last-Modified:
>Originator:     Jaromir Dolecek
>Organization:
ICS MU, Brno, Czech Republic
>Release:        NetBSD-19991207
>Environment:
	
System: NetBSD jdolecek.per4mance.cz 1.3I NetBSD 1.3I (JDOLECEK) #38: Wed Jan 20 00:15:24 MET 1999 dolecek@jdolecek.per4mance.cz:/home/dolecek/tmp/src/sys/arch/i386/compile/JDOLECEK i386


>Description:
	Some packages (KDE 1.1 at least) use tar archive compressed
	by bzip2 instead of "standard" tar.gz. We might assume
	there will be more such packages in future, as bzip2
	compression is generally better than gzip one. There should
	be some standard way how to handle such packages, so it
	won't be necessary to hack each one separately.
>How-To-Repeat:
	Try to make package for KDE 1.1pre2.
>Fix:
	Here is a hack, which does what I need. It adds variable
	EXTRACT_BZIP2 -- if it's set in pkg's Makefile, the
	extracting process is adjusted so that the pkg doesn't
	need any additional magic. The patch assumes bunzip2
	is in $PATH, if it's available; when it's not found,
	it builds bunzip2 from pkg collection.

--- bsd.pkg.mk.orig	Thu Jan 28 15:11:16 1999
+++ bsd.pkg.mk	Thu Jan 28 15:33:01 1999
@@ -244,7 +244,11 @@
 
 .if exists(/bin/pax) && (${OPSYS} != "NetBSD")
 EXTRACT_CMD?=		/bin/pax
+.if defined(EXTRACT_BZIP2)
+EXTRACT_BEFORE_ARGS?=	-rf
+.else
 EXTRACT_BEFORE_ARGS?=	-zrf
+.endif
 .else
 .if exists(/bin/tar)
 EXTRACT_CMD?=		/bin/tar
@@ -255,10 +259,29 @@
 .if defined(EXTRACT_ARGS)
 EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
 .else
+.if defined(EXTRACT_BZIP2)
+EXTRACT_BEFORE_ARGS?=   -xf
+.else
 EXTRACT_BEFORE_ARGS?=   -xzf
 .endif
 .endif
+.endif
+.if defined(EXTRACT_BZIP2)
+EXTRACT_SUFX?=		.tar.bz2
+.else
 EXTRACT_SUFX?=		.tar.gz
+.endif
+
+.if defined(EXTRACT_BZIP2)
+# set up all EXTRACT_* variables so we will DTRT in do-extract target
+# for bzip2ped archives
+.if !defined(EXTRACT_AFTER_ARGS)
+EXTRACT_AFTER_ARGS:=	| $(EXTRACT_CMD) ${EXTRACT_BEFORE_ARGS} -
+.endif
+EXTRACT_CMD=		bunzip2
+EXTRACT_BEFORE_ARGS=	-c
+BUILD_DEPENDS+=		bunzip2:../../archivers/bzip2
+.endif
 
 # Figure out where the local mtree file is
 .if !defined(MTREE_FILE)
--- packages.7.orig	Thu Jan 28 16:29:18 1999
+++ packages.7	Thu Jan 28 16:36:25 1999
@@ -395,6 +395,10 @@
 Arguments to
 .Dv ${EXTRACT_CMD}
 following the filename argument.  There is no default.
+.It EXTRACT_BZIP2
+If defined, the package is assumed to be compressed by
+bzip2(1) instead of gzip(1) and extract process
+is appropriately adjusted.
 .It FETCH_CMD		 
 Full path to ftp/http command if not in
 .Dv $PATH .
>Audit-Trail:
>Unformatted: