summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2004-10-31 02:48:12 +0000
committergrant <grant@pkgsrc.org>2004-10-31 02:48:12 +0000
commit572d0d01db9ef858d8bd6e84816c63325ac74870 (patch)
treebdd8a836f90e605f3a206affeca9da65eefc4b28 /pkgtools
parent9d94b6fd74b594e0baae45660f1d852d2559604d (diff)
downloadpkgsrc-572d0d01db9ef858d8bd6e84816c63325ac74870.tar.gz
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 (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/lib/ftpio.c23
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 22 insertions, 5 deletions
diff --git a/pkgtools/pkg_install/files/lib/ftpio.c b/pkgtools/pkg_install/files/lib/ftpio.c
index dd97f25bace..ed81224e5ff 100644
--- a/pkgtools/pkg_install/files/lib/ftpio.c
+++ b/pkgtools/pkg_install/files/lib/ftpio.c
@@ -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 @@ unpackURL(const char *url, const char *dir)
{
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 --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index c02d6e3b6b1..cfd61b3d1eb 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -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_ */