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 Move confi...
details: https://anonhg.NetBSD.org/pkgsrc/rev/4c55179d2aad
branches: pkg_install-renovation
changeset: 541534:4c55179d2aad
user: joerg <joerg%pkgsrc.org@localhost>
date: Thu May 08 23:34:27 2008 +0000
description:
Move configuration parser into libinstall.
Add a new VERIFY_CMD to be used by pkg_add soon.
diffstat:
pkgtools/pkg_install/files/admin/Makefile.in | 12 +-
pkgtools/pkg_install/files/admin/admin.h | 9 -
pkgtools/pkg_install/files/admin/config.c | 109 -----------------
pkgtools/pkg_install/files/admin/main.c | 7 +-
pkgtools/pkg_install/files/lib/Makefile.in | 6 +-
pkgtools/pkg_install/files/lib/lib.h | 15 ++-
pkgtools/pkg_install/files/lib/parse-config.c | 113 ++++++++++++++++++
pkgtools/pkg_install/files/lib/vulnerabilities-file.c | 8 +-
8 files changed, 140 insertions(+), 139 deletions(-)
diffs (truncated from 397 to 300 lines):
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/admin/Makefile.in
--- a/pkgtools/pkg_install/files/admin/Makefile.in Sat Apr 26 18:37:10 2008 +0000
+++ b/pkgtools/pkg_install/files/admin/Makefile.in Thu May 08 23:34:27 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.15.2.1 2008/04/26 18:37:10 joerg Exp $
+# $NetBSD: Makefile.in,v 1.15.2.2 2008/05/08 23:34:27 joerg Exp $
srcdir= @srcdir@
@@ -27,14 +27,12 @@
.if empty(BOOTSTRAP)
LIBS= -linstall -lbz2 -lfetch -lz @LIBS@
-OBJS= audit.o check.o config.o main.o
-CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib \
- -DSYSCONFDIR=\"$(sysconfdir)\"
+OBJS= audit.o check.o main.o
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib
.else
LIBS= -linstall @LIBS@
-OBJS= check.o config.o main.o
-CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib -DBOOTSTRAP \
- -DSYSCONFDIR=\"$(sysconfdir)\"
+OBJS= check.o main.o
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib -DBOOTSTRAP
.endif
all: $(PROG) $(SCRIPTS)
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/admin/admin.h
--- a/pkgtools/pkg_install/files/admin/admin.h Sat Apr 26 18:37:10 2008 +0000
+++ b/pkgtools/pkg_install/files/admin/admin.h Thu May 08 23:34:27 2008 +0000
@@ -34,12 +34,6 @@
extern int quiet;
extern int verbose;
-extern const char *pkg_vulnerabilities_dir;
-extern const char *pkg_vulnerabilities_file;
-extern const char *pkg_vulnerabilities_url;
-extern const char *ignore_advisories;
-extern const char tnf_vulnerability_base[];
-
void check(char **);
void audit_pkgdb(int, char **);
@@ -49,7 +43,4 @@
void check_pkg_vulnerabilities(int, char **);
void fetch_pkg_vulnerabilities(int, char **);
-void pkg_install_config(const char *);
-void pkg_install_show_variable(const char *);
-
void usage(void);
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/admin/config.c
--- a/pkgtools/pkg_install/files/admin/config.c Sat Apr 26 18:37:10 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/* $NetBSD: config.c,v 1.5 2008/04/07 13:25:32 joerg Exp $ */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <nbcompat.h>
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-#ifndef lint
-__RCSID("$NetBSD: config.c,v 1.5 2008/04/07 13:25:32 joerg Exp $");
-#endif
-
-/*-
- * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if HAVE_ERR_H
-#include <err.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "admin.h"
-#include "lib.h"
-
-const char *pkg_vulnerabilities_dir;
-const char *pkg_vulnerabilities_file;
-const char *pkg_vulnerabilities_url;
-const char *ignore_advisories = NULL;
-const char tnf_vulnerability_base[] = "ftp://ftp.NetBSD.org/pub/NetBSD/packages/vulns";
-
-static struct config_variable {
- const char *name;
- const char **var;
-} config_variables[] = {
- { "GPG", &gpg_cmd },
- { "PKGVULNDIR", &pkg_vulnerabilities_dir },
- { "PKGVULNURL", &pkg_vulnerabilities_url },
- { "IGNORE_URL", &ignore_advisories },
- { NULL, NULL }
-};
-
-void
-pkg_install_config(const char *config_file)
-{
- char *value;
- int ret;
- struct config_variable *var;
-
- for (var = config_variables; var->name != NULL; ++var) {
- value = var_get(config_file, var->name);
- if (value != NULL)
- *var->var = value;
- }
-
- if (pkg_vulnerabilities_dir == NULL)
- pkg_vulnerabilities_dir = _pkgdb_getPKGDB_DIR();
- ret = asprintf(&value, "%s/pkg-vulnerabilities", pkg_vulnerabilities_dir);
- pkg_vulnerabilities_file = value;
- if (ret == -1)
- err(EXIT_FAILURE, "asprintf failed");
- if (pkg_vulnerabilities_url == NULL) {
- ret = asprintf(&value, "%s/pkg-vulnerabilities.gz",
- tnf_vulnerability_base);
- 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);
- }
-}
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c Sat Apr 26 18:37:10 2008 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c Thu May 08 23:34:27 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.42 2008/04/16 00:53:06 joerg Exp $ */
+/* $NetBSD: main.c,v 1.42.2.1 2008/05/08 23:34:27 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.42 2008/04/16 00:53:06 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.42.2.1 2008/05/08 23:34:27 joerg Exp $");
#endif
/*-
@@ -347,7 +347,6 @@
int
main(int argc, char *argv[])
{
- const char *config_file = SYSCONFDIR"/pkg_install.conf";
Boolean use_default_sfx = TRUE;
Boolean show_basename_only = FALSE;
char lsdir[MaxPathSize];
@@ -413,7 +412,7 @@
usage();
}
- pkg_install_config(config_file);
+ pkg_install_config();
if (use_default_sfx)
(void) snprintf(sfx, sizeof(sfx), "%s", DEFAULT_SFX);
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/lib/Makefile.in
--- a/pkgtools/pkg_install/files/lib/Makefile.in Sat Apr 26 18:37:10 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/Makefile.in Thu May 08 23:34:27 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.21.2.1 2008/04/26 17:44:23 joerg Exp $
+# $NetBSD: Makefile.in,v 1.21.2.2 2008/05/08 23:34:27 joerg Exp $
srcdir= @srcdir@
@@ -29,9 +29,11 @@
OBJS= automatic.o conflicts.o decompress.o dewey.o fexec.o file.o \
global.o iterate.o lpkg.o opattern.o \
- path.o pkgdb.o plist.o \
+ parse-config.o path.o pkgdb.o plist.o \
str.o var.o version.o vulnerabilities-file.o
+CPPFLAGS+= -DSYSCONFDIR=\"$(sysconfdir)\"
+
.if !empty(BOOTSTRAP)
CPPFLAGS+= -DBOOTSTRAP
.else
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h Sat Apr 26 18:37:10 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h Thu May 08 23:34:27 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.42.2.1 2008/04/26 17:44:23 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.42.2.2 2008/05/08 23:34:27 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -368,10 +368,23 @@
struct pkg_vulnerabilities *read_pkg_vulnerabilities(const char *, int, int);
void free_pkg_vulnerabilities(struct pkg_vulnerabilities *);
+/* Parse configuration file */
+void pkg_install_config(void);
+/* Print configuration variable */
+void pkg_install_show_variable(const char *);
+
/* Externs */
extern Boolean Verbose;
extern Boolean Fake;
extern Boolean Force;
+extern const char *config_file;
extern const char *gpg_cmd;
+extern const char *verify_cmd;
+
+extern const char *pkg_vulnerabilities_dir;
+extern const char *pkg_vulnerabilities_file;
+extern const char *pkg_vulnerabilities_url;
+extern const char *ignore_advisories;
+extern const char tnf_vulnerability_base[];
#endif /* _INST_LIB_LIB_H_ */
diff -r 8464192b6eef -r 4c55179d2aad pkgtools/pkg_install/files/lib/parse-config.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_install/files/lib/parse-config.c Thu May 08 23:34:27 2008 +0000
@@ -0,0 +1,113 @@
+/* $NetBSD: parse-config.c,v 1.1.2.1 2008/05/08 23:34:27 joerg Exp $ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <nbcompat.h>
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+#ifndef lint
+__RCSID("$NetBSD: parse-config.c,v 1.1.2.1 2008/05/08 23:34:27 joerg Exp $");
+#endif
+
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
Home |
Main Index |
Thread Index |
Old Index