Permalink
Browse files

Import pkg_install-20170419.

  • Loading branch information...
1 parent cdefe20 commit 8c7430ba6688b104a1276749e83b8ba9f2beb821 joerg committed Apr 20, 2017
Showing with 279 additions and 641 deletions.
  1. +11 −25 external/bsd/pkg_install/dist/add/main.c
  2. +24 −43 external/bsd/pkg_install/dist/add/perform.c
  3. +3 −23 external/bsd/pkg_install/dist/add/pkg_add.1
  4. +5 −21 external/bsd/pkg_install/dist/admin/main.c
  5. +2 −15 external/bsd/pkg_install/dist/admin/pkg_admin.1
  6. +9 −16 external/bsd/pkg_install/dist/create/build.c
  7. +1 −3 external/bsd/pkg_install/dist/create/create.h
  8. +6 −12 external/bsd/pkg_install/dist/create/main.c
  9. +2 −7 external/bsd/pkg_install/dist/create/perform.c
  10. +4 −50 external/bsd/pkg_install/dist/create/pkg_create.1
  11. +2 −38 external/bsd/pkg_install/dist/create/pl.c
  12. +2 −11 external/bsd/pkg_install/dist/create/util.c
  13. +3 −10 external/bsd/pkg_install/dist/delete/pkg_delete.1
  14. +15 −145 external/bsd/pkg_install/dist/delete/pkg_delete.c
  15. +1 −2 external/bsd/pkg_install/dist/info/info.h
  16. +15 −27 external/bsd/pkg_install/dist/info/perform.c
  17. +4 −4 external/bsd/pkg_install/dist/info/pkg_info.1
  18. +13 −5 external/bsd/pkg_install/dist/lib/config.h.in
  19. +4 −1 external/bsd/pkg_install/dist/lib/defs.h
  20. +2 −5 external/bsd/pkg_install/dist/lib/file.c
  21. +34 −92 external/bsd/pkg_install/dist/lib/gpgsig.c
  22. +9 −12 external/bsd/pkg_install/dist/lib/lib.h
  23. +17 −4 external/bsd/pkg_install/dist/lib/license.c
  24. +6 −3 external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
  25. +36 −11 external/bsd/pkg_install/dist/lib/pkg_io.c
  26. +21 −29 external/bsd/pkg_install/dist/lib/pkg_signature.c
  27. +5 −5 external/bsd/pkg_install/dist/lib/var.c
  28. +2 −2 external/bsd/pkg_install/dist/lib/version.h
  29. +21 −20 external/bsd/pkg_install/dist/lib/vulnerabilities-file.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.1.1.11 2017/04/20 13:12:46 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.1.1.10 2011/02/18 22:32:27 aymeric Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.11 2017/04/20 13:12:46 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 <err.h>
#endif
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#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) {
@@ -1,12 +1,12 @@
-/* $NetBSD: perform.c,v 1.1.1.21 2013/04/20 15:26:52 wiz Exp $ */
+/* $NetBSD: perform.c,v 1.1.1.22 2017/04/20 13:12:46 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <nbcompat.h>
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.21 2013/04/20 15:26:52 wiz Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.22 2017/04/20 13:12:46 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
@@ -50,6 +50,7 @@ __RCSID("$NetBSD: perform.c,v 1.1.1.21 2013/04/20 15:26:52 wiz Exp $");
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -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 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level)
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 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level)
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:
@@ -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.1.1.13 2017/04/20 13:12:46 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,22 +17,20 @@
.\"
.\" @(#)pkg_add.1
.\"
-.Dd June 16, 2010
+.Dd December 27, 2014
.Dt PKG_ADD 1
.Os
.Sh NAME
.Nm pkg_add
.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
Oops, something went wrong.

0 comments on commit 8c7430b

Please sign in to comment.