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 sync with NetBSD-current af...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7072bff79d2c
branches:  trunk
changeset: 461897:7072bff79d2c
user:      grant <grant%pkgsrc.org@localhost>
date:      Tue Sep 23 13:22:37 2003 +0000

description:
sync with NetBSD-current after updates from wiz.

diffstat:

 pkgtools/pkg_install/files/add/extract.c    |    6 +-
 pkgtools/pkg_install/files/add/futil.c      |   16 ++-
 pkgtools/pkg_install/files/add/perform.c    |   85 +++++++-----------
 pkgtools/pkg_install/files/add/verify.c     |    6 +-
 pkgtools/pkg_install/files/delete/perform.c |   43 ++++----
 pkgtools/pkg_install/files/info/perform.c   |    8 +-
 pkgtools/pkg_install/files/lib/exec.c       |    5 +-
 pkgtools/pkg_install/files/lib/fexec.c      |   26 ++++-
 pkgtools/pkg_install/files/lib/file.c       |  129 +++++++++++++++++++++------
 pkgtools/pkg_install/files/lib/ftpio.c      |   17 +-
 pkgtools/pkg_install/files/lib/lib.h        |    5 +-
 pkgtools/pkg_install/files/lib/plist.c      |   10 +-
 12 files changed, 216 insertions(+), 140 deletions(-)

diffs (truncated from 807 to 300 lines):

diff -r 2d574d417281 -r 7072bff79d2c pkgtools/pkg_install/files/add/extract.c
--- a/pkgtools/pkg_install/files/add/extract.c  Tue Sep 23 13:15:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/extract.c  Tue Sep 23 13:22:37 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extract.c,v 1.6 2003/09/02 08:28:22 jlam Exp $ */
+/*     $NetBSD: extract.c,v 1.7 2003/09/23 13:22:37 grant Exp $        */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
 #else
-__RCSID("$NetBSD: extract.c,v 1.6 2003/09/02 08:28:22 jlam Exp $");
+__RCSID("$NetBSD: extract.c,v 1.7 2003/09/23 13:22:37 grant Exp $");
 #endif
 #endif
 
@@ -195,6 +195,8 @@
                                                                    "unable to back up %s to %s, aborting pkg_add",
                                                                    try, pf);
                                                                rollback(PkgName, home, pkg->head, p);
+                                                               free(perm_args);
+                                                               free(where_args);
                                                                return 0;
                                                        }
                                                }
diff -r 2d574d417281 -r 7072bff79d2c pkgtools/pkg_install/files/add/futil.c
--- a/pkgtools/pkg_install/files/add/futil.c    Tue Sep 23 13:15:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/futil.c    Tue Sep 23 13:22:37 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: futil.c,v 1.4 2003/09/23 07:13:46 grant Exp $  */
+/*     $NetBSD: futil.c,v 1.5 2003/09/23 13:22:38 grant Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: futil.c,v 1.7 1997/10/08 07:45:39 charnier Exp";
 #else
-__RCSID("$NetBSD: futil.c,v 1.4 2003/09/23 07:13:46 grant Exp $");
+__RCSID("$NetBSD: futil.c,v 1.5 2003/09/23 13:22:38 grant Exp $");
 #endif
 #endif
 
@@ -81,6 +81,7 @@
 apply_perms(char *dir, char *arg)
 {
        char   *cd_to;
+       char    owner_group[128];
 
        if (!dir || *arg == '/')/* absolute path? */
                cd_to = "/";
@@ -92,9 +93,14 @@
                        warnx("couldn't change modes of '%s' to '%s'", arg,
                            Mode);
        if (Owner != NULL && Group != NULL) {
-               if (vsystem("cd %s && %s -R %s.%s %s", cd_to, CHOWN_CMD, Owner,
-                   Group, arg))
-                       warnx("couldn't change owner/group of '%s' to '%s.%s'",
+               if (snprintf(owner_group, sizeof(owner_group),
+                            "%s:%s", Owner, Group) > sizeof(owner_group)) {
+                       warnx("'%s:%s' is too long (%d max)",
+                             Owner, Group, sizeof(owner_group));
+                       return;
+               }
+               if (fcexec(cd_to, CHOWN_CMD, "-R", owner_group, arg))
+                       warnx("couldn't change owner/group of '%s' to '%s:%s'",
                            arg, Owner, Group);
                return;
        }
diff -r 2d574d417281 -r 7072bff79d2c pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Tue Sep 23 13:15:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Tue Sep 23 13:22:37 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.11 2003/09/23 07:13:46 grant Exp $       */
+/*     $NetBSD: perform.c,v 1.12 2003/09/23 13:22:38 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.11 2003/09/23 07:13:46 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.12 2003/09/23 13:22:38 grant Exp $");
 #endif
 #endif
 
@@ -80,26 +80,21 @@
 static int
 installprereq(const char *name, int *errc)
 {
-       int     ret;
+       int ret;
        ret = 0;
 
        if (Verbose)
                printf("Loading it from %s.\n", name);
        path_setenv("PKG_PATH");
-       if (vsystem("%s/pkg_add -K %s -s %s %s%s%s %s%s %s%s%s %s%s",
-                       BINDIR,
-                       _pkgdb_getPKGDB_DIR(),
-                       get_verification(),
-                       NoView ? "-L " : "",
-                       View ? "-w " : "",
-                       View ? View : "",
-                       Viewbase ? "-W " : "",
-                       Viewbase ? Viewbase : "",
-                       Force ? "-f " : "",
-                       Prefix ? "-p " : "",
-                       Prefix ? Prefix : "",
-                       Verbose ? "-v " : "",
-                       name)) {
+
+       if (fexec_skipempty(BINDIR "/pkg_add", "-K", _pkgdb_getPKGDB_DIR(),
+                           "-s", get_verification(),
+                           NoView ? "-L" : "",
+                           View ? "-w" : "", View ? View : "",
+                           Viewbase ? "-W" : "", Viewbase ? Viewbase : "",
+                           Force ? "-f" : "",
+                           Prefix ? "-p" : "", Prefix ? Prefix : "",
+                           Verbose ? "-v" : "", name, NULL)) {
                warnx("autoload of dependency `%s' failed%s",
                        name, Force ? " (proceeding anyway)" : "!");
                if (!Force)
@@ -119,14 +114,13 @@
 pkg_do(const char *pkg)
 {
        char    playpen[FILENAME_MAX];
-       char    extract_contents[FILENAME_MAX];
        char    replace_from[FILENAME_MAX];
        char    replace_via[FILENAME_MAX];
        char    replace_to[FILENAME_MAX];
        int     replacing = 0;
-       char   *where_to, *extract;
+       char   *where_to;
        char   dbdir[FILENAME_MAX];
-       const char *exact;
+       const char *exact, *extra1, *extra2;
        FILE   *cfile;
        int     errc;
        plist_t *p;
@@ -191,11 +185,11 @@
                                                goto bomb;
                                        }
                                }
-                               (void) snprintf(extract_contents, sizeof(extract_contents), "--fast-read %s", CONTENTS_FNAME);
-                               extract = extract_contents;
+                               extra1 = "--fast-read";
+                               extra2 = CONTENTS_FNAME;
                        } else {
                                /* some values for stdin */
-                               extract = NULL;
+                               extra1 = extra2 = NULL;
                                sb.st_size = 100000;    /* Make up a plausible average size */
                        }
                        Home = make_playpen(playpen, sizeof(playpen), sb.st_size * 4);
@@ -203,7 +197,7 @@
                                warnx("unable to make playpen for %ld bytes",
                                      (long) (sb.st_size * 4));
                        where_to = Home;
-                       if (unpack(pkg, extract)) {
+                       if (unpack(pkg, extra1, extra2)) {
                                warnx("unable to extract table of contents file from `%s' - not a package?",
                                      pkg);
                                goto bomb;
@@ -264,7 +258,7 @@
                                goto success;
 
                        /* Finally unpack the whole mess */
-                       if (unpack(pkg, NULL)) {
+                       if (unpack(pkg, NULL, NULL)) {
                                warnx("unable to extract `%s'!", pkg);
                                goto bomb;
                        }
@@ -465,11 +459,7 @@
                                                        dbdir,
                                                        installed);
                                        }
-                                       vsystem("%s/pkg_delete -K %s '%s'\n",
-                                               BINDIR,
-                                               dbdir,
-                                               installed);
-
+                                       fexec(BINDIR "/pkg_delete", "-K", dbdir, installed, NULL);
                                } else {
                                        warnx("other version '%s' already installed", installed);
 
@@ -612,7 +602,7 @@
                (void) fexec(CHMOD_CMD, "+x", REQUIRE_FNAME, NULL);     /* be sure */
                if (Verbose)
                        printf("Running requirements file first for %s.\n", PkgName);
-               if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, PkgName)) {
+               if (!Fake && fexec("./" REQUIRE_FNAME, PkgName, "INSTALL", NULL)) {
                        warnx("package %s fails requirements %s", pkg,
                            Force ? "installing anyway" : "- not installed");
                        if (!Force) {
@@ -627,7 +617,7 @@
                (void) fexec(CHMOD_CMD, "+x", INSTALL_FNAME, NULL);     /* make sure */
                if (Verbose)
                        printf("Running install with PRE-INSTALL for %s.\n", PkgName);
-               if (!Fake && vsystem("./%s %s PRE-INSTALL", INSTALL_FNAME, PkgName)) {
+               if (!Fake && fexec("./" INSTALL_FNAME, PkgName, "PRE-INSTALL", NULL)) {
                        warnx("install script returned error status");
                        errc = 1;
                        goto success;   /* nothing to uninstall yet */
@@ -654,7 +644,8 @@
                if (Verbose)
                        printf("mtree -U -f %s -d -e -p %s\n", MTREE_FNAME, p ? p->name : "/");
                if (!Fake) {
-                       if (vsystem("%s -U -f %s -d -e -p %s", MTREE_CMD, MTREE_FNAME, p ? p->name : "/"))
+                       if (fexec(MTREE_CMD, "-U", "-f", MTREE_FNAME, "-d", "-e", "-p",
+                                 p ? p->name : "/", NULL))
                                warnx("mtree returned a non-zero status - continuing");
                }
                unlink(MTREE_FNAME); /* remove this line to tar up pkg later  - HF */
@@ -664,7 +655,7 @@
        if (!NoInstall && fexists(INSTALL_FNAME)) {
                if (Verbose)
                        printf("Running install with POST-INSTALL for %s.\n", PkgName);
-               if (!Fake && vsystem("./%s %s POST-INSTALL", INSTALL_FNAME, PkgName)) {
+               if (!Fake && fexec("./" INSTALL_FNAME, PkgName, "POST-INSTALL", NULL)) {
                        warnx("install script returned error status");
                        errc = 1;
                        goto fail;
@@ -792,24 +783,16 @@
        if (!Fake && !NoView && is_depoted_pkg) {
                if (Verbose) {
                        printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
-                               BINDIR,
-                               dbdir,
-                               View ? "-w " : "",
-                               View ? View : "",
-                               Viewbase ? "-W " : "",
-                               Viewbase ? Viewbase : "",
-                               Verbose ? "-v " : "",
-                               PkgName);
+                               BINDIR, dbdir,
+                               View ? "-w " : "", View ? View : "",
+                               Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
+                               Verbose ? "-v " : "", PkgName);
                }
-               vsystem("%s/pkg_view -d %s %s%s %s%s %sadd %s",
-                               BINDIR,
-                               dbdir,
-                               View ? "-w " : "",
-                               View ? View : "",
-                               Viewbase ? "-W " : "",
-                               Viewbase ? Viewbase : "",
-                               Verbose ? "-v " : "",
-                               PkgName);
+
+               fexec_skipempty(BINDIR "/pkg_view", "-d", dbdir,
+                               View ? "-w " : "", View ? View : "",
+                               Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
+                               Verbose ? "-v " : "", "add", PkgName, NULL);
        }
 
        goto success;
diff -r 2d574d417281 -r 7072bff79d2c pkgtools/pkg_install/files/add/verify.c
--- a/pkgtools/pkg_install/files/add/verify.c   Tue Sep 23 13:15:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/verify.c   Tue Sep 23 13:22:37 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verify.c,v 1.4 2003/09/23 07:13:47 grant Exp $ */
+/* $NetBSD: verify.c,v 1.5 2003/09/23 13:22:38 grant Exp $ */
 
 /*
  * Copyright (c) 2001 Alistair G. Crooks.  All rights reserved.
@@ -41,7 +41,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: verify.c,v 1.4 2003/09/23 07:13:47 grant Exp $");
+__RCSID("$NetBSD: verify.c,v 1.5 2003/09/23 13:22:38 grant Exp $");
 #endif
 
 #if HAVE_SYS_TYPES_H
@@ -100,7 +100,7 @@
                (void) snprintf(f, sizeof(f), "%s%s", pkgname, *ep);
                if (stat(f, &st) == 0) {
                        (void) fprintf(stderr, "pkg_add: Using signature file: %s\n", f);
-                       if (vsystem(cmd, f) != 0) {
+                       if (fexec(cmd, f, NULL) != 0) {
                                (void) fprintf(stderr, "*** WARNING ***: `%s' has a bad signature\n", f);
                                return 0;
                        }
diff -r 2d574d417281 -r 7072bff79d2c pkgtools/pkg_install/files/delete/perform.c
--- a/pkgtools/pkg_install/files/delete/perform.c       Tue Sep 23 13:15:17 2003 +0000
+++ b/pkgtools/pkg_install/files/delete/perform.c       Tue Sep 23 13:22:37 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.8 2003/09/23 07:13:50 grant Exp $        */
+/*     $NetBSD: perform.c,v 1.9 2003/09/23 13:22:39 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.15 1997/10/13 15:03:52 jkh Exp";
 #else



Home | Main Index | Thread Index | Old Index