summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg>2008-08-21 16:04:39 +0000
committerjoerg <joerg>2008-08-21 16:04:39 +0000
commitdd70e4a798474beb1fd3d515ec8afe616e561230 (patch)
treef20735a92d70b7748acff18a798c4c1fc54f0e6d
parent01804cf20a0d6597bc74ea1fe8318ddc68ecd1cb (diff)
downloadpkgsrc-dd70e4a798474beb1fd3d515ec8afe616e561230.tar.gz
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).
-rw-r--r--pkgtools/pkg_install/files/admin/audit.c15
-rw-r--r--pkgtools/pkg_install/files/lib/file.c5
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h3
-rw-r--r--pkgtools/pkg_install/files/lib/parse-config.c18
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_install.conf.513
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_install.conf.cat511
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_io.c13
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
8 files changed, 61 insertions, 21 deletions
diff --git a/pkgtools/pkg_install/files/admin/audit.c b/pkgtools/pkg_install/files/admin/audit.c
index 2243686689f..484f19d9896 100644
--- a/pkgtools/pkg_install/files/admin/audit.c
+++ b/pkgtools/pkg_install/files/admin/audit.c
@@ -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 @@ fetch_pkg_vulnerabilities(int argc, char **argv)
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 --git a/pkgtools/pkg_install/files/lib/file.c b/pkgtools/pkg_install/files/lib/file.c
index 225eebf0863..2eff592be45 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.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 @@ typedef struct url_t {
/* A table of valid leading strings for URLs */
static const url_t urls[] = {
+ {"file://", 7},
{"ftp://", 6},
{"http://", 7},
{NULL}
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index eca555493df..9f37837d12c 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.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 *certs_pkg_vulnerabilities;
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 --git a/pkgtools/pkg_install/files/lib/parse-config.c b/pkgtools/pkg_install/files/lib/parse-config.c
index 6b4aef72bea..e35271a36cf 100644
--- a/pkgtools/pkg_install/files/lib/parse-config.c
+++ b/pkgtools/pkg_install/files/lib/parse-config.c
@@ -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 @@ __RCSID("$NetBSD: parse-config.c,v 1.1.2.4 2008/08/02 20:33:50 joerg Exp $");
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 @@ static struct config_variable {
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 @@ pkg_install_config(void)
}
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 --git a/pkgtools/pkg_install/files/lib/pkg_install.conf.5 b/pkgtools/pkg_install/files/lib/pkg_install.conf.5
index 39d75a746a2..2503c6d15c1 100644
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.5
+++ b/pkgtools/pkg_install/files/lib/pkg_install.conf.5
@@ -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 @@ The current value of a variable can be checked by running
.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 @@ file when running
.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 @@ Currently supported are uncompressed files and files compressed by
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 --git a/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5 b/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5
index c2f87e957aa..f59bc88ced1 100644
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5
+++ b/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5
@@ -14,6 +14,9 @@ DDEESSCCRRIIPPTTIIOONN
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 @@ DDEESSCCRRIIPPTTIIOONN
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 @@ DDEESSCCRRIIPPTTIIOONN
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 @@ FFIILLEESS
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 --git a/pkgtools/pkg_install/files/lib/pkg_io.c b/pkgtools/pkg_install/files/lib/pkg_io.c
index 2b0c13be733..ebec1c4c854 100644
--- a/pkgtools/pkg_install/files/lib/pkg_io.c
+++ b/pkgtools/pkg_install/files/lib/pkg_io.c
@@ -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>.
* 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 @@ fetch_archive_open(struct archive *a, void *client_data)
{
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 @@ find_best_package(struct url *url, const char *pattern, struct url **best_url)
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 --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 57b12159a20..ad95af7052c 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.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_ */