summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2003-12-20 04:23:05 +0000
committergrant <grant@pkgsrc.org>2003-12-20 04:23:05 +0000
commitd5a22b3847716a07bd1991c8d28fa726c50b68bd (patch)
tree5441b20d6704ddeceaf43b7edd64df44995b299f /pkgtools/pkg_install
parent52bee2597e4135df0dc166a2ee0c683d937fef41 (diff)
downloadpkgsrc-d5a22b3847716a07bd1991c8d28fa726c50b68bd.tar.gz
Sync pkgtools/pkg_install with src/usr.sbin/pkg_install from 20031220.
New features include OS/arch/version checking and a large speed improvement to pkg_info.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/add/main.c9
-rw-r--r--pkgtools/pkg_install/files/add/perform.c122
-rw-r--r--pkgtools/pkg_install/files/add/pkg_add.116
-rw-r--r--pkgtools/pkg_install/files/add/pkg_add.cat131
-rwxr-xr-xpkgtools/pkg_install/files/configure3
-rw-r--r--pkgtools/pkg_install/files/configure.ac2
-rw-r--r--pkgtools/pkg_install/files/info/perform.c6
-rw-r--r--pkgtools/pkg_install/files/lib/config.h.in3
-rw-r--r--pkgtools/pkg_install/files/lib/file.c116
-rw-r--r--pkgtools/pkg_install/files/lib/ftpio.c9
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h18
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
12 files changed, 209 insertions, 130 deletions
diff --git a/pkgtools/pkg_install/files/add/main.c b/pkgtools/pkg_install/files/add/main.c
index ee20a31a428..2359fb0fb99 100644
--- a/pkgtools/pkg_install/files/add/main.c
+++ b/pkgtools/pkg_install/files/add/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 2003/09/23 07:13:46 grant Exp $ */
+/* $NetBSD: main.c,v 1.6 2003/12/20 04:23:05 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.5 2003/09/23 07:13:46 grant Exp $");
+__RCSID("$NetBSD: main.c,v 1.6 2003/12/20 04:23:05 grant Exp $");
#endif
#endif
@@ -201,9 +201,8 @@ main(int argc, char **argv)
}
error += pkg_perform(&pkgs);
- if (error != 0) {
- if (Verbose)
- warnx("%d package addition(s) failed", error);
+ if (error != 0) {
+ warnx("%d package addition%s failed", error, error == 1 ? "" : "s");
exit(1);
}
exit(0);
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index a3be2f50bd8..7471e65fbc5 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.12 2003/09/23 13:22:38 grant Exp $ */
+/* $NetBSD: perform.c,v 1.13 2003/12/20 04:23:05 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,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.12 2003/09/23 13:22:38 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.13 2003/12/20 04:23:05 grant Exp $");
#endif
#endif
@@ -51,6 +51,11 @@ __RCSID("$NetBSD: perform.c,v 1.12 2003/09/23 13:22:38 grant Exp $");
#if HAVE_STRING_H
#include <string.h>
#endif
+#if HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
+static int read_buildinfo(char **);
static char LogDir[FILENAME_MAX];
static int zapLogDir; /* Should we delete LogDir? */
@@ -117,14 +122,16 @@ pkg_do(const char *pkg)
char replace_from[FILENAME_MAX];
char replace_via[FILENAME_MAX];
char replace_to[FILENAME_MAX];
+ char *buildinfo[BI_ENUM_COUNT];
int replacing = 0;
char *where_to;
char dbdir[FILENAME_MAX];
- const char *exact, *extra1, *extra2;
+ const char *exact, *extra1;
FILE *cfile;
int errc;
plist_t *p;
struct stat sb;
+ struct utsname host_uname;
int inPlace;
int rc;
Boolean is_depoted_pkg = FALSE;
@@ -185,11 +192,10 @@ pkg_do(const char *pkg)
goto bomb;
}
}
- extra1 = "--fast-read";
- extra2 = CONTENTS_FNAME;
+ extra1 = CONTENTS_FNAME;
} else {
/* some values for stdin */
- extra1 = extra2 = NULL;
+ extra1 = NULL;
sb.st_size = 100000; /* Make up a plausible average size */
}
Home = make_playpen(playpen, sizeof(playpen), sb.st_size * 4);
@@ -197,7 +203,7 @@ pkg_do(const char *pkg)
warnx("unable to make playpen for %ld bytes",
(long) (sb.st_size * 4));
where_to = Home;
- if (unpack(pkg, extra1, extra2)) {
+ if (unpack(pkg, extra1)) {
warnx("unable to extract table of contents file from `%s' - not a package?",
pkg);
goto bomb;
@@ -258,7 +264,7 @@ pkg_do(const char *pkg)
goto success;
/* Finally unpack the whole mess */
- if (unpack(pkg, NULL, NULL)) {
+ if (unpack(pkg, NULL)) {
warnx("unable to extract `%s'!", pkg);
goto bomb;
}
@@ -276,6 +282,56 @@ pkg_do(const char *pkg)
}
}
+ /* Check OS, version and architecture */
+ if (read_buildinfo(buildinfo) != 0 && !Force) {
+ warnx("aborting.");
+ goto bomb;
+ }
+
+ if (uname(&host_uname) == 0) {
+ int osbad = 0;
+
+ /* handle Darwin's uname(3) on powerpc writing
+ * "Power Macintosh" in struct uname.machine.
+ */
+ if (strcmp(host_uname.machine, "Power Macintosh") == 0)
+ strcpy(host_uname.machine, "powerpc"); /* it fits */
+
+ /* If either the OS or arch are different, bomb */
+ if (strcmp(host_uname.sysname, buildinfo[BI_OPSYS]) != 0 ||
+ strcmp(host_uname.machine, buildinfo[BI_MACHINE_ARCH]) != 0)
+ osbad = 2;
+
+ /* If OS and arch are the same, warn if version differs */
+ if (strcmp(host_uname.sysname, buildinfo[BI_OPSYS]) == 0 &&
+ strcmp(host_uname.machine, buildinfo[BI_MACHINE_ARCH]) == 0) {
+ if (strcmp(host_uname.release, buildinfo[BI_OS_VERSION]) != 0)
+ osbad = 1;
+ } else
+ osbad = 2;
+
+ if (osbad) {
+ warnx("Package `%s' OS mismatch:", pkg);
+ warnx("%s/%s %s (pkg) vs. %s/%s %s (this host)",
+ buildinfo[BI_OPSYS],
+ buildinfo[BI_MACHINE_ARCH],
+ buildinfo[BI_OS_VERSION],
+ host_uname.sysname,
+ host_uname.machine,
+ host_uname.release);
+ }
+ if (!Force && (osbad >= 2)) {
+ warnx("aborting.");
+ goto bomb;
+ }
+ } else {
+ warnx("uname() failed.");
+ if (!Force) {
+ warnx("aborting.");
+ goto bomb;
+ }
+ }
+
/*
* If we have a prefix, delete the first one we see and add this
* one in place of it.
@@ -878,3 +934,53 @@ pkg_perform(lpkg_head_t *pkgs)
return err_cnt;
}
+
+/* Read package build information */
+static int
+read_buildinfo(char **buildinfo)
+{
+ char *key;
+ char *line;
+ size_t len;
+ FILE *fp;
+
+ fp = fopen(BUILD_INFO_FNAME, "r");
+ if (!fp) {
+ warnx("unable to open %s file.", BUILD_INFO_FNAME);
+ return 1;
+ }
+
+ while ((line = fgetln(fp, &len)) != NULL) {
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+
+ if ((key = strsep(&line, "=")) == NULL)
+ continue;
+
+ /*
+ * pkgsrc used to create the BUILDINFO file using
+ * "key= value", so skip the space if it's there.
+ */
+ if (line == NULL)
+ continue;
+ if (line[0] == ' ')
+ line += sizeof(char);
+
+ /* we only care about opsys, arch and version */
+ if (line[0] != '\0') {
+ if (strcmp(key, "OPSYS") == 0)
+ buildinfo[BI_OPSYS] = strdup(line);
+ else if (strcmp(key, "OS_VERSION") == 0)
+ buildinfo[BI_OS_VERSION] = strdup(line);
+ else if (strcmp(key, "MACHINE_ARCH") == 0)
+ buildinfo[BI_MACHINE_ARCH] = strdup(line);
+ }
+ }
+ if (buildinfo[BI_OPSYS] == NULL ||
+ buildinfo[BI_OS_VERSION] == NULL ||
+ buildinfo[BI_MACHINE_ARCH] == NULL) {
+ warnx("couldn't extract build information from package.");
+ return 1;
+ }
+ return 0;
+}
diff --git a/pkgtools/pkg_install/files/add/pkg_add.1 b/pkgtools/pkg_install/files/add/pkg_add.1
index 8d76d763a73..23d6470ff29 100644
--- a/pkgtools/pkg_install/files/add/pkg_add.1
+++ b/pkgtools/pkg_install/files/add/pkg_add.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.6 2003/10/29 23:00:28 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.7 2003/12/20 04:23:05 grant Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_add.1
.\"
-.Dd October 3, 2003
+.Dd December 20, 2003
.Dt PKG_ADD 1
.Os
.Sh NAME
@@ -112,6 +112,8 @@ Although
.Nm
will still try to find and auto-install missing prerequisite packages,
a failure to find one will not be fatal.
+This flag also overrides the fatal error when the operating system or
+architecture the package was built on differ from that of the host.
.It Fl I
If an installation script exists for a given package, do not execute it.
.It Fl K Ar pkg_dbdir
@@ -358,6 +360,16 @@ If
is enabled, the package is now extracted directly into its
final location, otherwise it is extracted into the staging area.
.It
+The package build information is extracted from the
+.Pa +BUILD_INFO
+file and compared against the result of
+.Xr uname 3 .
+If the operating system or architecture of the package differ from
+that of the host, installation is aborted.
+This behavior is overridable with the
+.Fl f
+flag.
+.It
If the package contains a
.Ar require
script (see
diff --git a/pkgtools/pkg_install/files/add/pkg_add.cat1 b/pkgtools/pkg_install/files/add/pkg_add.cat1
index 0ec9b688c58..b1663a19e22 100644
--- a/pkgtools/pkg_install/files/add/pkg_add.cat1
+++ b/pkgtools/pkg_install/files/add/pkg_add.cat1
@@ -48,7 +48,10 @@ OOPPTTIIOONNSS
--ff Force installation to proceed even if prerequisite packages are
not installed or the requirements script fails. Although ppkkgg__aadddd
will still try to find and auto-install missing prerequisite
- packages, a failure to find one will not be fatal.
+ packages, a failure to find one will not be fatal. This flag
+ also overrides the fatal error when the operating system or
+ architecture the package was built on differ from that of the
+ host.
--II If an installation script exists for a given package, do not exe-
cute it.
@@ -198,7 +201,13 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
extracted directly into its final location, otherwise it is
extracted into the staging area.
- 6. If the package contains a _r_e_q_u_i_r_e script (see pkg_create(1)),
+ 6. The package build information is extracted from the
+ _+_B_U_I_L_D___I_N_F_O file and compared against the result of uname(3).
+ If the operating system or architecture of the package differ
+ from that of the host, installation is aborted. This behavior
+ is overridable with the --ff flag.
+
+ 7. If the package contains a _r_e_q_u_i_r_e script (see pkg_create(1)),
it is executed with the following arguments:
_p_k_g_-_n_a_m_e The name of the package being installed
@@ -211,7 +220,7 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
If the _r_e_q_u_i_r_e script exits with a non-zero status code, the
installation is terminated.
- 7. If the package contains an _i_n_s_t_a_l_l script, it is executed with
+ 8. If the package contains an _i_n_s_t_a_l_l script, it is executed with
the following arguments:
_p_k_g_-_n_a_m_e The name of the package being installed.
@@ -223,19 +232,19 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
If the _i_n_s_t_a_l_l script exits with a non-zero status code, the
installation is terminated.
- 8. If @@ooppttiioonn eexxttrraacctt--iinn--ppllaaccee is not present in the packing
+ 9. If @@ooppttiioonn eexxttrraacctt--iinn--ppllaaccee is not present in the packing
list, then it is used as a guide for moving (or copying, as
necessary) files from the staging area into their final loca-
tions.
- 9. If the package contains an _m_t_r_e_e_f_i_l_e file (see pkg_create(1)),
+ 10. If the package contains an _m_t_r_e_e_f_i_l_e file (see pkg_create(1)),
then mtree is invoked as:
mmttrreeee --uu --ff _m_t_r_e_e_f_i_l_e --dd --ee --pp _p_r_e_f_i_x
where _p_r_e_f_i_x is either the prefix specified with the --pp flag
or, if no --pp flag was specified, the name of the first direc-
tory named by a @@ccwwdd directive within this package.
- 10. If an _i_n_s_t_a_l_l script exists for the package, it is executed
+ 11. If an _i_n_s_t_a_l_l script exists for the package, it is executed
with the following arguments:
_p_k_g___n_a_m_e The name of the package being installed.
@@ -244,7 +253,7 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
any actions needed after the package has been
installed.
- 11. After installation is complete, a copy of the packing list,
+ 12. After installation is complete, a copy of the packing list,
_d_e_i_n_s_t_a_l_l script, description, and display files are copied
into _/_v_a_r_/_d_b_/_p_k_g_/_<_p_k_g_-_n_a_m_e_> for subsequent possible use by
pkg_delete(1). Any package dependencies are recorded in the
@@ -252,12 +261,12 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
an alternate package database directory is specified, then it
overrides the _/_v_a_r_/_d_b_/_p_k_g path shown above).
- 12. If the package is a depoted package, then add it to the
+ 13. If the package is a depoted package, then add it to the
default view.
- 13. The staging area is deleted and the program terminates.
+ 14. The staging area is deleted and the program terminates.
- 14. Finally, if we were upgrading a package, any _+_R_E_Q_U_I_R_E_D___B_Y file
+ 15. Finally, if we were upgrading a package, any _+_R_E_Q_U_I_R_E_D___B_Y file
that was moved aside before upgrading was started is now moved
back into place.
@@ -339,4 +348,4 @@ BBUUGGSS
Sure to be others.
-NetBSD 1.6 October 3, 2003 NetBSD 1.6
+NetBSD 1.6 December 20, 2003 NetBSD 1.6
diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure
index 967fac9cf31..1b723d39538 100755
--- a/pkgtools/pkg_install/files/configure
+++ b/pkgtools/pkg_install/files/configure
@@ -3966,7 +3966,8 @@ done
-for ac_header in sys/ioctl.h sys/resource.h sys/wait.h
+
+for ac_header in sys/ioctl.h sys/resource.h sys/utsname.h sys/wait.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac
index aff7579d5ed..838d82e32f2 100644
--- a/pkgtools/pkg_install/files/configure.ac
+++ b/pkgtools/pkg_install/files/configure.ac
@@ -75,7 +75,7 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([db1/db.h db.h])
AC_CHECK_HEADERS([fnmatch.h md5.h regex.h])
-AC_CHECK_HEADERS([sys/ioctl.h sys/resource.h sys/wait.h])
+AC_CHECK_HEADERS([sys/ioctl.h sys/resource.h sys/utsname.h sys/wait.h])
# Checks for library functions.
AC_CHECK_FUNCS([chflags dbopen tgetent vfork])
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index 82a7ed80dfb..d298871bf09 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.13 2003/09/23 13:22:40 grant Exp $ */
+/* $NetBSD: perform.c,v 1.14 2003/12/20 04:23:05 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.13 2003/09/23 13:22:40 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.14 2003/12/20 04:23:05 grant Exp $");
#endif
#endif
@@ -124,7 +124,7 @@ pkg_do(char *pkg)
goto bail;
}
Home = make_playpen(PlayPen, PlayPenSize, sb.st_size / 2);
- if (unpack(fname, "+*", NULL)) {
+ if (unpack(fname, ALL_FNAMES)) {
warnx("error during unpacking, no info for '%s' available", pkg);
code = 1;
goto bail;
diff --git a/pkgtools/pkg_install/files/lib/config.h.in b/pkgtools/pkg_install/files/lib/config.h.in
index 373e2dabcc4..2d8dbec754c 100644
--- a/pkgtools/pkg_install/files/lib/config.h.in
+++ b/pkgtools/pkg_install/files/lib/config.h.in
@@ -60,6 +60,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
diff --git a/pkgtools/pkg_install/files/lib/file.c b/pkgtools/pkg_install/files/lib/file.c
index f21f45d99e6..74c46c44b0d 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.10 2003/12/08 13:50:50 grant Exp $ */
+/* $NetBSD: file.c,v 1.11 2003/12/20 04:23:05 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,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.10 2003/12/08 13:50:50 grant Exp $");
+__RCSID("$NetBSD: file.c,v 1.11 2003/12/20 04:23:05 grant Exp $");
#endif
#endif
@@ -580,107 +580,41 @@ remove_files(const char *path, const char *pattern)
* Unpack a tar file
*/
int
-unpack(const char *pkg, const char *extra1, const char *extra2)
+unpack(const char *pkg, const char *flist)
{
- const char *decompress_cmd[3];
+ char args[10] = "-";
+ char cmd[FILENAME_MAX];
+ const char *decompress_cmd;
const char *suf;
- int pipefds[2];
- pid_t tarpid, gzpid;
- int state;
- int ret;
if (!IS_STDIN(pkg)) {
suf = suffix_of(pkg);
- if (!strcmp(suf, "tbz") || !strcmp(suf, "bz2")) {
- decompress_cmd[0] = BZIP2_CMD;
- decompress_cmd[1] = "-c";
- decompress_cmd[2] = "-d";
- }
- else if (!strcmp(suf, "tgz") || !strcmp(suf, "gz")) {
- decompress_cmd[0] = GZIP_CMD;
- decompress_cmd[1] = "-c";
- decompress_cmd[2] = "-d";
- }
- else if (!strcmp(suf, "tar")) {
- decompress_cmd[0] = "cat";
- decompress_cmd[1] = NULL;
- decompress_cmd[2] = NULL;
- }
+ 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);
- } else {
- decompress_cmd[0] = GZIP_CMD;
- decompress_cmd[1] = "-c";
- decompress_cmd[2] = "-d";
- }
+ } else
+ decompress_cmd = GZIP_CMD;
- /* Set up a pipe for passing the extracted contents, and fork off a decompress process. */
- if (pipe(pipefds) == -1) {
- warnx("cannot create pipe -- %s extract of %s failed!", TAR_CMD, pkg);
- return 1;
- }
- if ((gzpid = fork()) == -1) {
- warnx("cannot fork process for %s -- %s extract of %s failed!",
- decompress_cmd[0], TAR_CMD, pkg);
- return 1;
- }
- if (gzpid == 0) { /* The child */
- if (dup2(pipefds[1], STDOUT_FILENO) == -1) {
- warnx("dup2 failed before executing %s command",
- decompress_cmd[0]);
- _exit(2);
- }
- close(pipefds[0]);
- close(pipefds[1]);
- if (decompress_cmd[1] != NULL)
- execlp(decompress_cmd[0], decompress_cmd[0],
- decompress_cmd[1], decompress_cmd[2],
- pkg, NULL);
- else
- execlp(decompress_cmd[0], decompress_cmd[0],
- pkg, NULL);
- warnx("failed to execute %s command", decompress_cmd[0]);
- _exit(2);
- }
+ strlcat(args, "xpf", sizeof(args));
+ sprintf(cmd, "%s %s %s %s %s %s %s", TAR_CMD,
+ flist ? "--fast-read" : "",
+ decompress_cmd != NULL ? "--use-compress-program" : "",
+ decompress_cmd != NULL ? decompress_cmd : "", args, pkg,
+ flist ? flist : "");
- /* Meanwhile, back in the parent process ... */
- /* fork off an untar process */
- if ((tarpid = fork()) == -1) {
- warnx("cannot fork process for %s -- %s extract of %s failed!",
- TAR_CMD, TAR_CMD, pkg);
+ if (Verbose)
+ printf("running: %s\n", cmd);
+ if (system(cmd) != 0) {
+ warnx("extract of %s failed", pkg);
return 1;
}
- if (tarpid == 0) { /* The child */
- if (dup2(pipefds[0], STDIN_FILENO) == -1) {
- warnx("dup2 failed before executing %s command",
- TAR_CMD);
- _exit(2);
- }
- close(pipefds[0]);
- close(pipefds[1]);
- execlp(TAR_CMD, TAR_CMD, "-xpf", "-", extra1, extra2, NULL);
- warnx("failed to execute %s command", TAR_CMD);
- _exit(2);
- }
-
-
- close(pipefds[0]);
- close(pipefds[1]);
- ret = 0;
- /* wait for decompress process ... */
- if (waitpid(gzpid, &state, 0) < 0) {
- /* error has been reported by child */
- ret = 1;
- }
-
- /* ... and for tar exit so we are sure the needed files exist */
- if (waitpid(tarpid, &state, 0) < 0) {
- /* error has been reported by child */
- ret = 1;
- }
-
- return ret;
+ return 0;
}
/*
diff --git a/pkgtools/pkg_install/files/lib/ftpio.c b/pkgtools/pkg_install/files/lib/ftpio.c
index f8544801eb6..da72c5489b4 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.7 2003/10/29 23:00:28 jlam Exp $ */
+/* $NetBSD: ftpio.c,v 1.8 2003/12/20 04:23:05 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.7 2003/10/29 23:00:28 jlam Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.8 2003/12/20 04:23:05 grant Exp $");
#endif
/*-
@@ -1102,7 +1102,7 @@ http_fetch(const char *url, const char *path)
if ((path != NULL) && (chdir(path) < 0))
_exit(127);
- if (unpack("-", Verbose ? "-vv" : NULL, NULL) != 0) {
+ if (unpack("-", NULL) != 0) {
warnx("unpack failed");
_exit(2);
}
@@ -1203,7 +1203,8 @@ unpackURL(const char *url, const char *dir)
#if 0
path_create(pkg_path); /* XXX */
#endif
- printf("setenv PKG_PATH='%s'\n",pkg_path);
+ if (Verbose)
+ printf("setenv PKG_PATH='%s'\n", pkg_path);
}
if (strncmp(url, "http://", 7) == 0)
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index 83f7ac6ccbc..f6bab96781f 100644
--- a/pkgtools/pkg_install/files/lib/lib.h
+++ b/pkgtools/pkg_install/files/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.6 2003/10/29 23:00:28 jlam Exp $ */
+/* $NetBSD: lib.h,v 1.7 2003/12/20 04:23:05 grant Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -141,6 +141,12 @@
#define VIEWS_FNAME "+VIEWS"
#define DEPOT_FNAME "+DEPOT"
+/*
+ * files which we expect to be in every package, passed to
+ * tar --fast-read.
+ */
+#define ALL_FNAMES CONTENTS_FNAME" "COMMENT_FNAME" "DESC_FNAME" "MTREE_FNAME" "BUILD_VERSION_FNAME" "BUILD_INFO_FNAME" "SIZE_PKG_FNAME" "SIZE_ALL_FNAME
+
#define CMD_CHAR '@' /* prefix for extended PLIST cmd */
/* The name of the "prefix" environment variable given to scripts */
@@ -179,6 +185,14 @@ typedef enum pl_ent_t {
PLIST_BLDDEP /* 18 */
} pl_ent_t;
+/* Enumerated constants for build info */
+typedef enum bi_ent_t {
+ BI_OPSYS, /* 0 */
+ BI_OS_VERSION, /* 1 */
+ BI_MACHINE_ARCH, /* 2 */
+ BI_ENUM_COUNT, /* 3 */
+} bi_ent_t;
+
/* Types */
typedef unsigned int Boolean;
@@ -276,7 +290,7 @@ void copy_file(char *, char *, char *);
void move_file(char *, char *, char *);
void remove_files(const char *, const char *);
int delete_hierarchy(char *, Boolean, Boolean);
-int unpack(const char *, const char *, const char *);
+int unpack(const char *, const char *);
void format_cmd(char *, size_t, char *, char *, char *);
/* ftpio.c: FTP handling */
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index c290aa9c876..3f64134570c 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.18 2003/12/08 13:50:50 grant Exp $ */
+/* $NetBSD: version.h,v 1.19 2003/12/20 04:23:05 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 "20031121"
+#define PKGTOOLS_VERSION "20031220"
#endif /* _INST_LIB_VERSION_H_ */