From 375a51926a5078edbef2853c4dc6b4c3d9b40440 Mon Sep 17 00:00:00 2001 From: joerg Date: Thu, 5 Nov 2009 18:39:00 +0000 Subject: [PATCH] pkg_install-20091115: Completely ignore @src in pkg_create. Silently ignore the -L option. The combination of -I and -p are used by pkgsrc for the same result. Do not overwrite a string with itself using snprintf. This breaks setting the pkgdb directory internally on Linux. Explicitly check if the string is the same and otherwise just use xstrdup. Add support to query arbitrary variables with pkg_admin config-var. --- external/bsd/pkg_install/dist/admin/main.c | 11 +++++++--- external/bsd/pkg_install/dist/create/build.c | 12 +++-------- external/bsd/pkg_install/dist/create/create.h | 3 +-- external/bsd/pkg_install/dist/create/main.c | 9 ++++---- .../bsd/pkg_install/dist/create/perform.c | 11 ++-------- .../bsd/pkg_install/dist/create/pkg_create.1 | 17 +++++---------- external/bsd/pkg_install/dist/create/pl.c | 8 ++----- external/bsd/pkg_install/dist/lib/license.c | 4 ++-- .../bsd/pkg_install/dist/lib/parse-config.c | 21 +++++++++++++------ external/bsd/pkg_install/dist/lib/pkgdb.c | 14 ++++++++----- external/bsd/pkg_install/dist/lib/version.h | 4 ++-- 11 files changed, 53 insertions(+), 61 deletions(-) diff --git a/external/bsd/pkg_install/dist/admin/main.c b/external/bsd/pkg_install/dist/admin/main.c index 84c0bf6bc0ff..8b896771fe03 100644 --- a/external/bsd/pkg_install/dist/admin/main.c +++ b/external/bsd/pkg_install/dist/admin/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.11 2009/10/08 16:19:59 joerg Exp $ */ +/* $NetBSD: main.c,v 1.1.1.12 2009/11/05 18:39:00 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: main.c,v 1.1.1.11 2009/10/08 16:19:59 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.1.1.12 2009/11/05 18:39:00 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/external/bsd/pkg_install/dist/create/build.c b/external/bsd/pkg_install/dist/create/build.c index be55d115fa07..fa316a546113 100644 --- a/external/bsd/pkg_install/dist/create/build.c +++ b/external/bsd/pkg_install/dist/create/build.c @@ -1,4 +1,4 @@ -/* $NetBSD: build.c,v 1.1.1.6 2009/08/06 16:55:20 joerg Exp $ */ +/* $NetBSD: build.c,v 1.1.1.7 2009/11/05 18:39:02 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: build.c,v 1.1.1.6 2009/08/06 16:55:20 joerg Exp $"); +__RCSID("$NetBSD: build.c,v 1.1.1.7 2009/11/05 18:39:02 joerg Exp $"); /*- * Copyright (c) 2007 Joerg Sonnenberger . @@ -298,13 +298,7 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) for (p = plist->head; p; p = p->next) { if (p->type == PLIST_FILE) { write_normal_file(p->name, archive, resolver, owner, group); - } else if (p->type == PLIST_CWD || p->type == PLIST_SRC) { - - /* XXX let PLIST_SRC override PLIST_CWD */ - if (p->type == PLIST_CWD && p->next != NULL && - p->next->type == PLIST_SRC) { - continue; - } + } else if (p->type == PLIST_CWD) { chdir(p->name); } else if (p->type == PLIST_IGNORE) { p = p->next; diff --git a/external/bsd/pkg_install/dist/create/create.h b/external/bsd/pkg_install/dist/create/create.h index 05985d717aa3..53b15f9bccf6 100644 --- a/external/bsd/pkg_install/dist/create/create.h +++ b/external/bsd/pkg_install/dist/create/create.h @@ -1,4 +1,4 @@ -/* $NetBSD: create.h,v 1.1.1.4 2009/08/06 16:55:20 joerg Exp $ */ +/* $NetBSD: create.h,v 1.1.1.5 2009/11/05 18:39:02 joerg Exp $ */ /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */ @@ -51,7 +51,6 @@ extern char *BuildInfo; extern char *SizePkg; extern char *SizeAll; extern char *Preserve; -extern char *SrcDir; extern char *realprefix; extern char *DefaultOwner; extern char *DefaultGroup; diff --git a/external/bsd/pkg_install/dist/create/main.c b/external/bsd/pkg_install/dist/create/main.c index b7bff447dc4b..c5b1e158166d 100644 --- a/external/bsd/pkg_install/dist/create/main.c +++ b/external/bsd/pkg_install/dist/create/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.5 2009/08/06 16:55:21 joerg Exp $ */ +/* $NetBSD: main.c,v 1.1.1.6 2009/11/05 18:39:02 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: main.c,v 1.1.1.5 2009/08/06 16:55:21 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.1.1.6 2009/11/05 18:39:02 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -43,7 +43,6 @@ char *BuildInfo = NULL; char *SizePkg = NULL; char *SizeAll = NULL; char *Preserve = NULL; -char *SrcDir = NULL; char *DefaultOwner = NULL; char *DefaultGroup = NULL; char *realprefix = NULL; @@ -61,7 +60,7 @@ usage(void) "usage: pkg_create [-ElOUVv] [-B build-info-file] [-b build-version-file]\n" " [-C cpkgs] [-D displayfile] [-F compression] \n" " [-I realprefix] [-i iscript]\n" - " [-K pkg_dbdir] [-k dscript] [-L SrcDir]\n" + " [-K pkg_dbdir] [-k dscript]\n" " [-n preserve-file] [-P dpkgs] [-p prefix] [-r rscript]\n" " [-S size-all-file] [-s size-pkg-file]\n" " [-T buildpkgs] [-u owner] [-g group]\n" @@ -147,7 +146,7 @@ main(int argc, char **argv) break; case 'L': - SrcDir = optarg; + warnx("Obsolete -L option ignored"); break; case 'u': diff --git a/external/bsd/pkg_install/dist/create/perform.c b/external/bsd/pkg_install/dist/create/perform.c index 7710dfa7b028..f23f66e25b28 100644 --- a/external/bsd/pkg_install/dist/create/perform.c +++ b/external/bsd/pkg_install/dist/create/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.1.1.4 2009/08/06 16:55:21 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.1.1.5 2009/11/05 18:39:02 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: perform.c,v 1.1.1.4 2009/08/06 16:55:21 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.1.1.5 2009/11/05 18:39:02 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -168,13 +168,6 @@ pkg_perform(const char *pkg) plist.head = plist.tail = NULL; - /* If a SrcDir override is set, add it now */ - if (SrcDir) { - if (Verbose && !PlistOnly) - printf("Using SrcDir value of %s\n", (realprefix) ? realprefix : SrcDir); - add_plist(&plist, PLIST_SRC, SrcDir); - } - /* Stick the dependencies, if any, at the top */ if (Pkgdeps) register_depends(&plist, Pkgdeps, 0); diff --git a/external/bsd/pkg_install/dist/create/pkg_create.1 b/external/bsd/pkg_install/dist/create/pkg_create.1 index 42043070cd0b..44b880c5d698 100644 --- a/external/bsd/pkg_install/dist/create/pkg_create.1 +++ b/external/bsd/pkg_install/dist/create/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_create.1,v 1.1.1.5 2009/05/17 21:21:07 joerg Exp $ +.\" $NetBSD: pkg_create.1,v 1.1.1.6 2009/11/05 18:39:02 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -24,7 +24,7 @@ .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" -.Dd May 13, 2009 +.Dd November 15, 2009 .Dt PKG_CREATE 1 .Os .Sh NAME @@ -64,9 +64,6 @@ .Op Fl k Ar dscript .Ek .Bk -words -.Op Fl L Ar SrcDir -.Ek -.Bk -words .Op Fl n Ar preserve-file .Ek .Bk -words @@ -211,9 +208,6 @@ to be the de-install procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later (if ever) de-installed. -.It Fl L Ar SrcDir -This sets the package's @src directive; see below for a description -of what this does. .It Fl l Check that any symbolic links which are to be placed in the package are relative to the current prefix. @@ -333,11 +327,10 @@ Note: .Cm @cd is also an alias for this command. .It Cm @src Ar directory -Set the internal directory pointer for _creation only_ to -.Ar directory . -That is to say that it overrides +This command is supported for compatibility only. +It was formerly used to override .Cm @cwd -for package creation but not extraction. +during package creation. .It Cm @exec Ar command Execute .Ar command diff --git a/external/bsd/pkg_install/dist/create/pl.c b/external/bsd/pkg_install/dist/create/pl.c index bfe1996fa94f..7aa0f28111e1 100644 --- a/external/bsd/pkg_install/dist/create/pl.c +++ b/external/bsd/pkg_install/dist/create/pl.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl.c,v 1.1.1.3 2009/04/24 14:16:59 joerg Exp $ */ +/* $NetBSD: pl.c,v 1.1.1.4 2009/11/05 18:39:03 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: pl.c,v 1.1.1.3 2009/04/24 14:16:59 joerg Exp $"); +__RCSID("$NetBSD: pl.c,v 1.1.1.4 2009/11/05 18:39:03 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -86,7 +86,6 @@ check_list(package_t *pkg, const char *PkgName) char target[MaxPathSize + SymlinkHeaderLen]; char name[MaxPathSize]; char *cwd = NULL; - char *srcdir = NULL; char *pkgname = NULL; int cc; @@ -105,9 +104,6 @@ check_list(package_t *pkg, const char *PkgName) case PLIST_IGNORE: p = p->next; break; - case PLIST_SRC: - srcdir = p->name; - break; case PLIST_PKGDIR: if (cwd == NULL) errx(2, "@pkgdir without preceding @cwd found"); diff --git a/external/bsd/pkg_install/dist/lib/license.c b/external/bsd/pkg_install/dist/lib/license.c index 68338b717b99..5cb1fc73449f 100644 --- a/external/bsd/pkg_install/dist/lib/license.c +++ b/external/bsd/pkg_install/dist/lib/license.c @@ -1,4 +1,4 @@ -/* $NetBSD: license.c,v 1.1.1.5 2009/08/06 16:55:29 joerg Exp $ */ +/* $NetBSD: license.c,v 1.1.1.6 2009/11/05 18:39:05 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger . @@ -50,7 +50,7 @@ const char *default_acceptable_licenses = "gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 " "gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 " "gnu-gpl-v3 gnu-lgpl-v3 " - "original-bsd modified-bsd " + "original-bsd modified-bsd 2-clause-bsd " "x11 mit miros " "apache-1.1 apache-2.0 " "artistic artistic-2.0 " diff --git a/external/bsd/pkg_install/dist/lib/parse-config.c b/external/bsd/pkg_install/dist/lib/parse-config.c index a8d0a7f93032..1cdc4f4e755b 100644 --- a/external/bsd/pkg_install/dist/lib/parse-config.c +++ b/external/bsd/pkg_install/dist/lib/parse-config.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse-config.c,v 1.1.1.8 2009/10/15 13:01:26 joerg Exp $ */ +/* $NetBSD: parse-config.c,v 1.1.1.9 2009/11/05 18:39:06 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: parse-config.c,v 1.1.1.8 2009/10/15 13:01:26 joerg Exp $"); +__RCSID("$NetBSD: parse-config.c,v 1.1.1.9 2009/11/05 18:39:06 joerg Exp $"); /*- * Copyright (c) 2008, 2009 Joerg Sonnenberger . @@ -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/external/bsd/pkg_install/dist/lib/pkgdb.c b/external/bsd/pkg_install/dist/lib/pkgdb.c index 07018ba0e848..172fc1e271e0 100644 --- a/external/bsd/pkg_install/dist/lib/pkgdb.c +++ b/external/bsd/pkg_install/dist/lib/pkgdb.c @@ -1,4 +1,4 @@ -/* $NetBSD: pkgdb.c,v 1.1.1.5 2009/10/07 13:19:45 joerg Exp $ */ +/* $NetBSD: pkgdb.c,v 1.1.1.6 2009/11/05 18:39:07 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: pkgdb.c,v 1.1.1.5 2009/10/07 13:19:45 joerg Exp $"); +__RCSID("$NetBSD: pkgdb.c,v 1.1.1.6 2009/11/05 18:39:07 joerg Exp $"); /*- * Copyright (c) 1999-2008 The NetBSD Foundation, Inc. @@ -78,7 +78,6 @@ __RCSID("$NetBSD: pkgdb.c,v 1.1.1.5 2009/10/07 13:19:45 joerg Exp $"); static DB *pkgdbp; static char *pkgdb_dir = NULL; -static char pkgdb_cache[MaxPathSize]; /* * Open the pkg-database @@ -310,8 +309,13 @@ _pkgdb_getPKGDB_DIR(void) void _pkgdb_setPKGDB_DIR(const char *dir) { - (void) snprintf(pkgdb_cache, sizeof(pkgdb_cache), "%s", dir); - pkgdb_dir = pkgdb_cache; + char *new_dir; + + if (dir == pkgdb_dir) + return; + new_dir = xstrdup(dir); + free(pkgdb_dir); + pkgdb_dir = new_dir; } char * diff --git a/external/bsd/pkg_install/dist/lib/version.h b/external/bsd/pkg_install/dist/lib/version.h index 3ad0ad6b94ab..bdea6c6dcfa8 100644 --- a/external/bsd/pkg_install/dist/lib/version.h +++ b/external/bsd/pkg_install/dist/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.1.1.22 2009/10/15 13:01:25 joerg Exp $ */ +/* $NetBSD: version.h,v 1.1.1.23 2009/11/05 18:39:12 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 "20091115" #endif /* _INST_LIB_VERSION_H_ */