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 Make var_set and var_get ar...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bce350bac431
branches:  trunk
changeset: 532013:bce350bac431
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Thu Aug 09 23:54:17 2007 +0000

description:
Make var_set and var_get arguments always use full path names.

diffstat:

 pkgtools/pkg_install/files/admin/main.c   |   7 ++++---
 pkgtools/pkg_install/files/info/info.h    |   4 ++--
 pkgtools/pkg_install/files/info/perform.c |   8 ++++----
 pkgtools/pkg_install/files/info/show.c    |  10 +++++++---
 4 files changed, 17 insertions(+), 12 deletions(-)

diffs (109 lines):

diff -r 866ce9c6959d -r bce350bac431 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Thu Aug 09 23:32:59 2007 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Thu Aug 09 23:54:17 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.22 2007/08/08 22:33:38 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.23 2007/08/09 23:54:17 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.22 2007/08/08 22:33:38 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.23 2007/08/09 23:54:17 joerg Exp $");
 #endif
 
 /*
@@ -761,7 +761,8 @@
        char *filename;
        int retval;
 
-       if (asprintf(&filename, "%s/%s", name, INSTALLED_INFO_FNAME) == -1)
+       if (asprintf(&filename, "%s/%s/%s", _pkgdb_getPKGDB_DIR(), name,
+                    INSTALLED_INFO_FNAME) == -1)
                errx(EXIT_FAILURE, "asprintf failed");
 
        retval = var_set(filename, arg->variable, arg->value);
diff -r 866ce9c6959d -r bce350bac431 pkgtools/pkg_install/files/info/info.h
--- a/pkgtools/pkg_install/files/info/info.h    Thu Aug 09 23:32:59 2007 +0000
+++ b/pkgtools/pkg_install/files/info/info.h    Thu Aug 09 23:54:17 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: info.h,v 1.14 2007/08/09 23:06:42 joerg Exp $ */
+/* $NetBSD: info.h,v 1.15 2007/08/09 23:54:17 joerg Exp $ */
 
 /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
 
@@ -72,7 +72,7 @@
 extern lpkg_head_t pkgs;
 
 extern void show_file(const char *, const char *, const char *, Boolean);
-extern void show_var(const char *, const char *);
+extern void show_var(const char *, const char *, const char *);
 extern void show_plist(const char *, package_t *, pl_ent_t);
 extern void show_files(const char *, package_t *);
 extern void show_depends(const char *, package_t *);
diff -r 866ce9c6959d -r bce350bac431 pkgtools/pkg_install/files/info/perform.c
--- a/pkgtools/pkg_install/files/info/perform.c Thu Aug 09 23:32:59 2007 +0000
+++ b/pkgtools/pkg_install/files/info/perform.c Thu Aug 09 23:54:17 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.36 2007/08/09 23:18:30 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.37 2007/08/09 23:54:17 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -14,7 +14,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.36 2007/08/09 23:18:30 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.37 2007/08/09 23:54:17 joerg Exp $");
 #endif
 #endif
 
@@ -209,9 +209,9 @@
        } else if (Flags & SHOW_BI_VAR) {
                if (strcspn(BuildInfoVariable, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
                    == strlen(BuildInfoVariable))
-                       show_var(INSTALLED_INFO_FNAME, BuildInfoVariable);
+                       show_var(pkg, INSTALLED_INFO_FNAME, BuildInfoVariable);
                else
-                       show_var(BUILD_INFO_FNAME, BuildInfoVariable);
+                       show_var(pkg, BUILD_INFO_FNAME, BuildInfoVariable);
        } else {
                FILE   *fp;
                package_t plist;
diff -r 866ce9c6959d -r bce350bac431 pkgtools/pkg_install/files/info/show.c
--- a/pkgtools/pkg_install/files/info/show.c    Thu Aug 09 23:32:59 2007 +0000
+++ b/pkgtools/pkg_install/files/info/show.c    Thu Aug 09 23:54:17 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: show.c,v 1.15 2007/08/09 23:06:42 joerg Exp $  */
+/*     $NetBSD: show.c,v 1.16 2007/08/09 23:54:17 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
 #else
-__RCSID("$NetBSD: show.c,v 1.15 2007/08/09 23:06:42 joerg Exp $");
+__RCSID("$NetBSD: show.c,v 1.16 2007/08/09 23:54:17 joerg Exp $");
 #endif
 #endif
 
@@ -137,9 +137,13 @@
 }
 
 void
-show_var(const char *fname, const char *variable)
+show_var(const char *pkg, const char *fname, const char *variable)
 {
        char   *value;
+       char    filename[BUFSIZ];
+
+       (void)snprintf(filename, sizeof(filename), "%s/%s/%s",
+           _pkgdb_getPKGDB_DIR(), pkg, fname);
 
        if ((value=var_get(fname, variable)) != NULL) {
            (void) printf("%s\n", value);



Home | Main Index | Thread Index | Old Index