From 8050b5f4ce314f0b9493e26c89429c4703398376 Mon Sep 17 00:00:00 2001 From: grant Date: Sun, 31 Oct 2004 02:48:12 +0000 Subject: 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. --- pkgtools/pkg_install/files/lib/ftpio.c | 23 ++++++++++++++++++++--- pkgtools/pkg_install/files/lib/version.h | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'pkgtools') 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 #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_ */ -- cgit v1.2.3