pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib sync with src:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ca4b99ea4b64
branches:  trunk
changeset: 482626:ca4b99ea4b64
user:      grant <grant%pkgsrc.org@localhost>
date:      Sun Oct 31 02:48:12 2004 +0000

description:
sync with src:

don't explicitly call gunzip, just pass the right arguments to tar.

fixes package decompression on Solaris where gunzip is not available
(but gzip is), and also decompression of bzip2 packages on non-NetBSD.

diffstat:

 pkgtools/pkg_install/files/lib/ftpio.c   |  23 ++++++++++++++++++++---
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 2 files changed, 22 insertions(+), 5 deletions(-)

diffs (66 lines):

diff -r 8c1a5b8c179d -r ca4b99ea4b64 pkgtools/pkg_install/files/lib/ftpio.c
--- a/pkgtools/pkg_install/files/lib/ftpio.c    Sun Oct 31 00:53:10 2004 +0000
+++ b/pkgtools/pkg_install/files/lib/ftpio.c    Sun Oct 31 02:48:12 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftpio.c,v 1.10 2004/08/20 20:09:53 jlam Exp $  */
+/*     $NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.10 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $");
 #endif
 
 /*-
@@ -1221,12 +1221,29 @@
 
        {
                char cmd[1024];
+               const char *decompress_cmd = NULL;
+               const char *suf;
 
                if (Verbose)
                        printf("unpackURL '%s' to '%s'\n", url, dir);
 
+               suf = suffix_of(pkg);
+               if (!strcmp(suf, "tbz") || !strcmp(suf, "bz2"))
+                       decompress_cmd = BZIP2_CMD;
+               else if (!strcmp(suf, "tgz") || !strcmp(suf, "gz"))
+                       decompress_cmd = GZIP_CMD;
+               else if (!strcmp(suf, "tar"))
+                       ; /* do nothing */
+               else
+                       errx(EXIT_FAILURE, "don't know how to decompress %s, sorry", pkg);
+
                /* yes, this is gross, but needed for borken ftp(1) */
-               (void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s ; gunzip 2>/dev/null | " TAR_CMD " -%sx -f - | tee /dev/stderr )\"\n", pkg, dir, Verbose?"vv":"");
+               (void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s; " TAR_CMD " %s %s -%sx -f - | tee /dev/stderr )\"\n",
+                   pkg, dir,
+                   decompress_cmd != NULL ? "--use-compress-program" : "",
+                   decompress_cmd != NULL ? decompress_cmd : "",
+                   Verbose? "vv" : "");
+
                rc = ftp_cmd(cmd, "\n(226|550).*\n");
                if (rc != 226) {
                        warnx("Cannot fetch file (%d!=226)!", rc);
diff -r 8c1a5b8c179d -r ca4b99ea4b64 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Sun Oct 31 00:53:10 2004 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Sun Oct 31 02:48:12 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.33 2004/08/20 20:09:53 jlam Exp $        */
+/*     $NetBSD: version.h,v 1.34 2004/10/31 02:48:12 grant Exp $       */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -33,6 +33,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20040813"
+#define PKGTOOLS_VERSION "20041031"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index