diff --git a/external/bsd/pkg_install/Makefile.inc b/external/bsd/pkg_install/Makefile.inc index d7247cdbd..9064c9562 100644 --- a/external/bsd/pkg_install/Makefile.inc +++ b/external/bsd/pkg_install/Makefile.inc @@ -11,7 +11,7 @@ CPPFLAGS+=-DHAVE_CONFIG_H -DNETBSD -DHAVE_SSL CPPFLAGS+=-DSYSCONFDIR='"/etc"' .else CPPFLAGS+=-DSYSCONFDIR='"/usr/pkg/etc"' -CPPFLAGS+=-DDEF_LOG_DIR='"/usr/pkg/var/db/pkg"' +CPPFLAGS+=-DDEF_LOG_DIR='"/usr/pkg/pkgdb"' CPPFLAGS+=-DOPSYS_NAME='"Minix"' .endif # !defined(__MINIX) diff --git a/external/bsd/pkg_install/dist/add/add.h b/external/bsd/pkg_install/dist/add/add.h index cc26e75fb..104922b2c 100644 --- a/external/bsd/pkg_install/dist/add/add.h +++ b/external/bsd/pkg_install/dist/add/add.h @@ -1,4 +1,4 @@ -/* $NetBSD: add.h,v 1.1.1.7 2011/02/18 22:32:27 aymeric Exp $ */ +/* $NetBSD: add.h,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */ diff --git a/external/bsd/pkg_install/dist/add/main.c b/external/bsd/pkg_install/dist/add/main.c index c6f7b8c0a..3ddc6b7aa 100644 --- a/external/bsd/pkg_install/dist/add/main.c +++ b/external/bsd/pkg_install/dist/add/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.10 2011/02/18 22:32:27 aymeric Exp $ */ +/* $NetBSD: main.c,v 1.2 2017/04/20 13:18:23 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.10 2011/02/18 22:32:27 aymeric Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * @@ -33,20 +33,14 @@ __RCSID("$NetBSD: main.c,v 1.1.1.10 2011/02/18 22:32:27 aymeric Exp $"); #if HAVE_ERR_H #include #endif -#if HAVE_SYS_PARAM_H -#include -#endif #include "lib.h" #include "add.h" -static char Options[] = "AC:DIK:LP:RVW:fhm:np:t:Uuvw:"; +static char Options[] = "AC:DIK:P:RVfhm:np:t:Uuv"; char *Destdir = NULL; char *OverrideMachine = NULL; char *Prefix = NULL; -char *View = NULL; -char *Viewbase = NULL; -Boolean NoView = FALSE; Boolean NoInstall = FALSE; Boolean NoRecord = FALSE; Boolean Automatic = FALSE; @@ -65,10 +59,9 @@ int ReplaceSame = 0; static void usage(void) { - (void) fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pkg_add [-AfhILnRuVv] [-C config] [-P destdir] [-K pkg_dbdir]", - " [-m machine] [-p prefix] [-s verification-type", - " [-W viewbase] [-w view]\n", + (void) fprintf(stderr, "%s\n%s\n%s\n", + "usage: pkg_add [-AfhInRuVv] [-C config] [-P destdir] [-K pkg_dbdir]", + " [-m machine] [-p prefix]", " [[ftp|http]://[user[:password]@]host[:port]][/path/]pkg-name ..."); exit(1); } @@ -112,10 +105,6 @@ main(int argc, char **argv) pkgdb_set_dir(optarg, 3); break; - case 'L': - NoView = TRUE; - break; - case 'R': NoRecord = TRUE; break; @@ -150,14 +139,6 @@ main(int argc, char **argv) Verbose = TRUE; break; - case 'W': - Viewbase = optarg; - break; - - case 'w': - View = optarg; - break; - case 'h': case '?': default: @@ -178,7 +159,10 @@ main(int argc, char **argv) free(pkgdbdir); } +#ifndef BOOTSTRAP process_pkg_path(); +#endif + TAILQ_INIT(&pkgs); if (argc == 0) { @@ -187,6 +171,7 @@ main(int argc, char **argv) usage(); } +#ifndef BOOTSTRAP if (strcasecmp(do_license_check, "no") == 0) LicenseCheck = 0; else if (strcasecmp(do_license_check, "yes") == 0) @@ -199,6 +184,7 @@ main(int argc, char **argv) if (LicenseCheck) load_license_lists(); +#endif /* Get all the remaining package names, if any */ for (; argc > 0; --argc, ++argv) { diff --git a/external/bsd/pkg_install/dist/add/perform.c b/external/bsd/pkg_install/dist/add/perform.c index 7a9cbbbc2..f5a0e643a 100644 --- a/external/bsd/pkg_install/dist/add/perform.c +++ b/external/bsd/pkg_install/dist/add/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.4 2013/04/20 15:29:22 wiz Exp $ */ +/* $NetBSD: perform.c,v 1.5 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -6,7 +6,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: perform.c,v 1.4 2013/04/20 15:29:22 wiz Exp $"); +__RCSID("$NetBSD: perform.c,v 1.5 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2003 Grant Beattie @@ -50,6 +50,7 @@ __RCSID("$NetBSD: perform.c,v 1.4 2013/04/20 15:29:22 wiz Exp $"); #if HAVE_FCNTL_H #include #endif +#include #include #include #include @@ -75,7 +76,6 @@ struct pkg_meta { char *meta_install; char *meta_deinstall; char *meta_preserve; - char *meta_views; char *meta_installed_info; }; @@ -121,7 +121,6 @@ static const struct pkg_meta_desc { { offsetof(struct pkg_meta, meta_size_pkg), SIZE_PKG_FNAME, 0, 0444 }, { offsetof(struct pkg_meta, meta_size_all), SIZE_ALL_FNAME, 0, 0444 }, { offsetof(struct pkg_meta, meta_preserve), PRESERVE_FNAME, 0, 0444 }, - { offsetof(struct pkg_meta, meta_views), VIEWS_FNAME, 0, 0444 }, { offsetof(struct pkg_meta, meta_required_by), REQUIRED_BY_FNAME, 0, 0644 }, { offsetof(struct pkg_meta, meta_installed_info), INSTALLED_INFO_FNAME, 0, 0644 }, { 0, NULL, 0, 0 }, @@ -413,9 +412,6 @@ check_already_installed(struct pkg_task *pkg) return 1; } - if (Force) - return 1; - /* We can only arrive here for explicitly requested packages. */ if (!Automatic && is_automatic_installed(pkg->pkgname)) { if (Fake || @@ -832,8 +828,7 @@ extract_files(struct pkg_task *pkg) out: if (!NoRecord) pkgdb_close(); - archive_write_close(writer); - archive_write_finish(writer); + archive_write_free(writer); return r; } @@ -912,7 +907,7 @@ check_platform(struct pkg_task *pkg) if (OverrideMachine != NULL) effective_arch = OverrideMachine; else - effective_arch = MACHINE_ARCH; + effective_arch = PKGSRC_MACHINE_ARCH; /* If either the OS or arch are different, bomb */ if (strcmp(OPSYS_NAME, pkg->buildinfo[BI_OPSYS]) || @@ -1182,30 +1177,6 @@ check_dependencies(struct pkg_task *pkg) return status; } -/* - * If this package uses pkg_views, register it in the default view. - */ -static void -pkg_register_views(struct pkg_task *pkg) -{ - if (Fake || NoView || pkg->meta_data.meta_views == NULL) - return; - - if (Verbose) { - printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n", - BINDIR, pkgdb_get_dir(), - View ? "-w " : "", View ? View : "", - Viewbase ? "-W " : "", Viewbase ? Viewbase : "", - Verbose ? "-v " : "", pkg->pkgname); - } - - fexec_skipempty(BINDIR "/pkg_view", "-d", pkgdb_get_dir(), - View ? "-w " : "", View ? View : "", - Viewbase ? "-W " : "", Viewbase ? Viewbase : "", - Verbose ? "-v " : "", "add", pkg->pkgname, - (void *)NULL); -} - static int preserve_meta_data_file(struct pkg_task *pkg, const char *name) { @@ -1275,6 +1246,9 @@ static int check_input(const char *line, size_t len) static int check_signature(struct pkg_task *pkg, int invalid_sig) { +#ifdef BOOTSTRAP + return 0; +#else char *line; size_t len; @@ -1311,11 +1285,15 @@ check_signature(struct pkg_task *pkg, int invalid_sig) } warnx("Unknown value of configuration variable VERIFIED_INSTALLATION"); return 1; +#endif } static int check_vulnerable(struct pkg_task *pkg) { +#ifdef BOOTSTRAP + return 0; +#else static struct pkg_vulnerabilities *pv; int require_check; char *line; @@ -1354,11 +1332,15 @@ check_vulnerable(struct pkg_task *pkg) return 1; } return 0; +#endif } static int check_license(struct pkg_task *pkg) { +#ifdef BOOTSTRAP + return 0; +#else if (LicenseCheck == 0) return 0; @@ -1382,6 +1364,7 @@ check_license(struct pkg_task *pkg) warnx("Invalid LICENSE for package `%s'", pkg->pkgname); return 1; } +#endif } /* @@ -1404,8 +1387,12 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level) goto clean_find_archive; } +#ifndef BOOTSTRAP invalid_sig = pkg_verify_signature(archive_name, &pkg->archive, &pkg->entry, &pkg->pkgname); +#else + invalid_sig = 0; +#endif free(archive_name); if (pkg->archive == NULL) @@ -1436,12 +1423,7 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level) if (pkg->meta_data.meta_mtree != NULL) warnx("mtree specification in pkg `%s' ignored", pkg->pkgname); - if (pkg->meta_data.meta_views != NULL) { - pkg->logdir = xstrdup(pkg->prefix); - pkgdb_set_dir(dirname_of(pkg->logdir), 4); - } else { - pkg->logdir = xasprintf("%s/%s", config_pkg_dbdir, pkg->pkgname); - } + pkg->logdir = xasprintf("%s/%s", config_pkg_dbdir, pkg->pkgname); if (Destdir != NULL) pkg->install_logdir = xasprintf("%s/%s", Destdir, pkg->logdir); @@ -1542,8 +1524,6 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level) if (pkg->meta_data.meta_display != NULL) fputs(pkg->meta_data.meta_display, stdout); - pkg_register_views(pkg); - status = 0; goto clean_memory; @@ -1559,6 +1539,7 @@ nuke_pkg: nuke_pkgdb: if (!Fake) { + (void) remove_files(pkg->install_logdir, "+*"); if (recursive_remove(pkg->install_logdir, 1)) warn("Couldn't remove %s", pkg->install_logdir); free(pkg->install_logdir_real); @@ -1582,7 +1563,7 @@ clean_memory: free_plist(&pkg->plist); free_meta_data(pkg); if (pkg->archive) - archive_read_finish(pkg->archive); + archive_read_free(pkg->archive); free(pkg->other_version); free(pkg->pkgname); clean_find_archive: diff --git a/external/bsd/pkg_install/dist/add/pkg_add.1 b/external/bsd/pkg_install/dist/add/pkg_add.1 index 26c3f6ded..af3deba2f 100644 --- a/external/bsd/pkg_install/dist/add/pkg_add.1 +++ b/external/bsd/pkg_install/dist/add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_add.1,v 1.1.1.12 2011/02/18 22:32:28 aymeric Exp $ +.\" $NetBSD: pkg_add.1,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -17,7 +17,7 @@ .\" .\" @(#)pkg_add.1 .\" -.Dd June 16, 2010 +.Dd December 27, 2014 .Dt PKG_ADD 1 .Os .Sh NAME @@ -25,14 +25,12 @@ .Nd a utility for installing and upgrading software package distributions .Sh SYNOPSIS .Nm -.Op Fl AfILnRUuVv +.Op Fl AfInRUuVv .Op Fl C Ar config .Op Fl K Ar pkg_dbdir .Op Fl m Ar machine .Op Fl P Ar destdir .Op Fl p Ar prefix -.Op Fl W Ar viewbase -.Op Fl w Ar view .Ar Oo Oo Li ftp|http Oc Ns Li :// Ns Oo Ar user Oc Ns \ Oo Li \&: Ns Ar password Oc \ Ns Li @ Oc Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns \ @@ -142,8 +140,6 @@ Override the value of the .Dv PKG_DBDIR configuration option with the value .Ar pkg_dbdir . -.It Fl L -Don't add the package to any views after installation. .It Fl m Override the machine architecture returned by uname with .Ar machine . @@ -179,14 +175,6 @@ See below for a more detailed description of the process. Print version number and exit. .It Fl v Turn on verbose output. -.It Fl W Ar viewbase -Passed down to -.Xr pkg_view 1 -for managed views. -.It Fl w Ar view -Passed down to -.Xr pkg_view 1 -for managed views. .El .Pp One or more @@ -337,11 +325,6 @@ Any package dependencies are recorded in the other packages' .Pa +REQUIRED_BY file. .It -If the package is a depoted package, then add it to the registered -by calling -.Xr pkg_view 1 -accordingly. -.It Finally, if we were upgrading a package, any .Pa +REQUIRED_BY file that was moved aside before upgrading was started is now moved @@ -386,9 +369,6 @@ are prefixed with See .Xr pkg_install.conf 5 for options, that can also be specified using the environment. -Packages using views are also affected by the environment variables -documented for -.Xr pkg_view 1 . .Sh EXAMPLES In all cases, .Nm diff --git a/external/bsd/pkg_install/dist/admin/audit-packages.8 b/external/bsd/pkg_install/dist/admin/audit-packages.8 index 2a8dbb728..75b044356 100644 --- a/external/bsd/pkg_install/dist/admin/audit-packages.8 +++ b/external/bsd/pkg_install/dist/admin/audit-packages.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: audit-packages.8,v 1.1.1.1 2010/04/23 20:54:06 joerg Exp $ +.\" $NetBSD: audit-packages.8,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. diff --git a/external/bsd/pkg_install/dist/admin/audit.c b/external/bsd/pkg_install/dist/admin/audit.c index 7f4e6a745..7f9a40e25 100644 --- a/external/bsd/pkg_install/dist/admin/audit.c +++ b/external/bsd/pkg_install/dist/admin/audit.c @@ -1,4 +1,4 @@ -/* $NetBSD: audit.c,v 1.1.1.9 2011/02/18 22:32:28 aymeric Exp $ */ +/* $NetBSD: audit.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: audit.c,v 1.1.1.9 2011/02/18 22:32:28 aymeric Exp $"); +__RCSID("$NetBSD: audit.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2008 Joerg Sonnenberger . diff --git a/external/bsd/pkg_install/dist/admin/check.c b/external/bsd/pkg_install/dist/admin/check.c index d9de28687..49f448854 100644 --- a/external/bsd/pkg_install/dist/admin/check.c +++ b/external/bsd/pkg_install/dist/admin/check.c @@ -1,4 +1,4 @@ -/* $NetBSD: check.c,v 1.1.1.4 2010/01/30 21:33:23 joerg Exp $ */ +/* $NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: check.c,v 1.1.1.4 2010/01/30 21:33:23 joerg Exp $"); +__RCSID("$NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 1999-2008 The NetBSD Foundation, Inc. diff --git a/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 b/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 index b475f64f4..6fe93e636 100644 --- a/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 +++ b/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: download-vulnerability-list.8,v 1.1.1.1 2010/04/23 20:54:06 joerg Exp $ +.\" $NetBSD: download-vulnerability-list.8,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. diff --git a/external/bsd/pkg_install/dist/admin/main.c b/external/bsd/pkg_install/dist/admin/main.c index 56a5353c4..547d923a9 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.15 2010/04/23 20:54:07 joerg Exp $ */ +/* $NetBSD: main.c,v 1.2 2017/04/20 13:18:23 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.15 2010/04/23 20:54:07 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 1999-2009 The NetBSD Foundation, Inc. @@ -104,7 +104,6 @@ usage(void) " rebuild-tree - rebuild +REQUIRED_BY files from forward deps\n" " check [pkg ...] - check md5 checksum of installed files\n" " add pkg ... - add pkg files to database\n" - " delete pkg ... - delete file entries for pkg in database\n" " set variable=value pkg ... - set installation variable for package\n" " unset variable pkg ... - unset installation variable for package\n" " lsall /path/to/pkgpattern - list all pkgs matching the pattern\n" @@ -220,15 +219,6 @@ add_pkg(const char *pkgdir, void *vp) return 0; } -static void -delete1pkg(const char *pkgdir) -{ - if (!pkgdb_open(ReadWrite)) - err(EXIT_FAILURE, "cannot open pkgdb"); - (void) pkgdb_remove_pkg(pkgdir); - pkgdb_close(); -} - static void rebuild(void) { @@ -248,7 +238,7 @@ rebuild(void) iterate_pkg_db(add_pkg, &count); printf("\n"); - printf("Stored %" PRIzu " file%s and %zu explicit director%s" + printf("Stored %" PRIzu " file%s and %" PRIzu " explicit director%s" " from %"PRIzu " package%s in %s.\n", count.files, count.files == 1 ? "" : "s", count.directories, count.directories == 1 ? "y" : "ies", @@ -525,12 +515,6 @@ main(int argc, char *argv[]) for (++argv; *argv != NULL; ++argv) add_pkg(*argv, &count); - } else if (strcasecmp(argv[0], "delete") == 0) { - argv++; /* "delete" */ - while (*argv != NULL) { - delete1pkg(*argv); - argv++; - } } else if (strcasecmp(argv[0], "set") == 0) { argv++; /* "set" */ set_unset_variable(argv, FALSE); @@ -624,8 +608,8 @@ main(int argc, char *argv[]) if (pkg_full_signature_check(archive_name, &pkg)) rc = 1; free(archive_name); - if (!pkg) - archive_read_finish(pkg); + if (pkg != NULL) + archive_read_free(pkg); } return rc; } else if (strcasecmp(argv[0], "x509-sign-package") == 0) { diff --git a/external/bsd/pkg_install/dist/admin/pkg_admin.1 b/external/bsd/pkg_install/dist/admin/pkg_admin.1 index 7794af2a2..01c98e971 100644 --- a/external/bsd/pkg_install/dist/admin/pkg_admin.1 +++ b/external/bsd/pkg_install/dist/admin/pkg_admin.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_admin.1,v 1.1.1.12 2013/04/20 15:26:52 wiz Exp $ +.\" $NetBSD: pkg_admin.1,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 1999-2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 14, 2012 +.Dd December 27, 2014 .Dt PKG_ADMIN 1 .Os .Sh NAME @@ -106,13 +106,6 @@ Be more verbose. .Pp The following commands are supported: .Bl -tag -width indent -.It Cm add Ar pkg ... -For each listed package, write the absolute pathnames of the files listed in -its -.Pa +CONTENTS -file together with the package they belong to into the package database. -This should be used only by -.Xr pkg_view 1 . .It Cm audit Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg Oc ... Check the listed installed packages for vulnerabilities. If no package is given, check all installed packages. @@ -187,11 +180,6 @@ otherwise it exits with error. 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. -This should be used only by -.Xr pkg_view 1 . .It Cm dump Dump the contents of the package database, similar to .Cm pkg_info -F . @@ -310,7 +298,6 @@ for options, that can also be specified using the environment. .Xr pkg_create 1 , .Xr pkg_delete 1 , .Xr pkg_info 1 , -.Xr pkg_view 1 , .Xr pkg_install.conf 5 , .Xr pkgsrc 7 .Sh HISTORY diff --git a/external/bsd/pkg_install/dist/bpm/bpm.1 b/external/bsd/pkg_install/dist/bpm/bpm.1 deleted file mode 100644 index 0bffc239c..000000000 --- a/external/bsd/pkg_install/dist/bpm/bpm.1 +++ /dev/null @@ -1,114 +0,0 @@ -.\" $NetBSD: bpm.1,v 1.5 2014/03/18 18:20:36 riastradh Exp $ */ -.\" -.\" Copyright (c) 2003,2009 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Alistair Crooks (agc@NetBSD.org) -.\" -.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. -.\" -.Dd August 3, 2007 -.Dt BPM 1 -.Os -.Sh NAME -.Nm bpm -.Nd menu-based binary package manager -.Sh SYNOPSIS -.Nm -.Op Fl hnVv -.Op Fl b Ar baseURL -.Op Fl m Ar machine -.Op Fl r Ar release -.Op Fl w Ar seconds -.Sh DESCRIPTION -The -.Nm -command is used to locate and install binary packages from any -reachable URL. -.Pp -The following command-line options are supported: -.Bl -tag -width indent -.It Fl b Ar baseURL -Specify a base URL from which to download binary packages. -The default URL is -.Pa ftp://ftp.NetBSD.org/pub/pkgsrc/packages . -.It Fl h -Print a help message and then exit. -.It Fl m Ar machine -Use -.Ar machine -as the machine architecture to be used, instead of that returned by -.Xr uname 1 . -.It Fl n -Don't actually execute the commands to add the package. -.It Fl r Ar release -Use -.Ar release -as the operating system release to be used, instead of that returned by -.Xr uname 1 . -.It Fl V -Print version number and exit. -.It Fl v -Turn on verbose output. -.It Fl w Ar seconds -The number of -.Ar seconds -to wait after displaying an error message and returning to -normal menu operations. -.El -.Pp -.Nm -provides a menu-based binary package manager for -.Nx . -.Nm -first connects to the URL using -.Xr ftp 1 , -and displays a list of categories for which binary packages exist. -If no categories are displayed, it could -be that the machine architecture or operating system release string -have been wrongly interpreted, and that it will be necessary to override -this values by means of the command line options. -Within a category, a list of packages will be displayed, and by selecting -one using the number assigned to it, the package will be downloaded -automatically, and installed, using the -.Xr pkg_add 1 -utility. -It is also possible to change the category currently being examined, -and to quit from the utility, simply by selecting the appropriate choices -on the menu. -.Sh ENVIRONMENT -The environment variables which govern the behavior of -.Xr ftp 1 -and -.Xr pkg_add 1 -are valid for -.Nm . -.Sh SEE ALSO -.Xr ftp 1 , -.Xr pkg_add 1 , -.Xr uname 1 -.Sh AUTHORS -The -.Nm -utility was written by -.An Alistair Crooks Aq Mt agc@NetBSD.org . diff --git a/external/bsd/pkg_install/dist/bpm/bpm.sh.in b/external/bsd/pkg_install/dist/bpm/bpm.sh.in deleted file mode 100644 index 69e4f971d..000000000 --- a/external/bsd/pkg_install/dist/bpm/bpm.sh.in +++ /dev/null @@ -1,220 +0,0 @@ -#! /bin/sh -# -# $NetBSD: bpm.sh.in,v 1.3 2012/02/21 18:36:16 wiz Exp $ -# -# Copyright (c) 2003,2009 The NetBSD Foundation, Inc. -# All rights reserved. -# -# This code is derived from software contributed to The NetBSD Foundation -# by Alistair Crooks (agc@NetBSD.org) -# -# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. -# - -die() -{ - echo >&2 "$@" - exit 1 -} - -check_prog() -{ - _var="$1"; _name="$2" - - eval _tmp=\"\$$_var\" - if [ "x$_tmp" != "x" ]; then - # Variable is already set (by the user, for example) - return 0 - fi - - for _d in `echo $PATH | tr ':' ' '`; do - if [ -x "$_d/$_name" ]; then - # Program found - eval $_var=\""$_d/$_name"\" - return 1 - fi - done - - die "$_name not found in path." -} - -check_prog awkprog awk -check_prog echoprog echo -check_prog ftpprog ftp -check_prog idprog id -check_prog moreprog more -check_prog pkg_addprog pkg_add -check_prog rmprog rm -check_prog sedprog sed -check_prog suprog su -check_prog unameprog uname - -# print version and exit -version() { - $pkg_addprog -V - exit 0 -} - -# temporary files -tmpcategories=/tmp/categories.$$ -tmppackages=/tmp/packages.$$ - -# some base parameters -base=ftp://ftp.NetBSD.org/pub/pkgsrc/packages -release=`${unameprog} -r | ${sedprog} -e 's/_STABLE//'` -machine=`${unameprog} -m` - -sleepsecs=1 - -doit="" - -while [ $# -gt 0 ]; do - case $1 in - -V) version ;; - -b) base=$2; shift ;; - -h) ${echoprog} "$0 [-b BaseURL] [-h] [-m machine] [-n] [-r release] [-v] [-w secs]"; exit 0;; - -m) machine=$2; shift ;; - -n) doit=":" ;; - -r) release=$2; shift ;; - -v) set -x ;; - -w) sleepsecs=$2; shift ;; - *) break ;; - esac - shift -done - -category="" - -while true; do - # if we don't have a packages file, then we need to choose a category - case "$category" in - "") # get possible categories - if [ ! -f $tmpcategories ]; then - ${echoprog} "Downloading package categories from ${base}..." - ${echoprog} "** QUIT" > $tmpcategories - ${echoprog} ls | ${ftpprog} ${base}/${release}/${machine}/ 2>/dev/null | \ - ${awkprog} 'NF == 9 { if ($9 != "All") print $9 }' >> $tmpcategories - fi - - # check for bad release numbering - # - it usually shows with 0 categories being displayed - ${awkprog} 'END { if (NR == 1) { print "\n\n\n*** No categories found - is the OS release set properly? ***\n\n\n" } }' < $tmpcategories - - # display possible categories - ${awkprog} '{ print NR ". " $0 }' < $tmpcategories | ${moreprog} - - # read a category number from the user - ${echoprog} -n "Please type the category number: " - read choice - - # validate user's choice - case "$choice" in - 0|1) ${rmprog} -f $tmpcategories $tmppackages; exit 0 ;; - [2-9]|[0-9]*) category=`${awkprog} 'NR == '$choice' { print }' < $tmpcategories` ;; - *) category="" ;; - esac - case "$category" in - "") ${echoprog} "No such category \"$choice\"" - sleep $sleepsecs - continue - ;; - esac - - # get possible packages - ${echoprog} "" - ${echoprog} "Downloading package names from ${base}/${category}..." - ${echoprog} "** QUIT" > $tmppackages - ${echoprog} "** Change category" >> $tmppackages - ${echoprog} ls | ${ftpprog} ${base}/${release}/${machine}/${category}/ 2>/dev/null \ - | ${awkprog} 'NF == 11 { print $9 }' >> $tmppackages - ;; - esac - - # display possible packages - ${awkprog} '{ print NR ". " $0 }' < $tmppackages | ${moreprog} - - # read a package number from the user - ${echoprog} -n "Please type the package number: " - read choice - - # validate user's choice - case "$choice" in - 1) ${rmprog} -f $tmppackages $tmpcategories; exit 0 ;; - 2) category=""; continue ;; # no package to install - choose new category - [3-9]|[0-9]*) package=`${awkprog} 'NR == '$choice' { print }' < $tmppackages` ;; - *) package="" ;; - esac - case "$package" in - "") ${echoprog} "No such package \"$choice\"" - sleep $sleepsecs - continue - ;; - esac - - # check it's not already installed - pkgbase=`${echoprog} ${package} | ${sedprog} -e 's|-[0-9].*||'` - installed=`pkg_info -e $pkgbase` - case "$installed" in - "") ;; - *) ${echoprog} "$package selected, but $installed already installed" - sleep $sleepsecs - continue - ;; - esac - - # Tell people what we're doing - ${echoprog} "" - ${echoprog} "Adding package ${base}/${release}/${machine}/${category}/${package}" - - cmd="env PKG_PATH=${base}/${release}/${machine}/All ${pkg_addprog} ${package}" - - # check if we need to become root for this - if [ `${idprog} -u` != 0 ]; then - ${echoprog} "Becoming root@`/bin/hostname` to add a binary package" - ${echoprog} -n "`${echoprog} ${suprog} | $awkprog '{ print $1 }'` " - $doit ${suprog} root -c "$cmd" - success=$? - else - $doit $cmd - success=$? - fi - - # give feedback after adding the package - case $success in - 0) ${echoprog} "$package successfully installed" ;; - *) ${echoprog} "Problems when installing $package - please try again" ;; - esac - - ${echoprog} "" - ${echoprog} -n "[Q]uit, [C]hange category, [I]nstall another package: " - read choice - - case "$choice" in - [Qq]) break ;; - [Cc]) category="" ;; - [Ii]) ;; - esac -done - -${rmprog} -f $tmpcategories $tmppackages - -exit 0 diff --git a/external/bsd/pkg_install/dist/create/build.c b/external/bsd/pkg_install/dist/create/build.c index 5ea7b8eff..f0f810ba4 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.8 2010/04/23 20:54:07 joerg Exp $ */ +/* $NetBSD: build.c,v 1.2 2017/04/20 13:18:23 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.8 2010/04/23 20:54:07 joerg Exp $"); +__RCSID("$NetBSD: build.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2007 Joerg Sonnenberger . @@ -93,7 +93,6 @@ static struct memory_file *build_info_file; static struct memory_file *size_pkg_file; static struct memory_file *size_all_file; static struct memory_file *preserve_file; -static struct memory_file *views_file; static void write_meta_file(struct memory_file *file, struct archive *archive) @@ -234,6 +233,7 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) archive = archive_write_new(); archive_write_set_format_pax_restricted(archive); + archive_write_set_options(archive, "hdrcharset=BINARY"); if ((resolver = archive_entry_linkresolver_new()) == NULL) errx(2, "cannot create link resolver"); archive_entry_linkresolver_set_strategy(resolver, @@ -251,20 +251,18 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) } if (strcmp(CompressionType, "bzip2") == 0) - archive_write_set_compression_bzip2(archive); + archive_write_add_filter_bzip2(archive); else if (strcmp(CompressionType, "gzip") == 0) - archive_write_set_compression_gzip(archive); + archive_write_add_filter_gzip(archive); else if (strcmp(CompressionType, "xz") == 0) - archive_write_set_compression_xz(archive); - else if (strcmp(CompressionType, "none") == 0) - archive_write_set_compression_none(archive); - else + archive_write_add_filter_xz(archive); + else if (strcmp(CompressionType, "none") != 0) errx(1, "Unspported compression type for -F: %s", CompressionType); archive_name = xasprintf("%s.%s", pkg, suffix); - if (archive_write_open_file(archive, archive_name)) + if (archive_write_open_filename(archive, archive_name)) errx(2, "cannot create archive: %s", archive_error_string(archive)); free(archive_name); @@ -292,8 +290,6 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) write_meta_file(size_all_file, archive); if (Preserve) write_meta_file(preserve_file, archive); - if (create_views) - write_meta_file(views_file, archive); initial_cwd = getcwd(NULL, 0); @@ -327,9 +323,8 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) archive_entry_linkresolver_free(resolver); - if (archive_write_close(archive)) + if (archive_write_free(archive)) errx(2, "cannot finish archive: %s", archive_error_string(archive)); - archive_write_finish(archive); free(initial_cwd); } @@ -407,8 +402,6 @@ pkg_build(const char *pkg, const char *full_pkg, const char *suffix, preserve_file = load_and_add(plist, Preserve, PRESERVE_FNAME, 0444); } - if (create_views) - views_file = make_and_add(plist, VIEWS_FNAME, xstrdup(""), 0444); /* Finally, write out the packing list */ stringify_plist(plist, &plist_buf, &plist_len, realprefix); diff --git a/external/bsd/pkg_install/dist/create/create.h b/external/bsd/pkg_install/dist/create/create.h index 53b15f9bc..5d18ad5fd 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.5 2009/11/05 18:39:02 joerg Exp $ */ +/* $NetBSD: create.h,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */ @@ -57,8 +57,6 @@ extern char *DefaultGroup; extern const char *CompressionType; extern int PlistOnly; extern int RelativeLinks; -extern int update_pkgdb; -extern int create_views; void check_list(package_t *, const char *); void copy_plist(char *, package_t *); diff --git a/external/bsd/pkg_install/dist/create/main.c b/external/bsd/pkg_install/dist/create/main.c index 325d12ba8..8803651c5 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.7 2010/01/30 21:33:31 joerg Exp $ */ +/* $NetBSD: main.c,v 1.2 2017/04/20 13:18:23 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.7 2010/01/30 21:33:31 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -26,7 +26,8 @@ __RCSID("$NetBSD: main.c,v 1.1.1.7 2010/01/30 21:33:31 joerg Exp $"); #include "lib.h" #include "create.h" -static const char Options[] = "B:C:D:EF:I:K:L:OP:S:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v"; +/* -U is silently ignored, it used to inhibit pkgdb changes. */ +static const char Options[] = "B:C:D:F:I:K:L:OP:S:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v"; char *Prefix = NULL; char *Comment = NULL; @@ -47,8 +48,6 @@ char *DefaultOwner = NULL; char *DefaultGroup = NULL; char *realprefix = NULL; const char *CompressionType = NULL; -int update_pkgdb = 1; -int create_views = 0; int PlistOnly = 0; int RelativeLinks = 0; Boolean File2Pkg = FALSE; @@ -57,7 +56,7 @@ static void usage(void) { fprintf(stderr, - "usage: pkg_create [-ElOUVv] [-B build-info-file] [-b build-version-file]\n" + "usage: pkg_create [-lOUVv] [-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]\n" @@ -81,10 +80,6 @@ main(int argc, char **argv) Verbose = TRUE; break; - case 'E': - create_views = 1; - break; - case 'F': CompressionType = optarg; break; @@ -98,7 +93,6 @@ main(int argc, char **argv) break; case 'U': - update_pkgdb = 0; break; case 'p': @@ -209,7 +203,7 @@ main(int argc, char **argv) return 0; if (Verbose) { if (PlistOnly) - warnx("package registration failed"); + warnx("PLIST adjustment failed"); else warnx("package creation failed"); } diff --git a/external/bsd/pkg_install/dist/create/perform.c b/external/bsd/pkg_install/dist/create/perform.c index f23f66e25..8a39fc3e2 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.5 2009/11/05 18:39:02 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.2 2017/04/20 13:18:23 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.5 2009/11/05 18:39:02 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -225,12 +225,7 @@ pkg_perform(const char *pkg) write_plist(&plist, stdout, realprefix); retval = TRUE; } else { -#ifdef BOOTSTRAP - warnx("Package building is not supported in bootstrap mode"); - retval = FALSE; -#else retval = pkg_build(pkg, full_pkg, suffix, &plist); -#endif } /* Cleanup */ diff --git a/external/bsd/pkg_install/dist/create/pkg_create.1 b/external/bsd/pkg_install/dist/create/pkg_create.1 index 1463152c5..51e168f9f 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.2 2015/10/10 10:08:12 mbalmer Exp $ +.\" $NetBSD: pkg_create.1,v 1.3 2017/04/20 13:18:23 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 October 10, 2015 +.Dd December 27, 2014 .Dt PKG_CREATE 1 .Os .Sh NAME @@ -32,70 +32,28 @@ .Nd a utility for creating software package distributions .Sh SYNOPSIS .Nm -.Op Fl ElOUVv -.Bk -words +.Op Fl lOVv .Op Fl B Ar build-info-file -.Ek -.Bk -words .Op Fl b Ar build-version-file -.Ek -.Bk -words .Op Fl C Ar cpkgs -.Ek -.Bk -words .Op Fl D Ar displayfile -.Ek -.Bk -words .Op Fl F Ar compression -.Ek -.Bk -words .Op Fl g Ar group -.Ek -.Bk -words .Op Fl I Ar realprefix -.Ek -.Bk -words .Op Fl i Ar iscript -.Ek -.Bk -words .Op Fl K Ar pkg_dbdir -.Ek -.Bk -words .Op Fl k Ar dscript -.Ek -.Bk -words .Op Fl n Ar preserve-file -.Ek -.Bk -words .Op Fl P Ar dpkgs -.Ek -.Bk -words -.Op Fl T Ar buildpkgs -.Ek -.Bk -words .Op Fl p Ar prefix -.Ek -.Bk -words .Op Fl S Ar size-all-file -.Ek -.Bk -words .Op Fl s Ar size-pkg-file -.Ek -.Bk -words +.Op Fl T Ar buildpkgs .Op Fl t Ar template -.Ek -.Bk -words .Op Fl u Ar owner -.Ek -.Bk -words .Fl c Ar comment -.Ek -.Bk -words .Fl d Ar description -.Ek -.Bk -words .Fl f Ar packlist -.Ek .Ar pkg-name .Sh DESCRIPTION The @@ -158,8 +116,6 @@ Fetch long description for package from file or, if preceded by .Cm - , the argument itself. -.It Fl E -Add an empty views file to the package. .It Fl F Ar compression Use .Ar compression @@ -287,8 +243,6 @@ Be sure to leave some number of characters for .Xr mktemp 3 to fill in with a unique ID. -.It Fl U -Do not update the package file database with any file information. .It Fl u Ar owner Make .Ar owner @@ -494,12 +448,11 @@ command first appeared in .Sh AUTHORS .Bl -tag -width indent -compact .It Jordan Hubbard -did most of the work. +most of the work .It John Kohl refined it for -.Nx . +.Nx .It Hubert Feyrer -added .Nx wildcard dependency processing, pkgdb, pkg size recording etc. .El diff --git a/external/bsd/pkg_install/dist/create/pl.c b/external/bsd/pkg_install/dist/create/pl.c index 7aa0f2811..40926703b 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.4 2009/11/05 18:39:03 joerg Exp $ */ +/* $NetBSD: pl.c,v 1.2 2017/04/20 13:18:23 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.4 2009/11/05 18:39:03 joerg Exp $"); +__RCSID("$NetBSD: pl.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -89,10 +89,6 @@ check_list(package_t *pkg, const char *PkgName) char *pkgname = NULL; int cc; - /* Open Package Database for writing */ - if (update_pkgdb && !pkgdb_open(ReadWrite)) - err(EXIT_FAILURE, "can't open pkgdb"); - for (p = pkg->head; p; p = p->next) { switch (p->type) { case PLIST_CWD: @@ -109,38 +105,10 @@ check_list(package_t *pkg, const char *PkgName) errx(2, "@pkgdir without preceding @cwd found"); if (pkgname == NULL) errx(2, "@pkgdir without preceding @name found"); - if (update_pkgdb) { - add_pkgdir(pkgname, cwd, p->name); - /* mkdir_p(cwd, p->name); */ - } break; case PLIST_FILE: - /* - * pkgdb handling - usually, we enter files - * into the pkgdb as soon as they hit the disk, - * but as they are present before pkg_create - * starts, it's ok to do this somewhere here - */ if (cwd == NULL) errx(2, "file without preceding @cwd found"); - if (update_pkgdb) { - char *s, t[MaxPathSize]; - - (void) snprintf(t, sizeof(t), "%s%s%s", - cwd, - (strcmp(cwd, "/") == 0) ? "" : "/", - p->name); - - s = pkgdb_retrieve(t); - if (s && PlistOnly) - warnx("Overwriting %s - " - "pkg %s bogus/conflicting?", t, s); - else { - pkgdb_store(t, PkgName); - } - } - - /* prepend DESTDIR if set? - HF */ (void) snprintf(name, sizeof(name), "%s%s%s", cwd, (strcmp(cwd, "/") == 0) ? "" : "/", @@ -204,8 +172,4 @@ check_list(package_t *pkg, const char *PkgName) break; } } - - if (update_pkgdb) { - pkgdb_close(); - } } diff --git a/external/bsd/pkg_install/dist/create/util.c b/external/bsd/pkg_install/dist/create/util.c index d17b1fed7..88d470cff 100644 --- a/external/bsd/pkg_install/dist/create/util.c +++ b/external/bsd/pkg_install/dist/create/util.c @@ -39,27 +39,18 @@ #if HAVE_ERR_H #include #endif +#include #if HAVE_PWD_H #include #endif +#include #if HAVE_PWD_H #include #endif -#if HAVE_STDLIB_H #include -#endif -#if HAVE_STRING_H #include -#endif -#if HAVE_TIME_H #include -#endif -#if HAVE_UNISTD_H #include -#endif -#if HAVE_FCNTL_H -#include -#endif #include "lib.h" #include "create.h" diff --git a/external/bsd/pkg_install/dist/delete/pkg_delete.1 b/external/bsd/pkg_install/dist/delete/pkg_delete.1 index 2ee40c4c8..f26f48c88 100644 --- a/external/bsd/pkg_install/dist/delete/pkg_delete.1 +++ b/external/bsd/pkg_install/dist/delete/pkg_delete.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_delete.1,v 1.1.1.8 2010/04/23 20:54:08 joerg Exp $ +.\" $NetBSD: pkg_delete.1,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -17,7 +17,7 @@ .\" .\" from FreeBSD: @(#)pkg_delete.1 .\" -.Dd January 20, 2010 +.Dd December 27, 2014 .Dt PKG_DELETE 1 .Os .Sh NAME @@ -221,12 +221,6 @@ script is called as: .Bd -filled -offset indent -compact .Cm deinstall .Aq Ar pkg-name -.Ar VIEW-DEINSTALL -.Ed -before removing the package from a view, and as: -.Bd -filled -offset indent -compact -.Cm deinstall -.Aq Ar pkg-name .Ar DEINSTALL .Ed before deleting all files and as: @@ -237,8 +231,7 @@ before deleting all files and as: .Ed after deleting them. Passing the keywords -.Ar VIEW-DEINSTALL , -.Ar DEINSTALL , +.Ar DEINSTALL and .Ar POST-DEINSTALL lets you potentially write only one program/script that handles all diff --git a/external/bsd/pkg_install/dist/delete/pkg_delete.c b/external/bsd/pkg_install/dist/delete/pkg_delete.c index 9c0fc38f7..fe487a1df 100644 --- a/external/bsd/pkg_install/dist/delete/pkg_delete.c +++ b/external/bsd/pkg_install/dist/delete/pkg_delete.c @@ -34,7 +34,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: pkg_delete.c,v 1.1.1.8 2012/02/19 17:46:46 tron Exp $"); +__RCSID("$NetBSD: pkg_delete.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_ERR_H #include @@ -397,59 +397,15 @@ find_preserve_pkgs(lpkg_head_t *pkgs) return 0; } -/* - * Remove package from view. This is calling pkg_deinstall again. - */ -static int -remove_pkg_from_view(const char *pkg) -{ - char line[MaxPathSize], *fname, *eol; - FILE *fp; - - fname = pkgdb_pkg_file(pkg, VIEWS_FNAME); - if (isemptyfile(fname)) { - free(fname); - return 0; - } - if ((fp = fopen(fname, "r")) == NULL) { - warn("Unable to open `%s', aborting", fname); - free(fname); - return 1; - } - free(fname); - while (fgets(line, sizeof(line), fp) != NULL) { - if ((eol = strrchr(line, '\n')) != NULL) - *eol = '\0'; - if (Verbose || Fake) - printf("Deleting package `%s' instance from `%s' view\n", - pkg, line); - if (Fake) - continue; - if (fexec_skipempty(BINDIR "/pkg_delete", "-K", line, - Fake ? "-n" : "", - (Force > 1) ? "-f" : "", - (Force > 0) ? "-f" : "", - pkg, NULL) != 0) { - warnx("Unable to delete package `%s' from view `%s'", - pkg, line); - fclose(fp); - return 1; - } - } - fclose(fp); - return 0; -} - /* * Run the +DEINSTALL script. Depending on whether this is - * a depoted package and whether this pre- or post-deinstall phase, - * different arguments are passed down. + * pre- or post-deinstall phase, different arguments are passed down. */ static int run_deinstall_script(const char *pkg, int do_postdeinstall) { const char *target, *text; - char *fname, *fname2, *pkgdir; + char *fname, *pkgdir; int rv; fname = pkgdb_pkg_file(pkg, DEINSTALL_FNAME); @@ -458,23 +414,13 @@ run_deinstall_script(const char *pkg, int do_postdeinstall) return 0; } - fname2 = pkgdb_pkg_file(pkg, DEPOT_FNAME); - if (fexists(fname2)) { - if (do_postdeinstall) { - free(fname); - free(fname2); - return 0; - } - target = "VIEW-DEINSTALL"; - text = "view deinstall"; - } else if (do_postdeinstall) { + if (do_postdeinstall) { target = "POST-DEINSTALL"; text = "post-deinstall"; } else { target = "DEINSTALL"; text = "deinstall"; } - free(fname2); if (Fake) { printf("Would execute %s script with argument %s now\n", @@ -540,57 +486,6 @@ remove_line(const char *fname, const char *fname_tmp, const char *text) return rv; } -/* - * Unregister the package from the depot it is registered in. - */ -static int -remove_pkg_from_depot(const char *pkg) -{ - FILE *fp; - char line[MaxPathSize], *eol; - char *fname, *fname2; - int rv; - - fname = pkgdb_pkg_file(pkg, DEPOT_FNAME); - if (isemptyfile(fname)) { - free(fname); - return 0; - } - - if (Verbose) - printf("Attempting to remove the `%s' registration " - "on package `%s'\n", fname, pkg); - - if (Fake) { - free(fname); - return 1; - } - - if ((fp = fopen(fname, "r")) == NULL) { - warn("Unable to open `%s' file", fname); - free(fname); - return 1; - } - if (fgets(line, sizeof(line), fp) == NULL) { - fclose(fp); - warnx("Empty depot file `%s'", fname); - free(fname); - return 1; - } - if ((eol = strrchr(line, '\n')) != NULL) - *eol = '\0'; - fclose(fp); - free(fname); - - fname = pkgdb_pkg_file(pkg, VIEWS_FNAME); - fname2 = pkgdb_pkg_file(pkg, VIEWS_FNAME_TMP); - rv = remove_line(fname, fname2, line); - free(fname2); - free(fname); - - return rv; -} - /* * remove_depend is used as iterator function below. * The passed-in package name should be removed from the @@ -627,7 +522,7 @@ remove_pkg(const char *pkg) char *fname, *pkgdir; package_t plist; plist_t *p; - int is_depoted_pkg, rv, late_error; + int rv, late_error; if (pkgdb_update_only) return pkgdb_remove_pkg(pkg) ? 0 : 1; @@ -640,15 +535,6 @@ remove_pkg(const char *pkg) } free(fname); - /* +REQUIRED_BY and +PRESERVE already checked */ - if (remove_pkg_from_view(pkg)) - return 1; - - /* - * The views related code has bad error handling, if e.g. - * the deinstall script fails, the package remains unregistered. - */ - fname = pkgdb_pkg_file(pkg, CONTENTS_FNAME); if ((fp = fopen(fname, "r")) == NULL) { warnx("Failed to open `%s'", fname); @@ -712,37 +598,23 @@ remove_pkg(const char *pkg) * processing. */ - fname = pkgdb_pkg_file(pkg, DEPOT_FNAME); - if (fexists(fname)) { - late_error |= remove_pkg_from_depot(pkg); - /* XXX error checking */ - } else { - for (p = plist.head; p; p = p->next) { - if (p->type != PLIST_PKGDEP) - continue; - if (Verbose) - printf("Attempting to remove dependency " - "on package `%s'\n", p->name); - if (Fake) - continue; - match_installed_pkgs(p->name, remove_depend, - __UNCONST(pkg)); - } + for (p = plist.head; p; p = p->next) { + if (p->type != PLIST_PKGDEP) + continue; + if (Verbose) + printf("Attempting to remove dependency " + "on package `%s'\n", p->name); + if (Fake) + continue; + match_installed_pkgs(p->name, remove_depend, + __UNCONST(pkg)); } - free(fname); free_plist(&plist); if (!no_deinstall && !unregister_only) late_error |= run_deinstall_script(pkg, 1); - fname = pkgdb_pkg_file(pkg, VIEWS_FNAME); - if (fexists(fname)) - is_depoted_pkg = TRUE; - else - is_depoted_pkg = FALSE; - free(fname); - if (Fake) return 0; @@ -755,8 +627,6 @@ remove_pkg(const char *pkg) rv = 1; if (isemptydir(pkgdir)&& rmdir(pkgdir) == 0) rv = 0; - else if (is_depoted_pkg) - warnx("Depot directory `%s' is not empty", pkgdir); else if (!Force) warnx("Couldn't remove package directory in `%s'", pkgdir); else if (recursive_remove(pkgdir, 1)) diff --git a/external/bsd/pkg_install/dist/info/info.h b/external/bsd/pkg_install/dist/info/info.h index f6b967019..142ad0f7a 100644 --- a/external/bsd/pkg_install/dist/info/info.h +++ b/external/bsd/pkg_install/dist/info/info.h @@ -1,4 +1,4 @@ -/* $NetBSD: info.h,v 1.1.1.5 2009/10/07 13:19:42 joerg Exp $ */ +/* $NetBSD: info.h,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */ @@ -68,7 +68,6 @@ struct pkg_meta { char *meta_install; char *meta_deinstall; char *meta_preserve; - char *meta_views; char *meta_installed_info; int is_installed; }; diff --git a/external/bsd/pkg_install/dist/info/main.c b/external/bsd/pkg_install/dist/info/main.c index d443eb826..59613b7d9 100644 --- a/external/bsd/pkg_install/dist/info/main.c +++ b/external/bsd/pkg_install/dist/info/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.9 2013/04/20 15:26:53 wiz Exp $ */ +/* $NetBSD: main.c,v 1.2 2017/04/20 13:18:23 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.9 2013/04/20 15:26:53 wiz Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * diff --git a/external/bsd/pkg_install/dist/info/perform.c b/external/bsd/pkg_install/dist/info/perform.c index 9d8555a41..4fbbe50d8 100644 --- a/external/bsd/pkg_install/dist/info/perform.c +++ b/external/bsd/pkg_install/dist/info/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,13 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -#if HAVE_SYS_QUEUE_H -#include -#endif -#if HAVE_SYS_WAIT_H -#include -#endif -__RCSID("$NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2008 Joerg Sonnenberger . @@ -73,6 +67,12 @@ __RCSID("$NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $"); #if HAVE_SYS_STAT_H #include #endif +#if HAVE_SYS_QUEUE_H +#include +#endif +#if HAVE_SYS_WAIT_H +#include +#endif #ifndef BOOTSTRAP #include @@ -81,22 +81,13 @@ __RCSID("$NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $"); #if HAVE_ERR_H #include #endif -#if HAVE_ERRNO_H -#include -#endif -#if HAVE_FCNTL_H -#include -#endif -#if HAVE_SIGNAL_H -#include -#endif -#if HAVE_DIRENT_H -#include -#endif -#if HAVE_CTYPE_H #include -#endif +#include +#include +#include +#include #include +#include #define LOAD_CONTENTS (1 << 0) #define LOAD_COMMENT (1 << 1) @@ -110,9 +101,8 @@ __RCSID("$NetBSD: perform.c,v 1.1.1.13 2010/02/20 04:41:55 joerg Exp $"); #define LOAD_SIZE_PKG (1 << 9) #define LOAD_SIZE_ALL (1 << 10) #define LOAD_PRESERVE (1 << 11) -#define LOAD_VIEWS (1 << 12) -#define LOAD_REQUIRED_BY (1 << 13) -#define LOAD_INSTALLED_INFO (1 << 14) +#define LOAD_REQUIRED_BY (1 << 12) +#define LOAD_INSTALLED_INFO (1 << 13) static const struct pkg_meta_desc { size_t entry_offset; @@ -144,8 +134,6 @@ static const struct pkg_meta_desc { LOAD_SIZE_ALL, 0 }, { offsetof(struct pkg_meta, meta_preserve), PRESERVE_FNAME, LOAD_PRESERVE, 0 }, - { offsetof(struct pkg_meta, meta_views), VIEWS_FNAME, - LOAD_VIEWS, 0 }, { offsetof(struct pkg_meta, meta_required_by), REQUIRED_BY_FNAME, LOAD_REQUIRED_BY, 0 }, { offsetof(struct pkg_meta, meta_installed_info), INSTALLED_INFO_FNAME, @@ -361,7 +349,7 @@ pkg_do(const char *pkg) free(pkgname); meta = read_meta_data_from_archive(archive, entry); - archive_read_finish(archive); + archive_read_free(archive); if (!IS_URL(pkg)) binpkgfile = pkg; #endif diff --git a/external/bsd/pkg_install/dist/info/pkg_info.1 b/external/bsd/pkg_install/dist/info/pkg_info.1 index 786b0608c..08733f5a9 100644 --- a/external/bsd/pkg_install/dist/info/pkg_info.1 +++ b/external/bsd/pkg_install/dist/info/pkg_info.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_info.1,v 1.2 2015/04/28 09:48:30 prlw1 Exp $ +.\" $NetBSD: pkg_info.1,v 1.3 2017/04/20 13:18:23 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -17,7 +17,7 @@ .\" .\" @(#)pkg_info.1 .\" -.Dd December 14, 2012 +.Dd January 11, 2015 .Dt PKG_INFO 1 .Os .Sh NAME @@ -226,7 +226,7 @@ The filename is resolved to a package name using the package database. The filename must be absolute, as in the output of .Dl pkg_info -aF . For example, -.Dl pkg_info -eF /path/to/file +.Dl pkg_info -Fe /path/to/file can be used to display the package the given file belongs to, and .Dl pkg_info -LF /path/to/file can be used to display all files belonging to the package the given diff --git a/external/bsd/pkg_install/dist/info/show.c b/external/bsd/pkg_install/dist/info/show.c index 1b8d29e33..b5b2ef645 100644 --- a/external/bsd/pkg_install/dist/info/show.c +++ b/external/bsd/pkg_install/dist/info/show.c @@ -1,4 +1,4 @@ -/* $NetBSD: show.c,v 1.3 2012/02/21 18:36:16 wiz Exp $ */ +/* $NetBSD: show.c,v 1.4 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: show.c,v 1.3 2012/02/21 18:36:16 wiz Exp $"); +__RCSID("$NetBSD: show.c,v 1.4 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/automatic.c b/external/bsd/pkg_install/dist/lib/automatic.c index 5af338c64..7cc2b8e8c 100644 --- a/external/bsd/pkg_install/dist/lib/automatic.c +++ b/external/bsd/pkg_install/dist/lib/automatic.c @@ -1,4 +1,4 @@ -/* $NetBSD: automatic.c,v 1.1.1.2 2009/02/02 20:44:05 joerg Exp $ */ +/* $NetBSD: automatic.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: automatic.c,v 1.1.1.2 2009/02/02 20:44:05 joerg Exp $"); +__RCSID("$NetBSD: automatic.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_ASSERT_H #include diff --git a/external/bsd/pkg_install/dist/lib/config.h.in b/external/bsd/pkg_install/dist/lib/config.h.in index 2c57ea336..1862c5768 100644 --- a/external/bsd/pkg_install/dist/lib/config.h.in +++ b/external/bsd/pkg_install/dist/lib/config.h.in @@ -15,8 +15,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ERR_H -/* Define to 1 if you have the header file. */ -#undef HAVE_FNCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FNMATCH_H @@ -72,9 +72,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_QUEUE_H @@ -147,6 +144,17 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ diff --git a/external/bsd/pkg_install/dist/lib/conflicts.c b/external/bsd/pkg_install/dist/lib/conflicts.c index 0ca0544b9..79d0913b0 100644 --- a/external/bsd/pkg_install/dist/lib/conflicts.c +++ b/external/bsd/pkg_install/dist/lib/conflicts.c @@ -1,4 +1,4 @@ -/* $NetBSD: conflicts.c,v 1.1.1.4 2010/01/30 21:33:43 joerg Exp $ */ +/* $NetBSD: conflicts.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2007 Roland Illig . @@ -48,7 +48,7 @@ #include #endif -__RCSID("$NetBSD: conflicts.c,v 1.1.1.4 2010/01/30 21:33:43 joerg Exp $"); +__RCSID("$NetBSD: conflicts.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_ERR_H #include diff --git a/external/bsd/pkg_install/dist/lib/defs.h b/external/bsd/pkg_install/dist/lib/defs.h index 96fa75fb1..fa813c9da 100644 --- a/external/bsd/pkg_install/dist/lib/defs.h +++ b/external/bsd/pkg_install/dist/lib/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.3 2012/02/21 18:36:17 wiz Exp $ */ +/* $NetBSD: defs.h,v 1.5 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 1999,2000,2009 The NetBSD Foundation, Inc. @@ -38,6 +38,9 @@ #if HAVE_ERR_H #include #endif +#if HAVE_INTTYPES_H +#include +#endif #if HAVE_STDLIB_H #include #endif diff --git a/external/bsd/pkg_install/dist/lib/dewey.c b/external/bsd/pkg_install/dist/lib/dewey.c index 8aafd0ab7..201811d15 100644 --- a/external/bsd/pkg_install/dist/lib/dewey.c +++ b/external/bsd/pkg_install/dist/lib/dewey.c @@ -1,4 +1,4 @@ -/* $NetBSD: dewey.c,v 1.3 2009/03/08 14:53:16 joerg Exp $ */ +/* $NetBSD: dewey.c,v 1.4 2017/04/20 13:18:23 joerg Exp $ */ /* * Copyright © 2002 Alistair G. Crooks. All rights reserved. diff --git a/external/bsd/pkg_install/dist/lib/dewey.h b/external/bsd/pkg_install/dist/lib/dewey.h index a8a628e39..124d0f14f 100644 --- a/external/bsd/pkg_install/dist/lib/dewey.h +++ b/external/bsd/pkg_install/dist/lib/dewey.h @@ -1,4 +1,4 @@ -/* $NetBSD: dewey.h,v 1.1.1.1 2008/09/30 19:00:27 joerg Exp $ */ +/* $NetBSD: dewey.h,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #ifndef _INST_LIB_DEWEY_H_ #define _INST_LIB_DEWEY_H_ diff --git a/external/bsd/pkg_install/dist/lib/fexec.c b/external/bsd/pkg_install/dist/lib/fexec.c index af44eed2b..ca2e7cef3 100644 --- a/external/bsd/pkg_install/dist/lib/fexec.c +++ b/external/bsd/pkg_install/dist/lib/fexec.c @@ -1,4 +1,4 @@ -/* $NetBSD: fexec.c,v 1.1.1.3 2009/08/06 16:55:26 joerg Exp $ */ +/* $NetBSD: fexec.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include "lib.h" -__RCSID("$NetBSD: fexec.c,v 1.1.1.3 2009/08/06 16:55:26 joerg Exp $"); +__RCSID("$NetBSD: fexec.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); static int vfcexec(const char *, int, const char *, va_list); diff --git a/external/bsd/pkg_install/dist/lib/file.c b/external/bsd/pkg_install/dist/lib/file.c index a16f0374b..dac0ca708 100644 --- a/external/bsd/pkg_install/dist/lib/file.c +++ b/external/bsd/pkg_install/dist/lib/file.c @@ -1,4 +1,4 @@ -/* $NetBSD: file.c,v 1.1.1.6 2011/02/18 22:32:30 aymeric Exp $ */ +/* $NetBSD: file.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,13 +7,10 @@ #if HAVE_SYS_CDEFS_H #include #endif -#if HAVE_SYS_PARAM_H -#include -#endif #if HAVE_SYS_QUEUE_H #include #endif -__RCSID("$NetBSD: file.c,v 1.1.1.6 2011/02/18 22:32:30 aymeric Exp $"); +__RCSID("$NetBSD: file.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/global.c b/external/bsd/pkg_install/dist/lib/global.c index 27cd4f334..0da212ce5 100644 --- a/external/bsd/pkg_install/dist/lib/global.c +++ b/external/bsd/pkg_install/dist/lib/global.c @@ -1,4 +1,4 @@ -/* $NetBSD: global.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $ */ +/* $NetBSD: global.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: global.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $"); +__RCSID("$NetBSD: global.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/gpgsig.c b/external/bsd/pkg_install/dist/lib/gpgsig.c index 8091d4a12..3d236d622 100644 --- a/external/bsd/pkg_install/dist/lib/gpgsig.c +++ b/external/bsd/pkg_install/dist/lib/gpgsig.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpgsig.c,v 1.1.1.2 2009/08/06 16:55:27 joerg Exp $ */ +/* $NetBSD: gpgsig.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -7,7 +7,7 @@ #include #endif -__RCSID("$NetBSD: gpgsig.c,v 1.1.1.2 2009/08/06 16:55:27 joerg Exp $"); +__RCSID("$NetBSD: gpgsig.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2008 Joerg Sonnenberger . @@ -50,106 +50,48 @@ __RCSID("$NetBSD: gpgsig.c,v 1.1.1.2 2009/08/06 16:55:27 joerg Exp $"); #include #endif +#include + #include "lib.h" -static void -verify_signature(const char *input, size_t input_len, const char *keyring, - const char *detached_signature) -{ - const char *argv[8], **argvp; - pid_t child; - int fd[2], status; - - if (pipe(fd) == -1) - err(EXIT_FAILURE, "cannot create input pipes"); - - child = vfork(); - if (child == -1) - err(EXIT_FAILURE, "cannot fork GPG process"); - if (child == 0) { - close(fd[1]); - close(STDIN_FILENO); - if (dup2(fd[0], STDIN_FILENO) == -1) { - static const char err_msg[] = - "cannot redirect stdin of GPG process\n"; - write(STDERR_FILENO, err_msg, sizeof(err_msg) - 1); - _exit(255); - } - close(fd[0]); - argvp = argv; - *argvp++ = gpg_cmd; - *argvp++ = "--verify"; - if (keyring != NULL) { - *argvp++ = "--no-default-keyring"; - *argvp++ = "--keyring"; - *argvp++ = keyring; - } - - if (detached_signature != NULL) - *argvp++ = detached_signature; - *argvp++ = "-"; - - *argvp = NULL; - - execvp(gpg_cmd, __UNCONST(argv)); - _exit(255); - } - close(fd[0]); - if (write(fd[1], input, input_len) != (ssize_t)input_len) - errx(EXIT_FAILURE, "Short read from GPG"); - close(fd[1]); - waitpid(child, &status, 0); - if (status) - errx(EXIT_FAILURE, "GPG could not verify the signature"); -} - int -inline_gpg_verify(const char *content, size_t len, const char *keyring) +gpg_verify(const char *content, size_t len, const char *keyring, + const char *sig, size_t sig_len) { - verify_signature(content, len, keyring, NULL); + pgpv_t *pgp; + pgpv_cursor_t *cursor; + static const char hdr1[] = "-----BEGIN PGP SIGNED MESSAGE-----\n"; + static const char hdr2[] = "Hash: SHA512\n\n"; + ssize_t buflen; + char *allocated_buf; + const char *buf; - return 0; -} - -int -detached_gpg_verify(const char *content, size_t len, - const char *signature, size_t signature_len, const char *keyring) -{ - int fd; - const char *tmpdir; - char *tempsig; - ssize_t ret; - - if (gpg_cmd == NULL) { - warnx("GPG variable not set, failing signature check"); - return -1; + /* + * If there is a detached signature we need to construct a format that + * netpgp can parse, otherwise use as-is. + */ + if (sig_len) { + buf = allocated_buf = xasprintf("%s%s%s%s", hdr1, hdr2, content, sig); + buflen = strlen(buf); + } else { + buf = content; + allocated_buf = NULL; + buflen = len; } - if ((tmpdir = getenv("TMPDIR")) == NULL) - tmpdir = "/tmp"; - tempsig = xasprintf("%s/pkg_install.XXXXXX", tmpdir); + pgp = pgpv_new(); + cursor = pgpv_new_cursor(); - fd = mkstemp(tempsig); - if (fd == -1) { - warnx("Creating temporary file for GPG signature failed"); - return -1; - } + if (!pgpv_read_pubring(pgp, keyring, -1)) + err(EXIT_FAILURE, "cannot read keyring"); - while (signature_len) { - ret = write(fd, signature, signature_len); - if (ret == -1) - err(EXIT_FAILURE, "Write to GPG failed"); - if (ret == 0) - errx(EXIT_FAILURE, "Short write to GPG"); - signature_len -= ret; - signature += ret; - } + if (!pgpv_verify(cursor, pgp, buf, buflen)) + errx(EXIT_FAILURE, "unable to verify signature: %s", + pgpv_get_cursor_str(cursor, "why")); - verify_signature(content, len, keyring, tempsig); + pgpv_close(pgp); - unlink(tempsig); - close(fd); - free(tempsig); + free(allocated_buf); return 0; } diff --git a/external/bsd/pkg_install/dist/lib/iterate.c b/external/bsd/pkg_install/dist/lib/iterate.c index 080dbf760..eb79a8740 100644 --- a/external/bsd/pkg_install/dist/lib/iterate.c +++ b/external/bsd/pkg_install/dist/lib/iterate.c @@ -1,4 +1,4 @@ -/* $NetBSD: iterate.c,v 1.1.1.4 2010/01/30 21:33:47 joerg Exp $ */ +/* $NetBSD: iterate.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger . diff --git a/external/bsd/pkg_install/dist/lib/lib.h b/external/bsd/pkg_install/dist/lib/lib.h index d7d07e5d8..38960e56e 100644 --- a/external/bsd/pkg_install/dist/lib/lib.h +++ b/external/bsd/pkg_install/dist/lib/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.7 2014/01/07 02:15:27 joerg Exp $ */ +/* $NetBSD: lib.h,v 1.8 2017/04/20 13:18:23 joerg Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -29,9 +29,6 @@ #include "config.h" #endif #include -#if HAVE_SYS_PARAM_H -#include -#endif #if HAVE_SYS_STAT_H #include #endif @@ -116,9 +113,6 @@ enum { #define SIZE_PKG_FNAME "+SIZE_PKG" #define SIZE_ALL_FNAME "+SIZE_ALL" #define PRESERVE_FNAME "+PRESERVE" -#define VIEWS_FNAME "+VIEWS" -#define VIEWS_FNAME_TMP "+VIEWS.tmp" -#define DEPOT_FNAME "+DEPOT" /* The names of special variables */ #define AUTOMATIC_VARNAME "automatic" @@ -322,6 +316,7 @@ int has_pkgdir(const char *); struct archive; struct archive_entry; +struct archive *prepare_archive(void); struct archive *open_archive(const char *, char **); struct archive *find_archive(const char *, int, char **); void process_pkg_path(void); @@ -363,7 +358,6 @@ const char *pkgdb_get_dir(void); * 1 config file * 2 environment * 3 command line - * 4 destdir/views reset */ void pkgdb_set_dir(const char *, int); char *pkgdb_pkg_dir(const char *); @@ -404,9 +398,7 @@ int easy_pkcs7_sign(const char *, size_t, char **, size_t *, const char *, const char *); #endif -int inline_gpg_verify(const char *, size_t, const char *); -int detached_gpg_verify(const char *, size_t, const char *, size_t, - const char *); +int gpg_verify(const char *, size_t, const char *, const char *, size_t); int detached_gpg_sign(const char *, size_t, char **, size_t *, const char *, const char *); @@ -421,7 +413,12 @@ char *xstrdup(const char *); void *xrealloc(void *, size_t); void *xcalloc(size_t, size_t); void *xmalloc(size_t); -char *xasprintf(const char *, ...) __printflike(1, 2); +#if defined(__GNUC__) && __GNUC__ >= 2 +char *xasprintf(const char *, ...) + __attribute__((__format__(__printf__, 1, 2))); +#else +char *xasprintf(const char *, ...); +#endif /* Externs */ extern Boolean Verbose; diff --git a/external/bsd/pkg_install/dist/lib/license.c b/external/bsd/pkg_install/dist/lib/license.c index 6af3b1040..cbf1327bc 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.4 2013/04/20 15:29:23 wiz Exp $ */ +/* $NetBSD: license.c,v 1.5 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger . @@ -51,35 +51,48 @@ const char *default_acceptable_licenses = "artistic artistic-2.0 " "boost-license " "cc-by-sa-v3.0 " + "cc0-1.0-universal " "cddl-1.0 " + "cecill-2.1 " "cpl-1.0 " "epl-v1.0 " + "eupl-v1.1 " + "gfsl " "gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 " "gnu-gpl-v1 " "gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 " "gnu-gpl-v3 gnu-lgpl-v3 " - "ibm-public-license-1.0 " + "hpnd " + "info-zip " "ipafont " + "ipl-1.0 " "isc " - "lppl-1.3c " + "lppl-1.0 lppl-1.2 lppl-1.3c " "lucent " "miros " "mit " "mpl-1.0 mpl-1.1 mpl-2.0 " "mplusfont " "ofl-v1.0 ofl-v1.1 " + "openssl " "original-bsd modified-bsd 2-clause-bsd " + "paratype " "php " "png-license " "postgresql-license " "public-domain " "python-software-foundation " "qpl-v1.0 " + "sgi-free-software-b-v2.0 " + "sissl-1.1 " "sleepycat-public " + "unicode " "unlicense " + "vera-ttf-license " + "w3c " "x11 " "zlib " - "zpl"; + "zpl-2.0 zpl-2.1"; #ifdef DEBUG static size_t hash_collisions; diff --git a/external/bsd/pkg_install/dist/lib/lpkg.c b/external/bsd/pkg_install/dist/lib/lpkg.c index aacdc2f89..d28853f4f 100644 --- a/external/bsd/pkg_install/dist/lib/lpkg.c +++ b/external/bsd/pkg_install/dist/lib/lpkg.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpkg.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $ */ +/* $NetBSD: lpkg.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /* * Copyright (c) 1999 Christian E. Hopps diff --git a/external/bsd/pkg_install/dist/lib/opattern.c b/external/bsd/pkg_install/dist/lib/opattern.c index 80960338f..95c82ee72 100644 --- a/external/bsd/pkg_install/dist/lib/opattern.c +++ b/external/bsd/pkg_install/dist/lib/opattern.c @@ -1,4 +1,4 @@ -/* $NetBSD: opattern.c,v 1.1.1.3 2012/02/19 17:46:47 tron Exp $ */ +/* $NetBSD: opattern.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: opattern.c,v 1.1.1.3 2012/02/19 17:46:47 tron Exp $"); +__RCSID("$NetBSD: opattern.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/parse-config.c b/external/bsd/pkg_install/dist/lib/parse-config.c index d7664439c..50496db49 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.11 2010/06/26 00:14:31 joerg Exp $ */ +/* $NetBSD: parse-config.c,v 1.2 2017/04/20 13:18:23 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.11 2010/06/26 00:14:31 joerg Exp $"); +__RCSID("$NetBSD: parse-config.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2008, 2009 Joerg Sonnenberger . diff --git a/external/bsd/pkg_install/dist/lib/pkcs7.c b/external/bsd/pkg_install/dist/lib/pkcs7.c index e61a504e8..c4387a305 100644 --- a/external/bsd/pkg_install/dist/lib/pkcs7.c +++ b/external/bsd/pkg_install/dist/lib/pkcs7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pkcs7.c,v 1.1.1.4 2009/08/06 16:55:27 joerg Exp $ */ +/* $NetBSD: pkcs7.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -7,7 +7,7 @@ #include #endif -__RCSID("$NetBSD: pkcs7.c,v 1.1.1.4 2009/08/06 16:55:27 joerg Exp $"); +__RCSID("$NetBSD: pkcs7.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2004, 2008 The NetBSD Foundation, Inc. diff --git a/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in b/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in index f97babcfe..a402d320b 100644 --- a/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in +++ b/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_install.conf.5.in,v 1.2 2015/04/28 09:48:30 prlw1 Exp $ +.\" $NetBSD: pkg_install.conf.5.in,v 1.3 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 2008, 2009, 2012 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 22, 2012 +.Dd October 28, 2014 .Dt PKG_INSTALL.CONF 5 .Os .Sh NAME @@ -93,6 +93,9 @@ Missing license conditions are considered an error. During vulnerability checks, consider packages that have reached end-of-life as vulnerable. This option is enabled by default. +.It Dv CHECK_OSABI +If "no", osabi package does not check OS version. +The default is "yes". .It Dv CHECK_VULNERABILITIES Check for vulnerabilities when installing packages. Supported values are: diff --git a/external/bsd/pkg_install/dist/lib/pkg_io.c b/external/bsd/pkg_install/dist/lib/pkg_io.c index 3639e764c..8b8df078b 100644 --- a/external/bsd/pkg_install/dist/lib/pkg_io.c +++ b/external/bsd/pkg_install/dist/lib/pkg_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: pkg_io.c,v 1.1.1.9 2010/04/23 20:54:11 joerg Exp $ */ +/* $NetBSD: pkg_io.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2008, 2009 Joerg Sonnenberger . * All rights reserved. @@ -36,7 +36,7 @@ #include #endif -__RCSID("$NetBSD: pkg_io.c,v 1.1.1.9 2010/04/23 20:54:11 joerg Exp $"); +__RCSID("$NetBSD: pkg_io.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #include #include @@ -46,9 +46,14 @@ __RCSID("$NetBSD: pkg_io.c,v 1.1.1.9 2010/04/23 20:54:11 joerg Exp $"); #if HAVE_ERRNO_H #include #endif -#include #include +#ifdef BOOTSTRAP +#define IS_URL(x) 0 +#else +#include +#endif + #include "lib.h" struct pkg_path { @@ -59,6 +64,7 @@ struct pkg_path { static char *orig_cwd, *last_toplevel; static TAILQ_HEAD(, pkg_path) pkg_path = TAILQ_HEAD_INITIALIZER(pkg_path); +#ifndef BOOTSTRAP struct fetch_archive { struct url *url; fetchIO *fetch; @@ -145,19 +151,33 @@ open_archive_by_url(struct url *url, char **archive_name) *archive_name = fetchStringifyURL(url); - a = archive_read_new(); - archive_read_support_compression_all(a); - archive_read_support_format_all(a); + a = prepare_archive(); if (archive_read_open(a, f, fetch_archive_open, fetch_archive_read, fetch_archive_close)) { free(*archive_name); *archive_name = NULL; - archive_read_finish(a); + archive_read_free(a); return NULL; } return a; } +#endif /* !BOOTSTRAP */ + +struct archive * +prepare_archive(void) +{ + struct archive *a = archive_read_new(); + if (a == NULL) + errx(EXIT_FAILURE, "memory allocation failed"); + archive_read_support_filter_gzip(a); + archive_read_support_filter_bzip2(a); + archive_read_support_filter_xz(a); + archive_read_support_format_ar(a); + archive_read_support_format_tar(a); + archive_read_set_options(a, "hdrcharset=BINARY"); + return a; +} struct archive * open_archive(const char *url, char **archive_name) @@ -168,9 +188,7 @@ open_archive(const char *url, char **archive_name) *archive_name = NULL; if (!IS_URL(url)) { - a = archive_read_new(); - archive_read_support_compression_all(a); - archive_read_support_format_all(a); + a = prepare_archive(); if (archive_read_open_filename(a, url, 1024)) { archive_read_close(a); return NULL; @@ -179,6 +197,9 @@ open_archive(const char *url, char **archive_name) return a; } +#ifdef BOOTSTRAP + return NULL; +#else if ((u = fetchParseURL(url)) == NULL) return NULL; @@ -186,8 +207,10 @@ open_archive(const char *url, char **archive_name) fetchFreeURL(u); return a; +#endif } +#ifndef BOOTSTRAP static int strip_suffix(char *filename) { @@ -333,6 +356,7 @@ find_best_package(const char *toplevel, const char *pattern, int do_path) return best_match; } +#endif /* !BOOTSTRAP */ struct archive * find_archive(const char *fname, int top_level, char **archive_name) @@ -364,7 +388,7 @@ find_archive(const char *fname, int top_level, char **archive_name) free(full_fname); return a; } - +#ifndef BOOTSTRAP fname = last_slash + 1; *last_slash = '\0'; @@ -379,5 +403,6 @@ find_archive(const char *fname, int top_level, char **archive_name) return NULL; a = open_archive_by_url(best_match, archive_name); fetchFreeURL(best_match); +#endif /* !BOOTSTRAP */ return a; } diff --git a/external/bsd/pkg_install/dist/lib/pkg_signature.c b/external/bsd/pkg_install/dist/lib/pkg_signature.c index 8886c7ab6..664c4b688 100644 --- a/external/bsd/pkg_install/dist/lib/pkg_signature.c +++ b/external/bsd/pkg_install/dist/lib/pkg_signature.c @@ -1,4 +1,4 @@ -/* $NetBSD: pkg_signature.c,v 1.2 2013/09/11 12:59:19 khorben Exp $ */ +/* $NetBSD: pkg_signature.c,v 1.3 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: pkg_signature.c,v 1.2 2013/09/11 12:59:19 khorben Exp $"); +__RCSID("$NetBSD: pkg_signature.c,v 1.3 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 2008 Joerg Sonnenberger . @@ -47,6 +47,7 @@ __RCSID("$NetBSD: pkg_signature.c,v 1.2 2013/09/11 12:59:19 khorben Exp $"); #endif #include #include +#include #include #ifndef NETBSD #include @@ -159,7 +160,7 @@ verify_signature_close_cb(struct archive *archive, void *cookie) { struct signature_archive *state = cookie; - archive_read_finish(state->archive); + archive_read_free(state->archive); free_signature_int(state); return 0; } @@ -330,7 +331,7 @@ pkg_verify_signature(const char *archive_name, struct archive **archive, r = read_file_from_archive(archive_name, *archive, entry, HASH_FNAME, &hash_file, &hash_len); if (r == -1) { - archive_read_finish(*archive); + archive_read_free(*archive); *archive = NULL; free(state); goto no_valid_signature; @@ -345,7 +346,7 @@ pkg_verify_signature(const char *archive_name, struct archive **archive, r = read_file_from_archive(archive_name, *archive, entry, SIGNATURE_FNAME, &signature_file, &signature_len); if (r == -1) { - archive_read_finish(*archive); + archive_read_free(*archive); *archive = NULL; free(state); free(hash_file); @@ -356,7 +357,7 @@ pkg_verify_signature(const char *archive_name, struct archive **archive, entry, GPG_SIGNATURE_FNAME, &signature_file, &signature_len); if (r == -1) { - archive_read_finish(*archive); + archive_read_free(*archive); *archive = NULL; free(state); free(hash_file); @@ -366,8 +367,8 @@ pkg_verify_signature(const char *archive_name, struct archive **archive, free(state); goto no_valid_signature; } - has_sig = !detached_gpg_verify(hash_file, hash_len, - signature_file, signature_len, gpg_keyring_verify); + has_sig = !gpg_verify(hash_file, hash_len, gpg_keyring_verify, + signature_file, signature_len); free(signature_file); } else { @@ -399,13 +400,11 @@ pkg_verify_signature(const char *archive_name, struct archive **archive, state->archive = *archive; - a = archive_read_new(); - archive_read_support_compression_all(a); - archive_read_support_format_all(a); + a = prepare_archive(); if (archive_read_open(a, state, NULL, verify_signature_read_cb, verify_signature_close_cb)) { warnx("Can't open signed package file"); - archive_read_finish(a); + archive_read_free(a); goto no_valid_signature; } *archive = a; @@ -448,13 +447,11 @@ extract_pkgname(int fd) ssize_t len; int r; - a = archive_read_new(); - archive_read_support_compression_all(a); - archive_read_support_format_all(a); + a = prepare_archive(); if (archive_read_open_fd(a, fd, 1024)) { warnx("Cannot open binary package: %s", archive_error_string(a)); - archive_read_finish(a); + archive_read_free(a); return NULL; } @@ -462,17 +459,17 @@ extract_pkgname(int fd) if (r != ARCHIVE_OK) { warnx("Cannot extract package name: %s", r == ARCHIVE_EOF ? "EOF" : archive_error_string(a)); - archive_read_finish(a); + archive_read_free(a); return NULL; } if (strcmp(archive_entry_pathname(entry), "+CONTENTS") != 0) { warnx("Invalid binary package, doesn't start with +CONTENTS"); - archive_read_finish(a); + archive_read_free(a); return NULL; } if (archive_entry_size(entry) > SSIZE_MAX - 1) { warnx("+CONTENTS too large to process"); - archive_read_finish(a); + archive_read_free(a); return NULL; } @@ -482,12 +479,12 @@ extract_pkgname(int fd) if (archive_read_data(a, buf, len) != len) { warnx("Short read when extracing +CONTENTS"); free(buf); - archive_read_finish(a); + archive_read_free(a); return NULL; } buf[len] = '\0'; - archive_read_finish(a); + archive_read_free(a); parse_plist(&plist, buf); free(buf); @@ -579,7 +576,6 @@ pkg_sign_x509(const char *name, const char *output, const char *key_file, const archive_entry_set_size(sign_entry, signature_len); pkg = archive_write_new(); - archive_write_set_compression_none(pkg); archive_write_set_format_ar_bsd(pkg); archive_write_open_filename(pkg, output); @@ -608,7 +604,7 @@ pkg_sign_x509(const char *name, const char *output, const char *key_file, const archive_write_finish_entry(pkg); archive_entry_free(entry); - archive_write_finish(pkg); + archive_write_free(pkg); close(fd); @@ -673,7 +669,6 @@ pkg_sign_gpg(const char *name, const char *output) archive_entry_set_size(sign_entry, signature_len); pkg = archive_write_new(); - archive_write_set_compression_none(pkg); archive_write_set_format_ar_bsd(pkg); archive_write_open_filename(pkg, output); @@ -702,7 +697,7 @@ pkg_sign_gpg(const char *name, const char *output) archive_write_finish_entry(pkg); archive_entry_free(entry); - archive_write_finish(pkg); + archive_write_free(pkg); close(fd); diff --git a/external/bsd/pkg_install/dist/lib/pkg_summary.5 b/external/bsd/pkg_install/dist/lib/pkg_summary.5 index 110b7dddc..76bcbc330 100644 --- a/external/bsd/pkg_install/dist/lib/pkg_summary.5 +++ b/external/bsd/pkg_install/dist/lib/pkg_summary.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_summary.5,v 1.4 2012/02/19 17:49:09 tron Exp $ +.\" $NetBSD: pkg_summary.5,v 1.5 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 2006 The NetBSD Foundation .\" diff --git a/external/bsd/pkg_install/dist/lib/pkgdb.c b/external/bsd/pkg_install/dist/lib/pkgdb.c index 098e5f02a..ff8497b16 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.8 2010/04/23 20:54:11 joerg Exp $ */ +/* $NetBSD: pkgdb.c,v 1.2 2017/04/20 13:18:23 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.8 2010/04/23 20:54:11 joerg Exp $"); +__RCSID("$NetBSD: pkgdb.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /*- * Copyright (c) 1999-2010 The NetBSD Foundation, Inc. diff --git a/external/bsd/pkg_install/dist/lib/pkgsrc.7 b/external/bsd/pkg_install/dist/lib/pkgsrc.7 index db7bb2e53..b4b92338e 100644 --- a/external/bsd/pkg_install/dist/lib/pkgsrc.7 +++ b/external/bsd/pkg_install/dist/lib/pkgsrc.7 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkgsrc.7,v 1.1.1.1 2008/09/30 19:00:27 joerg Exp $ +.\" $NetBSD: pkgsrc.7,v 1.2 2017/04/20 13:18:23 joerg Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. diff --git a/external/bsd/pkg_install/dist/lib/plist.c b/external/bsd/pkg_install/dist/lib/plist.c index 64aaa1217..b8e96ae5f 100644 --- a/external/bsd/pkg_install/dist/lib/plist.c +++ b/external/bsd/pkg_install/dist/lib/plist.c @@ -1,4 +1,4 @@ -/* $NetBSD: plist.c,v 1.1.1.5 2009/08/06 16:55:28 joerg Exp $ */ +/* $NetBSD: plist.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: plist.c,v 1.1.1.5 2009/08/06 16:55:28 joerg Exp $"); +__RCSID("$NetBSD: plist.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/remove.c b/external/bsd/pkg_install/dist/lib/remove.c index fc767b930..b9cb67411 100644 --- a/external/bsd/pkg_install/dist/lib/remove.c +++ b/external/bsd/pkg_install/dist/lib/remove.c @@ -1,4 +1,4 @@ -/* $NetBSD: remove.c,v 1.1.1.2 2009/08/06 16:55:29 joerg Exp $ */ +/* $NetBSD: remove.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger . @@ -39,7 +39,7 @@ #include #endif -__RCSID("$NetBSD: remove.c,v 1.1.1.2 2009/08/06 16:55:29 joerg Exp $"); +__RCSID("$NetBSD: remove.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_DIRENT_H #include diff --git a/external/bsd/pkg_install/dist/lib/str.c b/external/bsd/pkg_install/dist/lib/str.c index 0284e59f5..7168c29c3 100644 --- a/external/bsd/pkg_install/dist/lib/str.c +++ b/external/bsd/pkg_install/dist/lib/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.1.1.2 2009/02/02 20:44:08 joerg Exp $ */ +/* $NetBSD: str.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: str.c,v 1.1.1.2 2009/02/02 20:44:08 joerg Exp $"); +__RCSID("$NetBSD: str.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance diff --git a/external/bsd/pkg_install/dist/lib/var.c b/external/bsd/pkg_install/dist/lib/var.c index 0db661371..708f60562 100644 --- a/external/bsd/pkg_install/dist/lib/var.c +++ b/external/bsd/pkg_install/dist/lib/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.2 2013/05/16 19:19:44 martin Exp $ */ +/* $NetBSD: var.c,v 1.3 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: var.c,v 1.2 2013/05/16 19:19:44 martin Exp $"); +__RCSID("$NetBSD: var.c,v 1.3 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_SYS_STAT_H #include @@ -60,7 +60,7 @@ static const char *var_cmp(const char *, size_t, const char *, size_t); static void var_print(FILE *, const char *, const char *); /* - * Copy the specified varibales from the file fname to stdout. + * Copy the specified variables from the file fname to stdout. */ int var_copy_list(const char *buf, const char **variables) @@ -74,8 +74,8 @@ var_copy_list(const char *buf, const char **variables) next = eol + 1; len = eol - buf; } else { - next = eol; len = strlen(buf); + next = buf + len; } for (i=0; variables[i]; i++) { diff --git a/external/bsd/pkg_install/dist/lib/version.c b/external/bsd/pkg_install/dist/lib/version.c index f3d7ab8ef..069dc13e4 100644 --- a/external/bsd/pkg_install/dist/lib/version.c +++ b/external/bsd/pkg_install/dist/lib/version.c @@ -1,4 +1,4 @@ -/* $NetBSD: version.c,v 1.1.1.3 2010/02/03 14:24:00 joerg Exp $ */ +/* $NetBSD: version.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: version.c,v 1.1.1.3 2010/02/03 14:24:00 joerg Exp $"); +__RCSID("$NetBSD: version.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. diff --git a/external/bsd/pkg_install/dist/lib/version.h b/external/bsd/pkg_install/dist/lib/version.h index b90c2e707..6cb3e03f3 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.10 2013/04/20 15:29:23 wiz Exp $ */ +/* $NetBSD: version.h,v 1.11 2017/04/20 13:18:23 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 20130131 +#define PKGTOOLS_VERSION 20170419 #endif /* _INST_LIB_VERSION_H_ */ diff --git a/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c b/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c index 1ee941a8a..3617fc750 100644 --- a/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c +++ b/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c @@ -1,4 +1,4 @@ -/* $NetBSD: vulnerabilities-file.c,v 1.1.1.5 2010/06/26 00:14:33 joerg Exp $ */ +/* $NetBSD: vulnerabilities-file.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2008, 2010 Joerg Sonnenberger . @@ -38,7 +38,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: vulnerabilities-file.c,v 1.1.1.5 2010/06/26 00:14:33 joerg Exp $"); +__RCSID("$NetBSD: vulnerabilities-file.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_SYS_STAT_H #include @@ -77,6 +77,20 @@ static const char pgp_msg_end[] = "-----BEGIN PGP SIGNATURE-----\n"; static const char pkcs7_begin[] = "-----BEGIN PKCS7-----\n"; static const char pkcs7_end[] = "-----END PKCS7-----\n"; +static struct archive * +prepare_raw_file(void) +{ + struct archive *a = archive_read_new(); + if (a == NULL) + errx(EXIT_FAILURE, "memory allocation failed"); + + archive_read_support_filter_gzip(a); + archive_read_support_filter_bzip2(a); + archive_read_support_filter_xz(a); + archive_read_support_format_raw(a); + return a; +} + static void verify_signature_pkcs7(const char *input) { @@ -110,12 +124,7 @@ verify_signature_pkcs7(const char *input) static void verify_signature(const char *input, size_t input_len) { - if (gpg_cmd == NULL && certs_pkg_vulnerabilities == NULL) - errx(EXIT_FAILURE, - "At least GPG or CERTIFICATE_ANCHOR_PKGVULN " - "must be configured"); - if (gpg_cmd != NULL) - inline_gpg_verify(input, input_len, gpg_keyring_pkgvuln); + gpg_verify(input, input_len, gpg_keyring_pkgvuln, NULL, 0); if (certs_pkg_vulnerabilities != NULL) verify_signature_pkcs7(input); } @@ -350,12 +359,8 @@ read_pkg_vulnerabilities_memory(void *buf, size_t len, int check_sum) struct archive *a; struct pkg_vulnerabilities *pv; - if ((a = archive_read_new()) == NULL) - errx(EXIT_FAILURE, "memory allocation failed"); - - if (archive_read_support_compression_all(a) != ARCHIVE_OK || - archive_read_support_format_raw(a) != ARCHIVE_OK || - archive_read_open_memory(a, buf, len) != ARCHIVE_OK) + a = prepare_raw_file(); + if (archive_read_open_memory(a, buf, len) != ARCHIVE_OK) errx(EXIT_FAILURE, "Cannot open pkg_vulnerabilies buffer: %s", archive_error_string(a)); @@ -381,12 +386,8 @@ read_pkg_vulnerabilities_file(const char *path, int ignore_missing, int check_su err(EXIT_FAILURE, "Cannot open %s", path); } - if ((a = archive_read_new()) == NULL) - errx(EXIT_FAILURE, "memory allocation failed"); - - if (archive_read_support_compression_all(a) != ARCHIVE_OK || - archive_read_support_format_raw(a) != ARCHIVE_OK || - archive_read_open_fd(a, fd, 65536) != ARCHIVE_OK) + a = prepare_raw_file(); + if (archive_read_open_fd(a, fd, 65536) != ARCHIVE_OK) errx(EXIT_FAILURE, "Cannot open ``%s'': %s", path, archive_error_string(a)); @@ -450,9 +451,6 @@ parse_pkg_vuln(const char *input, size_t input_len, int check_sum) size_t allocated_vulns; int in_pgp_msg; -#if defined(__minix) - next = NULL; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */ -#endif /* defined(__minix) */ pv = xmalloc(sizeof(*pv)); allocated_vulns = pv->entries = 0; diff --git a/external/bsd/pkg_install/dist/lib/xwrapper.c b/external/bsd/pkg_install/dist/lib/xwrapper.c index 45e745746..ff8de092e 100644 --- a/external/bsd/pkg_install/dist/lib/xwrapper.c +++ b/external/bsd/pkg_install/dist/lib/xwrapper.c @@ -1,4 +1,4 @@ -/* $NetBSD: xwrapper.c,v 1.1.1.1 2009/02/02 20:44:09 joerg Exp $ */ +/* $NetBSD: xwrapper.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger . @@ -36,7 +36,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: xwrapper.c,v 1.1.1.1 2009/02/02 20:44:09 joerg Exp $"); +__RCSID("$NetBSD: xwrapper.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); #if HAVE_ERR_H #include diff --git a/external/bsd/pkg_install/dist/x509/pkgsrc.cnf b/external/bsd/pkg_install/dist/x509/pkgsrc.cnf index 2a1c79459..32a08a041 100644 --- a/external/bsd/pkg_install/dist/x509/pkgsrc.cnf +++ b/external/bsd/pkg_install/dist/x509/pkgsrc.cnf @@ -1,4 +1,4 @@ -# $NetBSD: pkgsrc.cnf,v 1.1.1.1 2009/02/02 20:44:09 joerg Exp $ +# $NetBSD: pkgsrc.cnf,v 1.2 2017/04/20 13:18:23 joerg Exp $ # # OpenSSL sample configuration file for use by pkgsrc.sh # diff --git a/external/bsd/pkg_install/dist/x509/pkgsrc.sh b/external/bsd/pkg_install/dist/x509/pkgsrc.sh index aab77c803..90ecd0a1f 100644 --- a/external/bsd/pkg_install/dist/x509/pkgsrc.sh +++ b/external/bsd/pkg_install/dist/x509/pkgsrc.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: pkgsrc.sh,v 1.1.1.1 2009/02/02 20:44:09 joerg Exp $ +# $NetBSD: pkgsrc.sh,v 1.2 2017/04/20 13:18:23 joerg Exp $ # CA="openssl ca -config pkgsrc.cnf" diff --git a/external/bsd/pkg_install/sbin/Makefile b/external/bsd/pkg_install/sbin/Makefile index 1e883c161..131704116 100644 --- a/external/bsd/pkg_install/sbin/Makefile +++ b/external/bsd/pkg_install/sbin/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.3 2009/02/02 20:47:21 joerg Exp $ +# $NetBSD: Makefile,v 1.4 2016/06/25 18:05:57 maya Exp $ -SUBDIR= bpm pkg_add pkg_admin pkg_create \ +SUBDIR= pkg_add pkg_admin pkg_create \ pkg_delete pkg_info -.include \ No newline at end of file +.include diff --git a/external/bsd/pkg_install/sbin/Makefile.inc b/external/bsd/pkg_install/sbin/Makefile.inc index 66b2b2fa6..829cd85aa 100644 --- a/external/bsd/pkg_install/sbin/Makefile.inc +++ b/external/bsd/pkg_install/sbin/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.3 2010/11/05 09:09:01 he Exp $ +# $NetBSD: Makefile.inc,v 1.5 2017/04/21 12:43:22 joerg Exp $ .include @@ -12,8 +12,8 @@ CPPFLAGS+= -DBINDIR='"${BINDIR}"' DPADD+= ${LIBINSTALL}/libinstall.a LDADD+= -L${LIBINSTALL} -linstall -ltermcap -DPADD+= ${LIBFETCH} ${LIBSSL} ${LIBCRYPTO} -LDADD+= -lfetch -lssl -lcrypto +DPADD+= ${LIBNETPGPVERIFY} ${LIBFETCH} ${LIBSSL} ${LIBCRYPTO} +LDADD+= -lnetpgpverify -lfetch -lssl -lcrypto DPADD+= ${LIBARCHIVE} LDADD+= -larchive @@ -21,5 +21,10 @@ LDADD+= -larchive DPADD+= ${LIBZ} ${LIBBZ2} LDADD+= -lz -lbz2 +.if !defined(__MINIX) +DPADD+= ${LIBLZMA} ${LIBPTHREAD} +LDADD+= -llzma -lpthread +.else DPADD+= ${LIBLZMA} LDADD+= -llzma +.endif # !defined(__MINIX) diff --git a/external/bsd/pkg_install/sbin/bpm/Makefile b/external/bsd/pkg_install/sbin/bpm/Makefile deleted file mode 100644 index 1c4785d8f..000000000 --- a/external/bsd/pkg_install/sbin/bpm/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/09/30 19:19:56 joerg Exp $ - -SCRIPTS= bpm.sh -MAN= bpm.1 - -.include - -.PATH: ${DIST}/bpm - -CLEANFILES+= bpm.sh - -bpm.sh: ${DIST}/bpm/bpm.sh.in - ${TOOL_CAT} ${DIST}/bpm/bpm.sh.in > ${.TARGET} - -.include diff --git a/external/bsd/pkg_install/sbin/pkg_add/Makefile b/external/bsd/pkg_install/sbin/pkg_add/Makefile index a58ad03e1..02e4ec02c 100644 --- a/external/bsd/pkg_install/sbin/pkg_add/Makefile +++ b/external/bsd/pkg_install/sbin/pkg_add/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2009/02/02 20:47:21 joerg Exp $ +# $NetBSD: Makefile,v 1.3 2017/04/20 13:18:47 joerg Exp $ # Original from FreeBSD, no rcs id. PROG= pkg_add @@ -8,6 +8,6 @@ SRCS= main.c perform.c .PATH: ${DIST}/add -CPPFLAGS+= -DMACHINE_ARCH=\"${MACHINE_ARCH}\" +CPPFLAGS+= -DPKGSRC_MACHINE_ARCH=\"${MACHINE_ARCH}\" .include