Mon Apr 7 13:07:14 2008 UTC ()
pkg_install-20080407:
Add command to print effective value of configuration variables.
Remove FETCH_CMD variable from pkg_admin, it is not used.


(joerg)
diff -r1.2 -r1.3 pkgsrc/pkgtools/pkg_install/files/admin/admin.h
diff -r1.3 -r1.4 pkgsrc/pkgtools/pkg_install/files/admin/config.c
diff -r1.40 -r1.41 pkgsrc/pkgtools/pkg_install/files/admin/main.c
diff -r1.16 -r1.17 pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1
diff -r1.15 -r1.16 pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat1
diff -r1.98 -r1.99 pkgsrc/pkgtools/pkg_install/files/lib/version.h

cvs diff -r1.2 -r1.3 pkgsrc/pkgtools/pkg_install/files/admin/admin.h (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/admin/admin.h 2008/03/13 16:35:30 1.2
+++ pkgsrc/pkgtools/pkg_install/files/admin/admin.h 2008/04/07 13:07:14 1.3
@@ -37,7 +37,6 @@
 extern const char *pkg_vulnerabilities_dir;
 extern const char *pkg_vulnerabilities_file;
 extern const char *pkg_vulnerabilities_url;
-extern const char *fetch_cmd;
 extern const char *ignore_advisories;
 extern const char tnf_vulnerability_base[];
 
@@ -50,5 +49,6 @@
 void	fetch_pkg_vulnerabilities(int, char **);
 
 void	pkg_install_config(const char *);
+void	pkg_install_show_variable(const char *);
 
 void 	usage(void);

cvs diff -r1.3 -r1.4 pkgsrc/pkgtools/pkg_install/files/admin/Attic/config.c (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/admin/Attic/config.c 2008/03/21 14:47:53 1.3
+++ pkgsrc/pkgtools/pkg_install/files/admin/Attic/config.c 2008/04/07 13:07:14 1.4
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.3 2008/03/21 14:47:53 joerg Exp $	*/
+/*	$NetBSD: config.c,v 1.4 2008/04/07 13:07:14 joerg Exp $	*/
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: config.c,v 1.3 2008/03/21 14:47:53 joerg Exp $");
+__RCSID("$NetBSD: config.c,v 1.4 2008/04/07 13:07:14 joerg Exp $");
 #endif
 
 /*-
@@ -53,7 +53,6 @@
 const char *pkg_vulnerabilities_dir;
 const char *pkg_vulnerabilities_file;
 const char *pkg_vulnerabilities_url;
-const char *fetch_cmd = FTP_CMD;
 const char *ignore_advisories = NULL;
 const char tnf_vulnerability_base[] = "ftp://ftp.NetBSD.org/pub/NetBSD/packages/vulns";
 
@@ -65,7 +64,6 @@
 	{ "PKGVULNDIR", &pkg_vulnerabilities_dir },
 	{ "PKGVULNURL", &pkg_vulnerabilities_url },
 	{ "IGNORE_URL", &ignore_advisories },
-	{ "FETCH_CMD", &fetch_cmd },
 	{ NULL, NULL }
 };
 
@@ -95,5 +93,18 @@
 		pkg_vulnerabilities_url = value;
 		if (ret == -1)
 			err(EXIT_FAILURE, "asprintf failed");
+	}
+}
+
+void
+pkg_install_show_variable(const char *var_name)
+{
+	struct config_variable *var;
+
+	for (var = config_variables; var->name != NULL; ++var) {
+		if (strcmp(var->name, var_name) != 0)
+			continue;
+		if (*var->var != NULL)
+			puts(*var->var);
 	}
 }

cvs diff -r1.40 -r1.41 pkgsrc/pkgtools/pkg_install/files/admin/main.c (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/admin/main.c 2008/03/23 01:04:47 1.40
+++ pkgsrc/pkgtools/pkg_install/files/admin/main.c 2008/04/07 13:07:14 1.41
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.40 2008/03/23 01:04:47 dsainty Exp $	*/
+/*	$NetBSD: main.c,v 1.41 2008/04/07 13:07:14 joerg Exp $	*/
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.40 2008/03/23 01:04:47 dsainty Exp $");
+__RCSID("$NetBSD: main.c,v 1.41 2008/04/07 13:07:14 joerg Exp $");
 #endif
 
 /*-
@@ -113,9 +113,10 @@
 	    " pmatch pattern pkg          - returns true if pkg matches pattern, otherwise false\n"
 	    " fetch-pkg-vulnerabilities [-s] - fetch new vulnerability file\n"
 	    " check-pkg-vulnerabilities [-s] <file> - check syntax and checksums of the vulnerability file\n"
-	    " audit [-es] [-t type] ...\n"
-	    " audit-pkg [-es] [-t type] ...\n"
-	    " audit-batch [-es] [-t type] ...\n",
+	    " audit [-es] [-t type] ...       - check installed packages for vulnerabilities\n"
+	    " audit-pkg [-es] [-t type] ...   - check listed packages for vulnerabilities\n"
+	    " audit-batch [-es] [-t type] ... - check packages in listed files for vulnerabilities\n"
+	    " config-var name                 - print current value of the configuration variable\n",
 	    getprogname());
 	exit(EXIT_FAILURE);
 }
@@ -521,6 +522,11 @@
 	} else if (strcasecmp(argv[0], "unset") == 0) {
 		argv++;		/* "unset" */
 		set_unset_variable(argv, TRUE);
+	} else if (strcasecmp(argv[0], "config-var") == 0) {
+		argv++;
+		if (argv == NULL || argv[1] != NULL)
+			errx(EXIT_FAILURE, "config-var takes exactly one argument");
+		pkg_install_show_variable(argv[0]);
 	}
 #ifndef BOOTSTRAP
 	else if (strcasecmp(argv[0], "fetch-pkg-vulnerabilities") == 0) {

cvs diff -r1.16 -r1.17 pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1 (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1 2008/03/13 16:35:30 1.16
+++ pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1 2008/04/07 13:07:14 1.17
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pkg_admin.1,v 1.16 2008/03/13 16:35:30 joerg Exp $
+.\"	$NetBSD: pkg_admin.1,v 1.17 2008/04/07 13:07:14 joerg Exp $
 .\"
 .\" Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -164,6 +164,10 @@
 If
 .Fl s
 is given, also check the embedded signature.
+.It Cm config-var Ar variable
+Print the current value of
+.Ar variable
+as used after parsing the configuration file.
 .It Cm delete Ar pkg ...
 For each listed package, remove all file entries in the package database that
 belong to the package.

cvs diff -r1.15 -r1.16 pkgsrc/pkgtools/pkg_install/files/admin/Attic/pkg_admin.cat1 (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/admin/Attic/pkg_admin.cat1 2008/03/13 16:35:30 1.15
+++ pkgsrc/pkgtools/pkg_install/files/admin/Attic/pkg_admin.cat1 2008/04/07 13:07:14 1.16
@@ -90,6 +90,10 @@
              Check format and hashes in the pkg-vulnerabilties file _f_i_l_e.  If
              --ss is given, also check the embedded signature.
 
+     ccoonnffiigg--vvaarr _v_a_r_i_a_b_l_e
+             Print the current value of _v_a_r_i_a_b_l_e as used after parsing the
+             configuration file.
+
      ddeelleettee _p_k_g _._._.
              For each listed package, remove all file entries in the package
              database that belong to the package.  This should be used only by

cvs diff -r1.98 -r1.99 pkgsrc/pkgtools/pkg_install/files/lib/version.h (expand / switch to context diff)
--- pkgsrc/pkgtools/pkg_install/files/lib/version.h 2008/04/04 15:21:32 1.98
+++ pkgsrc/pkgtools/pkg_install/files/lib/version.h 2008/04/07 13:07:14 1.99
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.h,v 1.98 2008/04/04 15:21:32 joerg Exp $	*/
+/*	$NetBSD: version.h,v 1.99 2008/04/07 13:07:14 joerg Exp $	*/
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -33,6 +33,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20080402"
+#define PKGTOOLS_VERSION "20080407"
 
 #endif /* _INST_LIB_VERSION_H_ */