summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2009-10-21 17:10:36 +0000
committerjoerg <joerg@pkgsrc.org>2009-10-21 17:10:36 +0000
commit6f43c89cc7a08934f3024b0fc81d80619c4821b5 (patch)
treef6d9b1a5092b226ed43bcc3ef75603769d3c3504 /pkgtools/pkg_install
parent306d58fc2721e66ec1fff432a9da4ce6dc1b30c3 (diff)
downloadpkgsrc-6f43c89cc7a08934f3024b0fc81d80619c4821b5.tar.gz
pkg_install-20091021:
Add support to query arbitrary variables with pkg_admin config-var.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/admin/main.c11
-rw-r--r--pkgtools/pkg_install/files/lib/parse-config.c21
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
3 files changed, 25 insertions, 11 deletions
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index cfa475992ca..8e4e8b793c0 100644
--- a/pkgtools/pkg_install/files/admin/main.c
+++ b/pkgtools/pkg_install/files/admin/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.57 2009/10/08 16:16:12 joerg Exp $ */
+/* $NetBSD: main.c,v 1.58 2009/10/21 17:10:36 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.57 2009/10/08 16:16:12 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.58 2009/10/21 17:10:36 joerg Exp $");
/*-
* Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -422,7 +422,12 @@ main(int argc, char *argv[])
usage();
}
- pkg_install_config();
+ /*
+ * config-var is reading the config file implicitly,
+ * so skip it here.
+ */
+ if (strcasecmp(argv[0], "config-var") != 0)
+ pkg_install_config();
if (use_default_sfx)
(void) strlcpy(sfx, DEFAULT_SFX, sizeof(sfx));
diff --git a/pkgtools/pkg_install/files/lib/parse-config.c b/pkgtools/pkg_install/files/lib/parse-config.c
index b6fe359cd4f..50ac2a72823 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.11 2009/10/15 12:41:41 joerg Exp $ */
+/* $NetBSD: parse-config.c,v 1.12 2009/10/21 17:10:36 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: parse-config.c,v 1.11 2009/10/15 12:41:41 joerg Exp $");
+__RCSID("$NetBSD: parse-config.c,v 1.12 2009/10/21 17:10:36 joerg Exp $");
/*-
* Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -99,6 +99,7 @@ static struct config_variable {
{ "PKGVULNURL", &pkg_vulnerabilities_url },
{ "VERBOSE_NETIO", &verbose_netio },
{ "VERIFIED_INSTALLATION", &verified_installation },
+ { NULL, NULL }, /* For use by pkg_install_show_variable */
{ NULL, NULL }
};
@@ -198,11 +199,19 @@ void
pkg_install_show_variable(const char *var_name)
{
struct config_variable *var;
+ const char *tmp_value = NULL;
for (var = config_variables; var->name != NULL; ++var) {
- if (strcmp(var->name, var_name) != 0)
- continue;
- if (*var->var != NULL)
- puts(*var->var);
+ if (strcmp(var->name, var_name) == 0)
+ break;
+ }
+ if (var->name == NULL) {
+ var->name = var_name;
+ var->var = &tmp_value;
}
+
+ pkg_install_config();
+
+ if (*var->var != NULL)
+ puts(*var->var);
}
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 54cdeb7503d..74a5f423a40 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.140 2009/10/15 12:41:41 joerg Exp $ */
+/* $NetBSD: version.h,v 1.141 2009/10/21 17:10:36 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 "20091015"
+#define PKGTOOLS_VERSION "20091021"
#endif /* _INST_LIB_VERSION_H_ */