Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pkg_install/dist nstall-20100220:



details:   https://anonhg.NetBSD.org/src/rev/5d7bcdaf7860
branches:  trunk
changeset: 752226:5d7bcdaf7860
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Feb 20 04:41:52 2010 +0000

description:
nstall-20100220:
Try harder to give the user an idea which file failed.
Addresses PR 42223.

diffstat:

 external/bsd/pkg_install/dist/add/main.c          |   9 ++---
 external/bsd/pkg_install/dist/add/perform.c       |  16 ++++++---
 external/bsd/pkg_install/dist/add/pkg_add.1       |  26 +++++++---------
 external/bsd/pkg_install/dist/admin/main.c        |  11 ++++--
 external/bsd/pkg_install/dist/info/perform.c      |  10 +++---
 external/bsd/pkg_install/dist/lib/pkg_io.c        |  23 +++++++++-----
 external/bsd/pkg_install/dist/lib/pkg_signature.c |  35 ++++++++++++----------
 7 files changed, 72 insertions(+), 58 deletions(-)

diffs (truncated from 459 to 300 lines):

diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/add/main.c
--- a/external/bsd/pkg_install/dist/add/main.c  Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/add/main.c  Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.1.1.7 2010/01/30 21:33:08 joerg Exp $       */
+/*     $NetBSD: main.c,v 1.1.1.8 2010/02/20 04:41:52 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.1.1.7 2010/01/30 21:33:08 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.8 2010/02/20 04:41:52 joerg Exp $");
 
 /*
  *
@@ -123,12 +123,11 @@
 
                case 'U':
                        ReplaceSame = 1;
-                       if (!Replace)
-                               Replace = 1;
+                       Replace = 1;
                        break;
 
                case 'u':
-                       Replace++;
+                       Replace = 1;
                        break;
 
                case 'V':
diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c       Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c       Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.1.1.14 2010/02/03 14:23:39 joerg Exp $   */
+/*     $NetBSD: perform.c,v 1.1.1.15 2010/02/20 04:41:52 joerg Exp $   */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.14 2010/02/03 14:23:39 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.15 2010/02/20 04:41:52 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -729,8 +729,9 @@
 
                r = archive_write_header(writer, pkg->entry);
                if (r != ARCHIVE_OK) {
-                       warnx("Failed to write %s: %s",
+                       warnx("Failed to write %s for %s: %s",
                            archive_entry_pathname(pkg->entry),
+                           pkg->pkgname,
                            archive_error_string(writer));
                        goto out;
                }
@@ -760,7 +761,8 @@
                        continue;
                }
                if (r != ARCHIVE_OK) {
-                       warnx("Failed to read from archive: %s",
+                       warnx("Failed to read from archive for %s: %s",
+                           pkg->pkgname,
                            archive_error_string(pkg->archive));
                        goto out;
                }
@@ -1334,6 +1336,7 @@
 static int
 pkg_do(const char *pkgpath, int mark_automatic, int top_level)
 {
+       char *archive_name;
        int status, invalid_sig;
        struct pkg_task *pkg;
 
@@ -1341,14 +1344,15 @@
 
        status = -1;
 
-       pkg->archive = find_archive(pkgpath, top_level);
+       pkg->archive = find_archive(pkgpath, top_level, &archive_name);
        if (pkg->archive == NULL) {
                warnx("no pkg found for '%s', sorry.", pkgpath);
                goto clean_find_archive;
        }
 
-       invalid_sig = pkg_verify_signature(&pkg->archive, &pkg->entry,
+       invalid_sig = pkg_verify_signature(archive_name, &pkg->archive, &pkg->entry,
            &pkg->pkgname);
+       free(archive_name);
 
        if (pkg->archive == NULL)
                goto clean_memory;
diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/add/pkg_add.1
--- a/external/bsd/pkg_install/dist/add/pkg_add.1       Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/add/pkg_add.1       Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.1.1.9 2010/01/30 21:33:20 joerg Exp $
+.\" $NetBSD: pkg_add.1,v 1.1.1.10 2010/02/20 04:41:53 joerg Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -17,7 +17,7 @@
 .\"
 .\"     @(#)pkg_add.1
 .\"
-.Dd January 30, 2010
+.Dd February 18, 2010
 .Dt PKG_ADD 1
 .Os
 .Sh NAME
@@ -162,8 +162,8 @@
 .It Fl u
 If the package that's being installed is already installed,
 an update is performed.
-If this is specified twice, then any dependent packages that are
-too old will also be updated to fulfill the dependency.
+Installed dependent packages are updated recursively, if they are too
+old to fulfill the dependencies of the to-be-installed version.
 See below for a more detailed description of the process.
 .It Fl V
 Print version number and exit.
@@ -224,15 +224,21 @@
 If it is,
 installation is terminated if the
 .Fl u
-option is not given.
+or
+.Fl U
+options are not given.
 .Pp
+If the same version is installed and
+.Fl U
+is not given, it is marked as manually installed and process stops.
 If the
 .Fl u
 option is given, it's assumed the package should be replaced by the
 new version instead.
 Before doing so, all packages that depend on the
 pkg being upgraded are checked if they also work with the new version.
-If that test is successful, replacing is prepared by moving an existing
+If that test is not successful, the dependent packages are updated first.
+The replacing is then prepared by moving an existing
 .Pa +REQUIRED_BY
 file aside (if it exists), and running
 .Xr pkg_delete 1
@@ -282,14 +288,6 @@
 an attempt is made to find and install it;
 if the missing package cannot be found or installed,
 the installation is terminated.
-If the
-.Fl u
-option was specified twice, any required packages that are installed,
-but which have a version number that is considered to be too old,
-are also updated.
-The dependent packages are found according to the normal
-.Ev PKG_PATH
-rules.
 .It
 If the package contains an
 .Ar install
diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/admin/main.c
--- a/external/bsd/pkg_install/dist/admin/main.c        Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/admin/main.c        Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.1.1.13 2010/01/30 21:33:23 joerg Exp $      */
+/*     $NetBSD: main.c,v 1.1.1.14 2010/02/20 04:41:53 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.1.1.13 2010/01/30 21:33:23 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.14 2010/02/20 04:41:53 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -614,13 +614,16 @@
 
                rc = 0;
                for (--argc, ++argv; argc > 0; --argc, ++argv) {
-                       pkg = open_archive(*argv);
+                       char *archive_name;
+
+                       pkg = open_archive(*argv, &archive_name);
                        if (pkg == NULL) {
                                warnx("%s could not be opened", *argv);
                                continue;
                        }
-                       if (pkg_full_signature_check(&pkg))
+                       if (pkg_full_signature_check(archive_name, &pkg))
                                rc = 1;
+                       free(archive_name);
                        if (!pkg)
                                archive_read_finish(pkg);
                }
diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/info/perform.c
--- a/external/bsd/pkg_install/dist/info/perform.c      Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/info/perform.c      Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.1.1.12 2010/01/30 21:33:40 joerg Exp $   */
+/*     $NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $   */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -13,7 +13,7 @@
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.12 2010/01/30 21:33:40 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -346,16 +346,16 @@
 #else
                struct archive *archive;
                struct archive_entry *entry;
-               char *pkgname;
+               char *archive_name, *pkgname;
 
-               archive = open_archive(pkg);
+               archive = open_archive(pkg, &archive_name);
                if (archive == NULL) {
                        warnx("can't find package `%s', skipped", pkg);
                        return -1;
                }
                pkgname = NULL;
                entry = NULL;
-               pkg_verify_signature(&archive, &entry, &pkgname);
+               pkg_verify_signature(archive_name, &archive, &entry, &pkgname);
                if (archive == NULL)
                        return -1;
                free(pkgname);
diff -r b95825e5cac9 -r 5d7bcdaf7860 external/bsd/pkg_install/dist/lib/pkg_io.c
--- a/external/bsd/pkg_install/dist/lib/pkg_io.c        Sat Feb 20 04:33:34 2010 +0000
+++ b/external/bsd/pkg_install/dist/lib/pkg_io.c        Sat Feb 20 04:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkg_io.c,v 1.1.1.7 2009/08/21 15:19:19 joerg Exp $     */
+/*     $NetBSD: pkg_io.c,v 1.1.1.8 2010/02/20 04:41:57 joerg Exp $     */
 /*-
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 #endif
 
-__RCSID("$NetBSD: pkg_io.c,v 1.1.1.7 2009/08/21 15:19:19 joerg Exp $");
+__RCSID("$NetBSD: pkg_io.c,v 1.1.1.8 2010/02/20 04:41:57 joerg Exp $");
 
 #include <archive.h>
 #include <archive_entry.h>
@@ -98,7 +98,7 @@
 }
 
 static struct archive *
-open_archive_by_url(struct url *url)
+open_archive_by_url(struct url *url, char **archive_name)
 {
        struct fetch_archive *f;
        struct archive *a;
@@ -106,11 +106,15 @@
        f = xmalloc(sizeof(*f));
        f->url = url;
 
+       *archive_name = fetchStringifyURL(url);
+
        a = archive_read_new();
        archive_read_support_compression_all(a);
        archive_read_support_format_all(a);
        if (archive_read_open(a, f, fetch_archive_open, fetch_archive_read,
            fetch_archive_close)) {
+               free(*archive_name);
+               *archive_name = NULL;
                archive_read_finish(a);
                return NULL;
        }
@@ -119,11 +123,13 @@
 }
 
 struct archive *
-open_archive(const char *url)
+open_archive(const char *url, char **archive_name)
 {
        struct url *u;
        struct archive *a;
 
+       *archive_name = NULL;
+
        if (!IS_URL(url)) {
                a = archive_read_new();
                archive_read_support_compression_all(a);
@@ -132,13 +138,14 @@



Home | Main Index | Thread Index | Old Index