Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 May 2011 10:23:07 +0000 (UTC)
From:      Kai Wang <kaiw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221587 - stable/8/usr.bin/ar
Message-ID:  <201105071023.p47AN7ux092365@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kaiw
Date: Sat May  7 10:23:07 2011
New Revision: 221587
URL: http://svn.freebsd.org/changeset/base/221587

Log:
  MFC r208189:
  
  Removed ar(1)'s support for compressed archives. This change removes
  ar(1)'s dependencies on compressor libraries -lz, -lbz2 and -llzma and
  fixes building HEAD on some versions of FreeBSD[78]. Option -j and -z
  is now accepted but ignored.
  
  Compressed ar(1) archives are not useful without a ld(1) that can read
  them. Also, the current ar(1) compression scheme prevents random
  access of archive members and needs to be redesigned anyway.

Modified:
  stable/8/usr.bin/ar/Makefile
  stable/8/usr.bin/ar/acpyacc.y
  stable/8/usr.bin/ar/ar.1
  stable/8/usr.bin/ar/ar.c
  stable/8/usr.bin/ar/ar.h
  stable/8/usr.bin/ar/read.c
  stable/8/usr.bin/ar/write.c
Directory Properties:
  stable/8/usr.bin/ar/   (props changed)

Modified: stable/8/usr.bin/ar/Makefile
==============================================================================
--- stable/8/usr.bin/ar/Makefile	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/Makefile	Sat May  7 10:23:07 2011	(r221587)
@@ -5,15 +5,8 @@ SRCS=	ar.c acplex.l acpyacc.y read.c uti
 
 WARNS?=	5
 
-DPADD=	${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBELF}
-LDADD=	-larchive -lbz2 -lz -lelf
-
-# Do not depend on liblzma if we are building the bootstrap-tools and
-# the local system doesn't include liblzma
-.if !defined(BOOTSTRAPPING) || ${BOOTSTRAPPING} >= 800505
-DPADD+=	${LIBLZMA}
-LDADD+=	-llzma
-.endif
+DPADD=	${LIBARCHIVE} ${LIBELF}
+LDADD=	-larchive -lelf
 
 CFLAGS+=-I. -I${.CURDIR}
 

Modified: stable/8/usr.bin/ar/acpyacc.y
==============================================================================
--- stable/8/usr.bin/ar/acpyacc.y	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/acpyacc.y	Sat May  7 10:23:07 2011	(r221587)
@@ -250,7 +250,7 @@ arscp_open(char *fname)
 
 	if ((a = archive_read_new()) == NULL)
 		bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
-	archive_read_support_compression_all(a);
+	archive_read_support_compression_none(a);
 	archive_read_support_format_ar(a);
 	AC(archive_read_open_file(a, fname, DEF_BLKSZ));
 	if ((r = archive_read_next_header(a, &entry)))

Modified: stable/8/usr.bin/ar/ar.1
==============================================================================
--- stable/8/usr.bin/ar/ar.1	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/ar.1	Sat May  7 10:23:07 2011	(r221587)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 31, 2007
+.Dd May 17, 2010
 .Dt AR 1
 .Os
 .Sh NAME
@@ -186,8 +186,7 @@ Synonymous with option
 Synonymous with option
 .Fl b .
 .It Fl j
-Compress the resulting archive with
-.Xr bzip2 1 .
+This option is accepted but ignored.
 .It Fl m
 Move archive members specified by arguments
 .Ar files ...
@@ -344,8 +343,7 @@ of extraction unless the
 .Fl o
 option was specified.
 .It Fl z
-Compress the resulting archive with
-.Xr gzip 1 .
+This option is accepted but ignored.
 .El
 .Sh EXAMPLES
 To create a new archive

Modified: stable/8/usr.bin/ar/ar.c
==============================================================================
--- stable/8/usr.bin/ar/ar.c	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/ar.c	Sat May  7 10:23:07 2011	(r221587)
@@ -178,7 +178,7 @@ main(int argc, char **argv)
 			bsdar->options |= AR_TR;
 			break;
 		case 'j':
-			bsdar->options |= AR_J;
+			/* ignored */
 			break;
 		case 'l':
 			/* ignored, for GNU ar comptibility */
@@ -223,7 +223,7 @@ main(int argc, char **argv)
 			set_mode(bsdar, opt);
 			break;
 		case 'z':
-			bsdar->options |= AR_Z;
+			/* ignored */
 			break;
 		case OPTION_HELP:
 			bsdar_usage();

Modified: stable/8/usr.bin/ar/ar.h
==============================================================================
--- stable/8/usr.bin/ar/ar.h	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/ar.h	Sat May  7 10:23:07 2011	(r221587)
@@ -81,7 +81,6 @@ struct bsdar {
 	const char	 *addlib;	/* target of ADDLIB. */
 	const char	 *posarg;	/* position arg for modifiers -a, -b. */
 	char		  mode;		/* program mode */
-	char		  compression;	/* compression mode */
 	int		  options;	/* command line options */
 
 	const char	 *progname;	/* program name */

Modified: stable/8/usr.bin/ar/read.c
==============================================================================
--- stable/8/usr.bin/ar/read.c	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/read.c	Sat May  7 10:23:07 2011	(r221587)
@@ -87,7 +87,7 @@ read_archive(struct bsdar *bsdar, char m
 
 	if ((a = archive_read_new()) == NULL)
 		bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
-	archive_read_support_compression_all(a);
+	archive_read_support_compression_none(a);
 	archive_read_support_format_ar(a);
 	AC(archive_read_open_file(a, bsdar->filename, DEF_BLKSZ));
 

Modified: stable/8/usr.bin/ar/write.c
==============================================================================
--- stable/8/usr.bin/ar/write.c	Sat May  7 10:08:01 2011	(r221586)
+++ stable/8/usr.bin/ar/write.c	Sat May  7 10:23:07 2011	(r221587)
@@ -247,7 +247,7 @@ read_objs(struct bsdar *bsdar, const cha
 
 	if ((a = archive_read_new()) == NULL)
 		bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
-	archive_read_support_compression_all(a);
+	archive_read_support_compression_none(a);
 	archive_read_support_format_ar(a);
 	AC(archive_read_open_filename(a, archive, DEF_BLKSZ));
 	for (;;) {
@@ -264,13 +264,6 @@ read_objs(struct bsdar *bsdar, const cha
 			continue;
 		}
 
-		/*
-		 * Remember the compression mode of existing archive.
-		 * If neither -j nor -z is specified, this mode will
-		 * be used for resulting archive.
-		 */
-		bsdar->compression = archive_compression(a);
-
 		name = archive_entry_pathname(entry);
 
 		/*
@@ -360,9 +353,6 @@ write_archive(struct bsdar *bsdar, char 
 	pos = NULL;
 	memset(&sb, 0, sizeof(sb));
 
-	/* By default, no compression is assumed. */
-	bsdar->compression = ARCHIVE_COMPRESSION_NONE;
-
 	/*
 	 * Test if the specified archive exists, to figure out
 	 * whether we are creating one here.
@@ -618,23 +608,7 @@ write_objs(struct bsdar *bsdar)
 		bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_write_new failed");
 
 	archive_write_set_format_ar_svr4(a);
-
-	/* The compression mode of the existing archive is used
-	 * for the result archive or if creating a new archive, we
-	 * do not compress archive by default. This default behavior can
-	 * be overrided by compression mode specified explicitly
-	 * through command line option `-j' or `-z'.
-	 */
-	if (bsdar->options & AR_J)
-		bsdar->compression = ARCHIVE_COMPRESSION_BZIP2;
-	if (bsdar->options & AR_Z)
-		bsdar->compression = ARCHIVE_COMPRESSION_GZIP;
-	if (bsdar->compression == ARCHIVE_COMPRESSION_BZIP2)
-		archive_write_set_compression_bzip2(a);
-	else if (bsdar->compression == ARCHIVE_COMPRESSION_GZIP)
-		archive_write_set_compression_gzip(a);
-	else
-		archive_write_set_compression_none(a);
+	archive_write_set_compression_none(a);
 
 	AC(archive_write_open_filename(a, bsdar->filename));
 



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