Import of pkgsrc-2015Q1

This commit is contained in:
2015-04-22 14:34:26 +02:00
committed by Lionel Sambuc
parent 9a8c06dafb
commit 4af1cdf7a9
25114 changed files with 870550 additions and 795435 deletions

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile.in,v 1.21 2013/09/12 11:03:10 jperkin Exp $
# $NetBSD: Makefile.in,v 1.22 2015/01/22 09:19:47 jperkin Exp $
srcdir= @srcdir@
@@ -15,7 +15,7 @@ SSL_SUPPORT= @ssl_support@
CC= @CC@
CCLD= $(CC)
LIBS= -linstall -lfetch @LIBS@
LIBS= -linstall -larchive -lfetch @LIBS@
.if !empty(SSL_SUPPORT)
LIBS+= -lssl -lcrypto

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: pkg_delete.1,v 1.30 2010/02/25 06:56:23 wiz Exp $
.\" $NetBSD: pkg_delete.1,v 1.31 2014/12/30 15:13:20 wiz 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

View File

@@ -34,7 +34,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: pkg_delete.c,v 1.12 2011/09/29 23:30:21 wiz Exp $");
__RCSID("$NetBSD: pkg_delete.c,v 1.13 2014/12/30 15:13:20 wiz Exp $");
#if HAVE_ERR_H
#include <err.h>
@@ -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))

View File

@@ -1,35 +1,34 @@
PKG_DELETE(1) NetBSD General Commands Manual PKG_DELETE(1)
PKG_DELETE(1) General Commands Manual PKG_DELETE(1)
NNAAMMEE
ppkkgg__ddeelleettee -- a utility for deleting previously installed software pack-
age distributions
ppkkgg__ddeelleettee -- a utility for deleting previously installed software
package distributions
SSYYNNOOPPSSIISS
ppkkgg__ddeelleettee [--AADDFFffkkNNnnOORRrrVVvv] [--KK _p_k_g___d_b_d_i_r] [--PP _d_e_s_t_d_i_r] [--pp _p_r_e_f_i_x]
_p_k_g_-_n_a_m_e _._._.
DDEESSCCRRIIPPTTIIOONN
The ppkkgg__ddeelleettee command is used to delete packages that have been previ-
ously installed with the pkg_add(1) command. The given packages are
sorted, so that the dependencies of a package are deleted after the pack-
age. Before any action is executed, ppkkgg__ddeelleettee checks for packages that
are marked as pprreesseerrvveedd or have depending packages left. If the --kk flag
is given, preserved packages are removed from the list of packages to
remove. Unless the --ff flag is given, ppkkgg__ddeelleettee stops on the first
error.
The ppkkgg__ddeelleettee command is used to delete packages that have been
previously installed with the pkg_add(1) command. The given packages are
sorted, so that the dependencies needed by a package are deleted after
the package. Before any action is executed, ppkkgg__ddeelleettee checks for
packages that are marked as pprreesseerrvveedd or have depending packages left.
If the --kk flag is given, preserved packages are skipped and not removed.
Unless the --ff flag is given, ppkkgg__ddeelleettee stops on the first error.
WWAARRNNIINNGG
_S_i_n_c_e _t_h_e ppkkgg__ddeelleettee _c_o_m_m_a_n_d _m_a_y _e_x_e_c_u_t_e _s_c_r_i_p_t_s _o_r _p_r_o_g_r_a_m_s _p_r_o_v_i_d_e_d _b_y
_a _p_a_c_k_a_g_e _f_i_l_e_, _y_o_u_r _s_y_s_t_e_m _m_a_y _b_e _s_u_s_c_e_p_t_i_b_l_e _t_o _`_`_T_r_o_j_a_n _h_o_r_s_e_s_'_' _o_r
_o_t_h_e_r _s_u_b_t_l_e _a_t_t_a_c_k_s _f_r_o_m _m_i_s_c_r_e_a_n_t_s _w_h_o _c_r_e_a_t_e _d_a_n_g_e_r_o_u_s _p_a_c_k_a_g_e _f_i_l_e_s_.
_Y_o_u _a_r_e _a_d_v_i_s_e_d _t_o _v_e_r_i_f_y _t_h_e _c_o_m_p_e_t_e_n_c_e _a_n_d _i_d_e_n_t_i_t_y _o_f _t_h_o_s_e _w_h_o _p_r_o_-
_v_i_d_e _i_n_s_t_a_l_l_a_b_l_e _p_a_c_k_a_g_e _f_i_l_e_s_. _F_o_r _e_x_t_r_a _p_r_o_t_e_c_t_i_o_n_, _e_x_a_m_i_n_e _a_l_l _t_h_e
_Y_o_u _a_r_e _a_d_v_i_s_e_d _t_o _v_e_r_i_f_y _t_h_e _c_o_m_p_e_t_e_n_c_e _a_n_d _i_d_e_n_t_i_t_y _o_f _t_h_o_s_e _w_h_o
_p_r_o_v_i_d_e _i_n_s_t_a_l_l_a_b_l_e _p_a_c_k_a_g_e _f_i_l_e_s_. _F_o_r _e_x_t_r_a _p_r_o_t_e_c_t_i_o_n_, _e_x_a_m_i_n_e _a_l_l _t_h_e
_p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s _i_n _t_h_e _p_a_c_k_a_g_e _r_e_c_o_r_d _d_i_r_e_c_t_o_r_y
_<_P_K_G___D_B_D_I_R_>_/_<_p_k_g_-_n_a_m_e_>_/_)_. _P_a_y _p_a_r_t_i_c_u_l_a_r _a_t_t_e_n_t_i_o_n _t_o _a_n_y _+_I_N_S_T_A_L_L _o_r
_+_D_E_I_N_S_T_A_L_L _f_i_l_e_s_, _a_n_d _i_n_s_p_e_c_t _t_h_e _+_C_O_N_T_E_N_T_S _f_i_l_e _f_o_r @@ccwwdd_, @@mmooddee _(_c_h_e_c_k
_f_o_r _s_e_t_u_i_d_)_, @@ddiirrrrmm_, @@eexxeecc_, _a_n_d @@uunneexxeecc _d_i_r_e_c_t_i_v_e_s_, _a_n_d_/_o_r _u_s_e _t_h_e
pkg_info(_1) _c_o_m_m_a_n_d _t_o _e_x_a_m_i_n_e _t_h_e _i_n_s_t_a_l_l_e_d _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s_.
_p_k_g___i_n_f_o_(_1_) _c_o_m_m_a_n_d _t_o _e_x_a_m_i_n_e _t_h_e _i_n_s_t_a_l_l_e_d _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s_.
OOPPTTIIOONNSS
The following command line options are supported:
@@ -38,24 +37,25 @@ OOPPTTIIOONNSS
The named packages are deinstalled, wildcards can be used, see
pkg_info(1). If no version is given, the one currently installed
will be removed. If the --FF flag is given, one or more (absolute)
filenames may be specified and the Package Database will be con-
sulted for the package to which the given file belongs. These
filenames may be specified and the package database will be
consulted for the package to which the given file belongs. These
packages are then deinstalled.
--AA Recursively remove all automatically installed packages that were
needed by the given packages and are no longer required. See
also the --RR flag.
needed by the given packages and are no longer required. Does
not remove manually installed packages; see also the --RR flag.
--DD If a deinstallation script exists for a given package, do not
execute it.
--FF Any pkg-name given will be interpreted as pathname which is sub-
sequently transformed in a (real) package name via the Package
Database. That way, packages can be deleted by giving a filename
--FF Any _p_k_g_-_n_a_m_e given will be interpreted as pathname which is
subsequently transformed in a (real) package name via the package
database. That way, packages can be deleted by giving a filename
instead of the package-name.
--ff Force removal of the package, even if a dependency is recorded or
the deinstall script fails.
the deinstall script fails. This might break the package
database; see pkg_admin(1) on how to repair it.
--ffff Force removal of the package, even if the package is marked as a
pprreesseerrvveedd package. Note that this is a dangerous operation. See
@@ -67,20 +67,20 @@ OOPPTTIIOONNSS
--kk Silently skip all packages that are marked as pprreesseerrvveedd.
--NN Remove the package's registration and its entries from the pack-
age database, but leave the files installed. Don't run any dein-
stall scripts or @unexec lines either.
--NN Remove the package's registration and its entries from the
package database, but leave the files installed. Don't run any
deinstall scripts or @@uunneexxeecc lines either.
--nn Don't actually deinstall a package, just report the steps that
would be taken if it were.
would be taken.
--OO Only delete the package's entries from the package database, do
--OO Only delete the package's entries from the package database; do
not touch the package or its files itself.
--pp _d_e_s_t_d_i_r
--PP _d_e_s_t_d_i_r
Prefix all file and directory names with _d_e_s_t_d_i_r. For packages
without install scripts this has the same behavior as using
chroot.
chroot(8).
--pp _p_r_e_f_i_x
Set _p_r_e_f_i_x as the directory in which to delete files from any
@@ -89,8 +89,8 @@ OOPPTTIIOONNSS
location by pkg_add(1).
--RR Recursively remove all packages that were needed by the given
packages and that have no other dependencies left. This option
overrides the --AA flag.
packages and are no longer required. This option overrides the
--AA flag.
--rr Recursively remove all packages that require one of the packages
given.
@@ -113,34 +113,32 @@ TTEECCHHNNIICCAALL DDEETTAAIILLSS
given).
If a filename is given instead of a package name, the package of which
the given file belongs to can be deleted if the --FF Flag is given. The
filename needs to be absolute, see the output produced by the pkg_info
the given file belongs to can be deleted if the --FF flag is given. The
filename needs to be absolute, see the output produced by the pkg_info(1)
--aaFF command.
If a ddeeiinnssttaallll script exists for the package, it is executed before and
after any files are removed. It is this script's responsibility to clean
up any additional messy details around the package's installation, since
all ppkkgg__ddeelleettee knows how to do is delete the files created in the origi-
nal distribution. The ddeeiinnssttaallll script is called as:
ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _V_I_E_W_-_D_E_I_N_S_T_A_L_L
before removing the package from a view, and as:
all ppkkgg__ddeelleettee knows how to do is delete the files created in the
original distribution. The ddeeiinnssttaallll script is called as:
ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _D_E_I_N_S_T_A_L_L
before deleting all files and as:
ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _P_O_S_T_-_D_E_I_N_S_T_A_L_L
after deleting them. Passing the keywords _V_I_E_W_-_D_E_I_N_S_T_A_L_L, _D_E_I_N_S_T_A_L_L and
_P_O_S_T_-_D_E_I_N_S_T_A_L_L lets you potentially write only one program/script that
handles all aspects of installation and deletion.
after deleting them. Passing the keywords _D_E_I_N_S_T_A_L_L and _P_O_S_T_-_D_E_I_N_S_T_A_L_L
lets you potentially write only one program/script that handles all
aspects of installation and deletion.
All scripts are called with the environment variable PKG_PREFIX set to
the installation prefix (see the --pp option above). This allows a package
author to write a script that reliably performs some action on the direc-
tory where the package is installed, even if the user might have changed
it by specifying the --pp option when running ppkkgg__ddeelleettee or pkg_add(1).
The scripts are also called with the PKG_METADATA_DIR environment vari-
able set to the location of the _+_* meta-data files, and with the
PKG_REFCOUNT_DBDIR environment variable set to the location of the pack-
age reference counts database directory. If the --PP flag was given to
ppkkgg__ddeelleettee, PKG_DESTDIR will be set to _d_e_s_t_d_i_r.
author to write a script that reliably performs some action on the
directory where the package is installed, even if the user might have
changed it by specifying the --pp option when running ppkkgg__ddeelleettee or
pkg_add(1). The scripts are also called with the PKG_METADATA_DIR
environment variable set to the location of the _+_* meta-data files, and
with the PKG_REFCOUNT_DBDIR environment variable set to the location of
the package reference counts database directory. If the --PP flag was
given to ppkkgg__ddeelleettee, PKG_DESTDIR will be set to _d_e_s_t_d_i_r.
EENNVVIIRROONNMMEENNTT
See pkg_install.conf(5) for options, that can also be specified using the
@@ -159,7 +157,7 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, recursive "down"
delete, etc.
Joerg Sonnenberger
Rewrote most of the code to compute correct order of deinstalla-
tion and to improve error handling.
Rewrote most of the code to compute correct order of
deinstallation and to improve error handling.
NetBSD 5.0 January 20, 2010 NetBSD 5.0
pkgsrc December 27, 2014 pkgsrc