Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 1999 22:07:41 -0800 (PST)
From:      asami@FreeBSD.ORG (Satoshi Asami)
To:        sada@rr.iij4u.or.jp
Cc:        kkennawa@physics.adelaide.edu.au, ports@FreeBSD.ORG
Subject:   Re: USE_BZIP2
Message-ID:  <199902020607.WAA05408@silvia.hip.berkeley.edu>
In-Reply-To: <19990201102231.10200.sada@rr.iij4u.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
 * I agree.  For example, `automatic sensing' would be realized as below,
 * but I can't imagine how to auto-depend to ${PORTSDIR}/archivers/bzip2.

Let's not make it too complicated.  A USE_BZIP2 variable suits us just 
fine, I think.

What about something like this?

===
Index: bsd.port.mk
===================================================================
RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.303
diff -u -r1.303 bsd.port.mk
--- bsd.port.mk	1999/01/26 03:58:58	1.303
+++ bsd.port.mk	1999/02/02 05:54:26
@@ -52,8 +52,9 @@
 # DISTFILES		- Name(s) of archive file(s) containing distribution
 #				  (default: ${DISTNAME}${EXTRACT_SUFX}).  Set this to
 #				  an empty string if the port doesn't require it.
-# EXTRACT_SUFX	- Suffix for archive names (default: .tar.gz).  You
-#				  never have to set both DISTFILES and EXTRACT_SUFX.
+# EXTRACT_SUFX	- Suffix for archive names (default: .tar.bz2 if USE_BZIP2
+#				  is set, .tar.gz otherwise).  You never have to set both
+#				  DISTFILES and EXTRACT_SUFX.
 # MASTER_SITES	- Primary location(s) for distribution files if not found
 #				  locally.
 # PATCHFILES	- Name(s) of additional files that contain distribution
@@ -111,6 +112,8 @@
 #
 # Use these if your port uses some of the common software packages.
 #
+# USE_BZIP2		- Says that the port tarballs use bzip2, not gzip, for
+#				  compression.
 # USE_GMAKE		- Says that the port uses gmake.
 # GMAKE			- Set to path of GNU make if not in $PATH (default: gmake).
 # USE_AUTOCONF	- Says that the port uses autoconf.  Implies GNU_CONFIGURE.
@@ -311,13 +314,14 @@
 #
 # For extract:
 #
-# EXTRACT_CMD	- Command for extracting archive (default: tar).
+# EXTRACT_CMD	- Command for extracting archive (default: "bzip2" if
+#				  USE_BZIP2 is set, "gzip" if not).
 # EXTRACT_BEFORE_ARGS -
 #				  Arguments to ${EXTRACT_CMD} before filename
-#				  (default: -xzf).
+#				  (default: "-dc").
 # EXTRACT_AFTER_ARGS -
 #				  Arguments to ${EXTRACT_CMD} following filename
-#				  (default: none).
+#				  (default: "| tar -xf -").
 #
 # For configure:
 #
@@ -456,7 +460,11 @@
 X11BASE?=		${DESTDIR}/usr/X11R6
 DISTDIR?=		${PORTSDIR}/distfiles
 _DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
-EXTRACT_SUFX?=	.tar.gz
+.if defined(USE_BZIP2)
+EXTRACT_SUFX?=			.tar.bz2
+.else
+EXTRACT_SUFX?=			.tar.gz
+.endif
 PACKAGES?=		${PORTSDIR}/packages
 TEMPLATES?=		${PORTSDIR}/Templates
 
@@ -547,6 +555,9 @@
 MANCOMPRESSED?=	no
 .endif
 
+.if defined(USE_BZIP2)
+BUILD_DEPENDS+=		bzip2:${PORTSDIR}/archivers/bzip2
+.endif
 .if defined(USE_GMAKE)
 BUILD_DEPENDS+=		gmake:${PORTSDIR}/devel/gmake
 .endif
@@ -661,15 +672,18 @@
 .endif
 
 .if exists(/bin/tar)
-EXTRACT_CMD?=	/bin/tar
+TAR?=	/bin/tar
 .else
-EXTRACT_CMD?=	/usr/bin/tar
+TAR?=	/usr/bin/tar
 .endif
-# Backwards compatability.
-.if defined(EXTRACT_ARGS)
-EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
+
+# EXTRACT_SUFX is defined in .pre.mk section
+EXTRACT_BEFORE_ARGS?=	-dc
+EXTRACT_AFTER_ARGS?=	| ${TAR} -xf -
+.if defined(USE_BZIP2)
+EXTRACT_CMD?=			bzip2
 .else
-EXTRACT_BEFORE_ARGS?=   -xzf
+EXTRACT_CMD?=			${GZIP_CMD}
 .endif
 
 # Figure out where the local mtree file is
===

(Warning: hasn't been tested for bzip2.)

I changed defaults EXTRACT_{BEFORE,AFTER}_ARGS so .tar.gz and .tar.bz2
can be handled almost identically.  We will have to go through the
tree and make sure existing ports that use those two variables are
fixed properly.

One snag is that since gzip or bzip2 spits out nothing to stdout when
the input format is invalid, the extract pipeline actually returns a
success (tar gets an empty file and happily exits normally without
doing anything) so the make will fail a few more steps down the road,
instead of right in the extract command.

But I think it's still easy enough to debug, the error message from
gzip or bzip2 is right there in the log.

===
===>  Extracting for oneko-1.2
>> Checksum OK for oneko-1.2.tar.gz.
===>   oneko-1.2 depends on executable: bzip2 - found
===>   oneko-1.2 depends on shared library: X11.6 - found
bzip2: Input file name /i/ports/distfiles//oneko-1.2.tar.gz doesn't end in `.bz2', skipping.
===>  Patching for oneko-1.2
===>  Configuring for oneko-1.2
cannot create /i/ports/games/oneko/work/oneko-1.2/Imakefile: directory nonexistent
*** Error code 2

Stop.
*** Error code 1
===

Satoshi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902020607.WAA05408>