pkg_install-20091006:

- restore pkg_add -f functionality for missing dependencies (PR 42001)
- pkg_admin rebuild should count packages correctly (he@), also count @pkgdir
- fix gpg-sign-package syntax in pkg_admin(1)
- change default URL for pkg-vulnerabilities to use HTTP
This commit is contained in:
joerg 2009-10-07 13:19:36 +00:00
parent 366ae82927
commit a8429a111e
13 changed files with 66 additions and 112 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: add.h,v 1.1.1.4 2009/08/21 15:18:57 joerg Exp $ */
/* $NetBSD: add.h,v 1.1.1.5 2009/10/07 13:19:36 joerg Exp $ */
/* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */
@ -39,6 +39,8 @@ extern Boolean Automatic;
extern int LicenseCheck;
extern int Replace;
extern Boolean ForceDepends;
int make_hierarchy(char *);
void apply_perms(char *, char **, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.1.1.5 2009/08/21 15:18:58 joerg Exp $ */
/* $NetBSD: main.c,v 1.1.1.6 2009/10/07 13:19: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.1.1.5 2009/08/21 15:18:58 joerg Exp $");
__RCSID("$NetBSD: main.c,v 1.1.1.6 2009/10/07 13:19:36 joerg Exp $");
/*
*
@ -36,9 +36,6 @@ __RCSID("$NetBSD: main.c,v 1.1.1.5 2009/08/21 15:18:58 joerg Exp $");
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include "lib.h"
#include "add.h"
@ -54,6 +51,7 @@ Boolean NoView = FALSE;
Boolean NoInstall = FALSE;
Boolean NoRecord = FALSE;
Boolean Automatic = FALSE;
Boolean ForceDepends = FALSE;
int LicenseCheck = 0;
int Replace = 0;
@ -92,6 +90,7 @@ main(int argc, char **argv)
case 'f':
Force = TRUE;
ForceDepends = TRUE;
break;
case 'I':

View File

@ -1,4 +1,4 @@
/* $NetBSD: perform.c,v 1.1.1.11 2009/08/21 15:19:00 joerg Exp $ */
/* $NetBSD: perform.c,v 1.1.1.12 2009/10/07 13:19:39 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@ -6,7 +6,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: perform.c,v 1.1.1.11 2009/08/21 15:19:00 joerg Exp $");
__RCSID("$NetBSD: perform.c,v 1.1.1.12 2009/10/07 13:19:39 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
@ -1034,12 +1034,19 @@ check_dependencies(struct pkg_task *pkg)
continue;
}
if (pkg_do(p->name, 1, 0)) {
warnx("Can't install dependency %s", p->name);
status = -1;
break;
if (ForceDepends) {
warnx("Can't install dependency %s, "
"continuing", p->name);
continue;
} else {
warnx("Can't install dependency %s",
p->name);
status = -1;
break;
}
}
best_installed = find_best_matching_installed_pkg(p->name);
if (best_installed == NULL && Force) {
if (best_installed == NULL && ForceDepends) {
warnx("Missing dependency %s ignored", p->name);
continue;
} else if (best_installed == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.1.1.9 2009/08/21 15:19:05 joerg Exp $ */
/* $NetBSD: main.c,v 1.1.1.10 2009/10/07 13:19:40 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.1.1.9 2009/08/21 15:19:05 joerg Exp $");
__RCSID("$NetBSD: main.c,v 1.1.1.10 2009/10/07 13:19:40 joerg Exp $");
/*-
* Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@ -82,6 +82,12 @@ __RCSID("$NetBSD: main.c,v 1.1.1.9 2009/08/21 15:19:05 joerg Exp $");
#define DEFAULT_SFX ".t[bg]z" /* default suffix for ls{all,best} */
struct pkgdb_count {
size_t files;
size_t directories;
size_t packages;
};
static const char Options[] = "C:K:SVbd:qs:v";
int quiet, verbose;
@ -138,12 +144,13 @@ add_pkg(const char *pkgdir, void *vp)
char *PkgName, *dirp;
char file[MaxPathSize];
char dir[MaxPathSize];
int tmp, *cnt;
struct pkgdb_count *count;
if (!pkgdb_open(ReadWrite))
err(EXIT_FAILURE, "cannot open pkgdb");
cnt = vp != NULL ? vp : &tmp;
count = vp;
++count->packages;
PkgDBDir = _pkgdb_getPKGDB_DIR();
contents = pkgdb_pkg_file(pkgdir, CONTENTS_FNAME);
@ -175,12 +182,12 @@ add_pkg(const char *pkgdir, void *vp)
}
} else {
pkgdb_store(file, PkgName);
(*cnt)++;
++count->files;
}
break;
case PLIST_PKGDIR:
add_pkgdir(PkgName, dirp, p->name);
(*cnt)++;
++count->directories;
break;
case PLIST_CWD:
if (strcmp(p->name, ".") != 0) {
@ -231,10 +238,11 @@ static void
rebuild(void)
{
char cachename[MaxPathSize];
int pkgcnt, filecnt;
struct pkgdb_count count;
pkgcnt = 0;
filecnt = 0;
count.files = 0;
count.directories = 0;
count.packages = 0;
(void) _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename));
if (unlink(cachename) != 0 && errno != ENOENT)
@ -242,12 +250,14 @@ rebuild(void)
setbuf(stdout, NULL);
iterate_pkg_db(add_pkg, &filecnt);
iterate_pkg_db(add_pkg, &count);
printf("\n");
printf("Stored %d file%s from %d package%s in %s.\n",
filecnt, filecnt == 1 ? "" : "s",
pkgcnt, pkgcnt == 1 ? "" : "s",
printf("Stored %zu file%s and %zu explizit director%s"
" from %zu package%s in %s.\n",
count.files, count.files == 1 ? "" : "s",
count.directories, count.directories == 1 ? "y" : "ies",
count.packages, count.packages == 1 ? "" : "s",
cachename);
}
@ -415,7 +425,7 @@ main(int argc, char *argv[])
pkg_install_config();
if (use_default_sfx)
(void) snprintf(sfx, sizeof(sfx), "%s", DEFAULT_SFX);
(void) strlcpy(sfx, DEFAULT_SFX, sizeof(sfx));
if (strcasecmp(argv[0], "pmatch") == 0) {

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_admin.1,v 1.1.1.8 2009/08/21 15:19:05 joerg Exp $
.\" $NetBSD: pkg_admin.1,v 1.1.1.9 2009/10/07 13:19:40 joerg Exp $
.\"
.\" Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -289,10 +289,11 @@ to remove a variable.
Packages that are not installed directly by the user but pulled in as
dependencies are marked by setting
.Dq automatic=YES .
.It Cm gpg-sign-package pkg
.It Cm gpg-sign-package pkg spkg
Sign the binary package
.Ar pkg
using GPG.
using GPG and write the result to
.Ar spkg .
.It Cm x509-sign-package pkg spkg key cert
Sign the binary package
.Ar pkg

View File

@ -1,4 +1,4 @@
/* $NetBSD: info.h,v 1.1.1.4 2009/08/06 16:55:25 joerg Exp $ */
/* $NetBSD: info.h,v 1.1.1.5 2009/10/07 13:19:42 joerg Exp $ */
/* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
@ -114,7 +114,6 @@ extern Boolean File2Pkg;
extern Boolean Quiet;
extern const char *InfoPrefix;
extern const char *BuildInfoVariable;
extern size_t termwidth;
extern lpkg_head_t pkgs;
int CheckForPkg(const char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.1.1.6 2009/08/06 16:55:25 joerg Exp $ */
/* $NetBSD: main.c,v 1.1.1.7 2009/10/07 13:19:42 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.1.1.6 2009/08/06 16:55:25 joerg Exp $");
__RCSID("$NetBSD: main.c,v 1.1.1.7 2009/10/07 13:19:42 joerg Exp $");
/*
*
@ -34,9 +34,6 @@ __RCSID("$NetBSD: main.c,v 1.1.1.6 2009/08/06 16:55:25 joerg Exp $");
#include <sys/ioctl.h>
#endif
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#if HAVE_ERR_H
#include <err.h>
#endif
@ -52,7 +49,6 @@ Boolean File2Pkg = FALSE;
Boolean Quiet = FALSE;
const char *InfoPrefix = "";
const char *BuildInfoVariable = "";
size_t termwidth = 0;
lpkg_head_t pkgs;
static void
@ -324,17 +320,6 @@ main(int argc, char **argv)
if (TAILQ_FIRST(&pkgs) == NULL && Which == WHICH_LIST && !CheckPkg)
warnx("missing package name(s)"), usage();
if (isatty(STDOUT_FILENO)) {
const char *p;
struct winsize win;
if ((p = getenv("COLUMNS")) != NULL)
termwidth = atoi(p);
else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
win.ws_col > 0)
termwidth = win.ws_col;
}
rc = pkg_perform(&pkgs);
exit(rc);
/* NOTREACHED */

View File

@ -3,24 +3,9 @@
/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
/* Define to 1 if you have the `chflags' function. */
#undef HAVE_CHFLAGS
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <db1/db.h> header file. */
#undef HAVE_DB1_DB_H
/* Define to 1 if you have the `dbopen' function. */
#undef HAVE_DBOPEN
/* Define to 1 if you have the <db_185.h> header file. */
#undef HAVE_DB_185_H
/* Define to 1 if you have the <db.h> header file. */
#undef HAVE_DB_H
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
@ -54,15 +39,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
@ -96,21 +75,9 @@
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/queue.h> header file. */
#undef HAVE_SYS_QUEUE_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/signal.h> header file. */
#undef HAVE_SYS_SIGNAL_H
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#undef HAVE_SYS_STATVFS_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@ -123,18 +90,9 @@
/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
@ -147,9 +105,6 @@
/* Define to 1 if you have the <vis.h> header file. */
#undef HAVE_VIS_H
/* Define to 1 if you have the `__db185_open' function. */
#undef HAVE___DB185_OPEN
/* Defined when PRIu64 is missing or broken */
#undef NEED_PRI_MACRO
@ -168,6 +123,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

View File

@ -1,4 +1,4 @@
/* $NetBSD: file.c,v 1.1.1.4 2009/08/06 16:55:27 joerg Exp $ */
/* $NetBSD: file.c,v 1.1.1.5 2009/10/07 13:19:43 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@ -13,7 +13,7 @@
#if HAVE_SYS_QUEUE_H
#include <sys/queue.h>
#endif
__RCSID("$NetBSD: file.c,v 1.1.1.4 2009/08/06 16:55:27 joerg Exp $");
__RCSID("$NetBSD: file.c,v 1.1.1.5 2009/10/07 13:19:43 joerg Exp $");
/*
* FreeBSD install - a package for the installation and maintainance
@ -50,9 +50,6 @@ __RCSID("$NetBSD: file.c,v 1.1.1.4 2009/08/06 16:55:27 joerg Exp $");
#if HAVE_GLOB_H
#include <glob.h>
#endif
#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_PWD_H
#include <pwd.h>
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse-config.c,v 1.1.1.6 2009/08/21 15:19:14 joerg Exp $ */
/* $NetBSD: parse-config.c,v 1.1.1.7 2009/10/07 13:19:44 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.1.1.6 2009/08/21 15:19:14 joerg Exp $");
__RCSID("$NetBSD: parse-config.c,v 1.1.1.7 2009/10/07 13:19:44 joerg Exp $");
/*-
* Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@ -70,7 +70,7 @@ 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";
const char tnf_vulnerability_base[] = "http://ftp.NetBSD.org/pub/NetBSD/packages/vulns";
const char *acceptable_licenses = NULL;
static struct config_variable {

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_install.conf.5.in,v 1.1.1.7 2009/08/21 15:19:18 joerg Exp $
.\" $NetBSD: pkg_install.conf.5.in,v 1.1.1.8 2009/10/07 13:19:44 joerg Exp $
.\"
.\" Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -146,7 +146,7 @@ URL which is used for updating the local
file when running
.Dl Ic pkg_admin fetch-pkg-vulnerabilities
The default is
.Pa ftp://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities.gz
.Pa http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities.gz
.Em Note :
Usually, only the compression type should be changed.
Currently supported are uncompressed files and files compressed by

View File

@ -1,4 +1,4 @@
/* $NetBSD: pkgdb.c,v 1.1.1.4 2009/08/06 16:55:28 joerg Exp $ */
/* $NetBSD: pkgdb.c,v 1.1.1.5 2009/10/07 13:19:45 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: pkgdb.c,v 1.1.1.4 2009/08/06 16:55:28 joerg Exp $");
__RCSID("$NetBSD: pkgdb.c,v 1.1.1.5 2009/10/07 13:19:45 joerg Exp $");
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@ -38,11 +38,7 @@ __RCSID("$NetBSD: pkgdb.c,v 1.1.1.4 2009/08/06 16:55:28 joerg Exp $");
* POSSIBILITY OF SUCH DAMAGE.
*/
#if HAVE_DB_185_H
#include <db_185.h>
#elif HAVE_DB1_DB_H
#include <db1/db.h>
#elif HAVE_DB_H
#ifdef NETBSD
#include <db.h>
#else
#include <nbcompat/db.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.1.1.19 2009/08/21 15:19:26 joerg Exp $ */
/* $NetBSD: version.h,v 1.1.1.20 2009/10/07 13:19:45 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 "20090817"
#define PKGTOOLS_VERSION "20091006"
#endif /* _INST_LIB_VERSION_H_ */