pkgsrc-Changes-HG archive

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

[pkgsrc/pkg_install-renovation]: pkgsrc/pkgtools/pkg_install/files pkg_instal...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3bfc2acd59c4
branches:  pkg_install-renovation
changeset: 541596:3bfc2acd59c4
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Thu Aug 21 16:04:39 2008 +0000

description:
pkg_install-20080821:
- Recognize file:// urls to prevent double quoting.
- Fix some err/errx botchups.
- Add configuration options for verbose logging of net IO, enabling of
active FTP (switching to passive FTP as default) and for ignoring proxy
settings.
- When iterating over PACKAGES to find a match, warn if an entry can't
processed (e.g. bad URL).

diffstat:

 pkgtools/pkg_install/files/admin/audit.c             |  15 +++++++++------
 pkgtools/pkg_install/files/lib/file.c                |   5 +++--
 pkgtools/pkg_install/files/lib/lib.h                 |   3 ++-
 pkgtools/pkg_install/files/lib/parse-config.c        |  18 +++++++++++++++---
 pkgtools/pkg_install/files/lib/pkg_install.conf.5    |  13 +++++++++++--
 pkgtools/pkg_install/files/lib/pkg_install.conf.cat5 |  11 ++++++++++-
 pkgtools/pkg_install/files/lib/pkg_io.c              |  13 +++++++++----
 pkgtools/pkg_install/files/lib/version.h             |   4 ++--
 8 files changed, 61 insertions(+), 21 deletions(-)

diffs (291 lines):

diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/admin/audit.c
--- a/pkgtools/pkg_install/files/admin/audit.c  Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/admin/audit.c  Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audit.c,v 1.8.2.3 2008/08/02 20:33:50 joerg Exp $      */
+/*     $NetBSD: audit.c,v 1.8.2.4 2008/08/21 16:04:39 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: audit.c,v 1.8.2.3 2008/08/02 20:33:50 joerg Exp $");
+__RCSID("$NetBSD: audit.c,v 1.8.2.4 2008/08/21 16:04:39 joerg Exp $");
 #endif
 
 /*-
@@ -355,18 +355,21 @@
        if (verbose >= 2)
                fprintf(stderr, "Fetching %s\n", pkg_vulnerabilities_url);
 
-       f = fetchXGetURL(pkg_vulnerabilities_url, &st, "");
+       f = fetchXGetURL(pkg_vulnerabilities_url, &st, fetch_flags);
        if (f == NULL)
-               err(EXIT_FAILURE, "Could not fetch vulnerability file");
+               errx(EXIT_FAILURE, "Could not fetch vulnerability file: %s",
+                   fetchLastErrString);
 
        if (st.size > SSIZE_MAX - 1)
-               err(EXIT_FAILURE, "pkg-vulnerabilities is too large");
+               errx(EXIT_FAILURE, "pkg-vulnerabilities is too large");
 
        buf_len = st.size;
        buf = xmalloc(buf_len + 1);
 
        if (fetchIO_read(f, buf, buf_len) != buf_len)
-               err(EXIT_FAILURE, "Failure during fetch of pkg-vulnerabilities");
+               errx(EXIT_FAILURE,
+                   "Failure during fetch of pkg-vulnerabilities: %s",
+                   fetchLastErrString);
        buf[buf_len] = '\0';
 
        if (decompress_buffer(buf, buf_len, &decompressed_input,
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/file.c
--- a/pkgtools/pkg_install/files/lib/file.c     Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/file.c     Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.23.8.1 2008/04/26 17:44:23 joerg Exp $      */
+/*     $NetBSD: file.c,v 1.23.8.2 2008/08/21 16:04:39 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -17,7 +17,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.23.8.1 2008/04/26 17:44:23 joerg Exp $");
+__RCSID("$NetBSD: file.c,v 1.23.8.2 2008/08/21 16:04:39 joerg Exp $");
 #endif
 #endif
 
@@ -190,6 +190,7 @@
 
 /* A table of valid leading strings for URLs */
 static const url_t urls[] = {
+       {"file://", 7},
        {"ftp://";, 6},
        {"http://";, 7},
        {NULL}
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h      Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h      Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.42.2.14 2008/08/11 15:58:15 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.42.2.15 2008/08/21 16:04:39 joerg Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -407,6 +407,7 @@
 extern const char *config_file;
 extern const char *verified_installation;
 extern const char *gpg_cmd;
+extern char fetch_flags[];
 
 extern const char *pkg_vulnerabilities_dir;
 extern const char *pkg_vulnerabilities_file;
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/parse-config.c
--- a/pkgtools/pkg_install/files/lib/parse-config.c     Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/parse-config.c     Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse-config.c,v 1.1.2.4 2008/08/02 20:33:50 joerg Exp $       */
+/*     $NetBSD: parse-config.c,v 1.1.2.5 2008/08/21 16:04:39 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: parse-config.c,v 1.1.2.4 2008/08/02 20:33:50 joerg Exp $");
+__RCSID("$NetBSD: parse-config.c,v 1.1.2.5 2008/08/21 16:04:39 joerg Exp $");
 #endif
 
 /*-
@@ -51,6 +51,10 @@
 
 const char     *config_file = SYSCONFDIR"/pkg_install.conf";
 
+char fetch_flags[10];
+static const char *active_ftp;
+static const char *verbose_netio;
+static const char *ignore_proxy;
 const char *cert_chain_file;
 const char *certs_packages;
 const char *certs_pkg_vulnerabilities;
@@ -67,13 +71,16 @@
        const char *name;
        const char **var;
 } config_variables[] = {
+       { "ACTIVE_FTP", &active_ftp },
        { "CERTIFICATE_ANCHOR_PKGS", &certs_packages },
        { "CERTIFICATE_ANCHOR_PKGVULN", &certs_pkg_vulnerabilities },
        { "CERTIFICATE_CHAIN", &cert_chain_file },
        { "GPG", &gpg_cmd },
+       { "IGNORE_PROXY", &ignore_proxy },
+       { "IGNORE_URL", &ignore_advisories },
        { "PKGVULNDIR", &pkg_vulnerabilities_dir },
        { "PKGVULNURL", &pkg_vulnerabilities_url },
-       { "IGNORE_URL", &ignore_advisories },
+       { "VERBOSE_NETIO", &verbose_netio },
        { "VERIFIED_INSTALLATION", &verified_installation },
        { NULL, NULL }
 };
@@ -100,6 +107,11 @@
        }
        if (verified_installation == NULL)
                verified_installation = "never";
+
+       snprintf(fetch_flags, sizeof(fetch_flags), "%s%s%s",
+           (verbose_netio && *verbose_netio) ? "v" : "",
+           (active_ftp && *active_ftp) ? "" : "p",
+           (ignore_proxy && *ignore_proxy) ? "d" : "");
 }
 
 void
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/pkg_install.conf.5
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.5 Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/pkg_install.conf.5 Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_install.conf.5,v 1.1.2.1 2008/05/26 15:29:03 joerg Exp $
+.\"    $NetBSD: pkg_install.conf.5,v 1.1.2.2 2008/08/21 16:04:39 joerg Exp $
 .\"
 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 26, 2008
+.Dd August 21, 2008
 .Dt PKG_INSTALL.CONF 5
 .Os
 .Sh NAME
@@ -48,6 +48,8 @@
 .Pp
 The following variables are supported:
 .Bl -tag -width indent
+.It Dv ACTIVE_FTP
+Force the use of active FTP.
 .It Dv CERTIFICATE_ANCHOR_PKGS
 Path to the file containing the certificates used for validating
 binary packages.
@@ -75,6 +77,11 @@
 .Dl Ic pkg_admin check-pkg-vulnerabilities -s
 or
 .Dl Ic pkg_admin fetch-pkg-vulnerabilities -s
+.It Dv IGNORE_PROXY
+Use direct connections and ignore
+.Pa FTP_PROXY
+and 
+.Pa HTTP_PROXY .
 .It Dv IGNORE_URL
 One line per advisory which should be ignored when running
 .Dl Ic pkg_admin audit
@@ -102,6 +109,8 @@
 or
 .Xr gzip 1
 .Pq Pa .gz .
+.It Dv VERBOSE_NETIO
+Log details of network IO to stderr.
 .It Dv VERIFIED_INSTALLATION
 Set trust level used when installation.
 Supported values are:
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/pkg_install.conf.cat5
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5      Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5      Thu Aug 21 16:04:39 2008 +0000
@@ -14,6 +14,9 @@
 
      The following variables are supported:
 
+     ACTIVE_FTP
+             Force the use of active FTP.
+
      CERTIFICATE_ANCHOR_PKGS
              Path to the file containing the certificates used for validating
              binary packages.  A package is trusted when a certificate chain
@@ -36,6 +39,9 @@
              or
                    ppkkgg__aaddmmiinn ffeettcchh--ppkkgg--vvuullnneerraabbiilliittiieess --ss
 
+     IGNORE_PROXY
+             Use direct connections and ignore _F_T_P___P_R_O_X_Y and _H_T_T_P___P_R_O_X_Y.
+
      IGNORE_URL
              One line per advisory which should be ignored when running
                    ppkkgg__aaddmmiinn aauuddiitt
@@ -56,6 +62,9 @@
              rently supported are uncompressed files and files compressed by
              bzip2(1) (_._b_z_2) or gzip(1) (_._g_z).
 
+     VERBOSE_NETIO
+             Log details of network IO to stderr.
+
      VERIFIED_INSTALLATION
              Set trust level used when installation.  Supported values are:
 
@@ -79,4 +88,4 @@
 SSEEEE AALLSSOO
      pkg_add(1), pkg_admin(1)
 
-NetBSD 4.0                       May 26, 2008                       NetBSD 4.0
+NetBSD 4.0                      August 21, 2008                     NetBSD 4.0
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/pkg_io.c
--- a/pkgtools/pkg_install/files/lib/pkg_io.c   Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/pkg_io.c   Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkg_io.c,v 1.1.2.3 2008/08/02 20:33:50 joerg Exp $     */
+/*     $NetBSD: pkg_io.c,v 1.1.2.4 2008/08/21 16:04:39 joerg Exp $     */
 /*-
  * Copyright (c) 2008 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.2.3 2008/08/02 20:33:50 joerg Exp $");
+__RCSID("$NetBSD: pkg_io.c,v 1.1.2.4 2008/08/21 16:04:39 joerg Exp $");
 
 #include <archive.h>
 #include <archive_entry.h>
@@ -62,7 +62,7 @@
 {
        struct fetch_archive *f = client_data;
 
-       f->fetch = fetchGet(f->url, "");
+       f->fetch = fetchGet(f->url, fetch_flags);
        if (f->fetch == NULL)
                return ENOENT;
        return 0;
@@ -186,7 +186,12 @@
        url_pattern = xasprintf("%*.*s*", (int)i, (int)i, pattern);
 
        fetchInitURLList(&ue);
-       if (fetchList(&ue, url, url_pattern, "")) {
+       if (fetchList(&ue, url, url_pattern, fetch_flags)) {
+               char *base_url;
+               base_url = fetchStringifyURL(url);
+               warnx("Can't process %s%s: %s", base_url, url_pattern,
+                   fetchLastErrString);
+               free(base_url);
                free(url_pattern);
                fetchFreeURLList(&ue);
                return -1;
diff -r 6e68567537f7 -r 3bfc2acd59c4 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Mon Aug 11 15:58:15 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Thu Aug 21 16:04:39 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.102.2.13 2008/08/05 22:56:24 joerg Exp $ */
+/*     $NetBSD: version.h,v 1.102.2.14 2008/08/21 16:04:39 joerg Exp $ */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20080806"
+#define PKGTOOLS_VERSION "20080821"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index