summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/add/perform.c15
-rwxr-xr-xpkgtools/pkg_install/files/configure55
-rw-r--r--pkgtools/pkg_install/files/configure.in1
-rw-r--r--pkgtools/pkg_install/files/lib/config.h.in8
-rw-r--r--pkgtools/pkg_install/files/lib/file.c32
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h.in15
-rw-r--r--pkgtools/pkg_install/files/lib/pen.c16
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c6
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
9 files changed, 108 insertions, 44 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index 7e5361bfd54..6779e304c93 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.4 2003/03/29 18:41:56 jschauma Exp $ */
+/* $NetBSD: perform.c,v 1.5 2003/04/11 14:40:36 grant Exp $ */
#if 0
#include <sys/cdefs.h>
@@ -6,7 +6,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.4 2003/03/29 18:41:56 jschauma Exp $");
+__RCSID("$NetBSD: perform.c,v 1.5 2003/04/11 14:40:36 grant Exp $");
#endif
#endif
#endif
@@ -262,12 +262,11 @@ pkg_do(const char *pkg)
* compress an average of 75%, so multiply by 4 for good measure.
*/
- if (!inPlace && min_free(playpen) < sb.st_size * 4) {
- warnx("projected size of %ld exceeds available free space.\n"
- "Please set your PKG_TMPDIR variable to point to a location with more\n"
- "free space and try again", (long) (sb.st_size * 4));
- warnx("not extracting %s\ninto %s, sorry!",
- pkg, where_to);
+ if (!inPlace && min_free(playpen) < (u_long) sb.st_size * 4) {
+ warnx("projected size of %ld bytes exceeds available free space\n"
+ "in %s. Please set your PKG_TMPDIR variable to point\n"
+ "to a location with more free space and try again.",
+ (long) (sb.st_size * 4), playpen);
goto bomb;
}
diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure
index 10500cf59c4..a700cbf509b 100755
--- a/pkgtools/pkg_install/files/configure
+++ b/pkgtools/pkg_install/files/configure
@@ -2604,13 +2604,58 @@ fi
done
+
+echo $ac_n "checking for __attribute__""... $ac_c" 1>&6
+echo "configure:2610: checking for __attribute__" >&5
+if eval "test \"`echo '$''{'ac_cv___attribute__'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+cat > conftest.$ac_ext <<EOF
+#line 2616 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+
+int main() {
+
+static void foo(void) __attribute__ ((noreturn));
+
+static void
+foo(void)
+{
+ exit(1);
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:2633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv___attribute__=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv___attribute__=no
+fi
+rm -f conftest*
+fi
+
+if test "$ac_cv___attribute__" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE___ATTRIBUTE__ 1
+EOF
+
+fi
+echo "$ac_t""$ac_cv___attribute__" 1>&6
+
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2609: checking for working const" >&5
+echo "configure:2654: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2614 "configure"
+#line 2659 "configure"
#include "confdefs.h"
int main() {
@@ -2659,7 +2704,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2680,12 +2725,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2684: checking for size_t" >&5
+echo "configure:2729: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2689 "configure"
+#line 2734 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
diff --git a/pkgtools/pkg_install/files/configure.in b/pkgtools/pkg_install/files/configure.in
index c0d3b6ec96f..6db6e9f61c6 100644
--- a/pkgtools/pkg_install/files/configure.in
+++ b/pkgtools/pkg_install/files/configure.in
@@ -57,6 +57,7 @@ AC_CHECK_FUNCS(warnx)
AC_CHECK_FUNCS(MD5File)
dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C___ATTRIBUTE__
AC_C_CONST
AC_TYPE_SIZE_T
diff --git a/pkgtools/pkg_install/files/lib/config.h.in b/pkgtools/pkg_install/files/lib/config.h.in
index f475afe76b0..e59eca74449 100644
--- a/pkgtools/pkg_install/files/lib/config.h.in
+++ b/pkgtools/pkg_install/files/lib/config.h.in
@@ -63,6 +63,9 @@
/* Define if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
+/* Define if you have the <db_185.h> header file. */
+#undef HAVE_DB_185_H
+
/* Define if you have the <db.h> header file. */
#undef HAVE_DB_H
@@ -159,7 +162,10 @@
/* Define if you have the md library (-lmd). */
#undef HAVE_LIBMD
-#if !defined(HAVE___ATTRIBUTE__) && !defined(__linux__)
+/* Define if your compiler has __attribute__ */
+#undef HAVE___ATTRIBUTE__
+
+#ifndef HAVE___ATTRIBUTE__
# define __attribute__(x)
#endif
diff --git a/pkgtools/pkg_install/files/lib/file.c b/pkgtools/pkg_install/files/lib/file.c
index c93dd0680e0..dcb8b434a41 100644
--- a/pkgtools/pkg_install/files/lib/file.c
+++ b/pkgtools/pkg_install/files/lib/file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.3 2003/02/11 16:42:06 grant Exp $ */
+/* $NetBSD: file.c,v 1.4 2003/04/11 14:40:36 grant Exp $ */
#if 0
#include <sys/cdefs.h>
@@ -6,7 +6,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
#else
-__RCSID("$NetBSD: file.c,v 1.3 2003/02/11 16:42:06 grant Exp $");
+__RCSID("$NetBSD: file.c,v 1.4 2003/04/11 14:40:36 grant Exp $");
#endif
#endif
#endif
@@ -547,23 +547,23 @@ int
unpack(const char *pkg, const char *flist)
{
char args[10] = "-";
- char *cp;
+ const char *decompress_cmd;
+ const char *suf;
- /*
- * Figure out by a crude heuristic whether this or not this is probably
- * compressed.
- */
if (!IS_STDIN(pkg)) {
- cp = strrchr(pkg, '.');
- if (cp) {
- cp++;
- if (strchr(cp, 'z') || strchr(cp, 'Z'))
- strcat(args, "z");
- }
+ suf = suffix_of(pkg);
+ if (!strcmp(suf, "tbz") || !strcmp(suf, "bz2"))
+ decompress_cmd = BZIP2_CMD " -c -d";
+ else if (!strcmp(suf, "tgz") || !strcmp(suf, "gz"))
+ decompress_cmd = GZIP_CMD " -c -d";
+ else if (!strcmp(suf, "tar"))
+ decompress_cmd = "cat";
+ else
+ errx(EXIT_FAILURE, "don't know how to decompress %s", pkg);
} else
- strcat(args, "z");
- strcat(args, "xpf");
- if (vsystem("%s %s %s %s", TAR_FULLPATHNAME, args, pkg, flist ? flist : "")) {
+ decompress_cmd = GZIP_CMD " -c -d";
+ strcat(args, "xpf -");
+ if (vsystem("%s %s | %s %s %s", decompress_cmd, pkg, TAR_FULLPATHNAME, args, flist ? flist : "")) {
warnx("%s extract of %s failed!", TAR_FULLPATHNAME, pkg);
return 1;
}
diff --git a/pkgtools/pkg_install/files/lib/lib.h.in b/pkgtools/pkg_install/files/lib/lib.h.in
index 20118609c40..b29cd3c4d8d 100644
--- a/pkgtools/pkg_install/files/lib/lib.h.in
+++ b/pkgtools/pkg_install/files/lib/lib.h.in
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h.in,v 1.4 2003/03/16 19:44:10 jschauma Exp $ */
+/* $NetBSD: lib.h.in,v 1.5 2003/04/11 14:40:36 grant Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -78,10 +78,21 @@
#ifndef TAR_FULLPATHNAME
#define TAR_FULLPATHNAME "@TAR_FULLPATHNAME@"
#endif
+
/* Define ftp as a string, in case the ftp client is called something else */
#ifndef FTP_CMD
#define FTP_CMD "ftp"
#endif
+
+/* Define gzip and bzip2, used to unpack binary packages */
+#ifndef GZIP_CMD
+#define GZIP_CMD "gzip"
+#endif
+
+#ifndef BZIP2_CMD
+#define BZIP2_CMD "bzip2"
+#endif
+
#ifndef ADD_CMD
#define ADD_CMD "@prefix@/sbin/pkg_add"
#endif
@@ -339,7 +350,7 @@ void cleanup(int);
char *make_playpen(char *, size_t, size_t);
char *where_playpen(void);
void leave_playpen(char *);
-off_t min_free(char *);
+uint64_t min_free(char *);
void save_dirs(char **c, char **p);
void restore_dirs(char *c, char *p);
void show_version(void);
diff --git a/pkgtools/pkg_install/files/lib/pen.c b/pkgtools/pkg_install/files/lib/pen.c
index a40130a4efc..17b98821555 100644
--- a/pkgtools/pkg_install/files/lib/pen.c
+++ b/pkgtools/pkg_install/files/lib/pen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.4 2003/03/16 19:44:10 jschauma Exp $ */
+/* $NetBSD: pen.c,v 1.5 2003/04/11 14:40:36 grant Exp $ */
#if 0
#include <sys/cdefs.h>
@@ -6,7 +6,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.4 2003/03/16 19:44:10 jschauma Exp $");
+__RCSID("$NetBSD: pen.c,v 1.5 2003/04/11 14:40:36 grant Exp $");
#endif
#endif
#endif
@@ -227,8 +227,8 @@ leave_playpen(char *save)
* We do this autoconf dance here to get around the old interface (it's
* in libc on 2.7 and 2.8, but not in 2.9)
*/
-#if !defined(HAVE_STATFS) || (defined(HAVE_STATFS) && defined(HAVE_STATVFS) && !defined(__linux__))
-/* $NetBSD: pen.c,v 1.4 2003/03/16 19:44:10 jschauma Exp $ */
+#if !defined(HAVE_STATFS) || (defined(HAVE_STATFS) && defined(HAVE_STATVFS) && !defined(__linux__) && !defined(__FreeBSD__))
+/* $NetBSD: pen.c,v 1.5 2003/04/11 14:40:36 grant Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -402,9 +402,11 @@ fstatfs(fd, sfs)
#endif
/*
- * Return free disk space (in bytes) on given file system
+ * Return free disk space (in bytes) on given file system.
+ * Returns size in a uint64_t since off_t isn't 64 bits on all
+ * operating systems.
*/
-off_t
+uint64_t
min_free(char *tmpdir)
{
struct statfs buf;
@@ -413,5 +415,5 @@ min_free(char *tmpdir)
warn("statfs");
return -1;
}
- return (off_t) buf.f_bavail * (off_t) buf.f_bsize;
+ return (uint64_t) buf.f_bavail * (uint64_t) buf.f_bsize;
}
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 907a2db3605..2083d0f4965 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,9 +1,9 @@
-/* $NetBSD: pkgdb.c,v 1.9 2003/03/29 18:41:57 jschauma Exp $ */
+/* $NetBSD: pkgdb.c,v 1.10 2003/04/11 14:40:37 grant Exp $ */
#if 0
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.9 2003/03/29 18:41:57 jschauma Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.10 2003/04/11 14:40:37 grant Exp $");
#endif
#endif
@@ -196,7 +196,7 @@ pkgdb_dump(void)
}
pkgdb_close();
}
-#endif
+#endif /* HAVE_DBOPEN */
}
/*
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 5963c18f4d3..472b4efbd5e 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.6 2003/03/29 18:41:57 jschauma Exp $ */
+/* $NetBSD: version.h,v 1.7 2003/04/11 14:40:37 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 "20030325"
+#define PKGTOOLS_VERSION "20030411"
#endif /* _INST_LIB_VERSION_H_ */