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 pkg_install-20091021:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9519b01b40e5
branches:  trunk
changeset: 400529:9519b01b40e5
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Wed Oct 21 17:10:36 2009 +0000

description:
pkg_install-20091021:
Add support to query arbitrary variables with pkg_admin config-var.

diffstat:

 pkgtools/pkg_install/files/admin/main.c       |  11 ++++++++---
 pkgtools/pkg_install/files/lib/parse-config.c |  21 +++++++++++++++------
 pkgtools/pkg_install/files/lib/version.h      |   4 ++--
 3 files changed, 25 insertions(+), 11 deletions(-)

diffs (99 lines):

diff -r e363e69b7c82 -r 9519b01b40e5 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Wed Oct 21 17:00:33 2009 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Wed Oct 21 17:10:36 2009 +0000
@@ -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 @@
                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 -r e363e69b7c82 -r 9519b01b40e5 pkgtools/pkg_install/files/lib/parse-config.c
--- a/pkgtools/pkg_install/files/lib/parse-config.c     Wed Oct 21 17:00:33 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/parse-config.c     Wed Oct 21 17:10:36 2009 +0000
@@ -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@localhost>.
@@ -99,6 +99,7 @@
        { "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 @@
 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 -r e363e69b7c82 -r 9519b01b40e5 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Wed Oct 21 17:00:33 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Wed Oct 21 17:10:36 2009 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index