summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorgrant <grant>2004-02-07 10:37:52 +0000
committergrant <grant>2004-02-07 10:37:52 +0000
commitc7f0730c2e102e6be645fc08432cbcef529a01f0 (patch)
tree817e1625295ff6430c71ee91f0760c1561fa797b /pkgtools/pkg_install
parent9ddcea934e71319a265c99d6bef3f38f303e9b0c (diff)
downloadpkgsrc-c7f0730c2e102e6be645fc08432cbcef529a01f0.tar.gz
sync with NetBSD-current's pkg_install from 20040207.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/admin/main.c45
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.119
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.cat128
-rw-r--r--pkgtools/pkg_install/files/create/pl.c26
-rw-r--r--pkgtools/pkg_install/files/delete/perform.c7
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.119
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.cat112
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.12
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.cat188
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h4
-rw-r--r--pkgtools/pkg_install/files/lib/plist.c44
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
12 files changed, 187 insertions, 111 deletions
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index 54a42518461..2fa200527ea 100644
--- a/pkgtools/pkg_install/files/admin/main.c
+++ b/pkgtools/pkg_install/files/admin/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.13 2003/09/23 07:13:48 grant Exp $ */
+/* $NetBSD: main.c,v 1.14 2004/02/07 10:37:52 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.13 2003/09/23 07:13:48 grant Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 2004/02/07 10:37:52 grant Exp $");
#endif
/*
@@ -136,26 +136,41 @@ check1pkg(const char *pkgdir)
(void) snprintf(file, sizeof(file), "%s/%s", dirp, p->name);
- if (!(isfile(file) || islinktodir(file)))
- warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME);
- else {
- if (p->next &&
- p->next->type == PLIST_COMMENT &&
- strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) { /* || PLIST_MD5 - HF */
- if ((md5file = MD5File(file, NULL)) != NULL) {
- /* Mismatch? */
+ if (isfile(file) || islinktodir(file)) {
+ if (p->next && p->next->type == PLIST_COMMENT) {
+ if (strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
+ if ((md5file = MD5File(file, NULL)) != NULL) {
+ /* Mismatch? */
#ifdef PKGDB_DEBUG
- printf("%s: md5 should=<%s>, is=<%s>\n",
- file, p->next->name + ChecksumHeaderLen, md5file);
+ printf("%s: md5 should=<%s>, is=<%s>\n",
+ file, p->next->name + ChecksumHeaderLen, md5file);
#endif
- if (strcmp(md5file, p->next->name + ChecksumHeaderLen) != 0)
- printf("%s fails MD5 checksum\n", file);
+ if (strcmp(md5file, p->next->name + ChecksumHeaderLen) != 0)
+ printf("%s fails MD5 checksum\n", file);
- free(md5file);
+ free(md5file);
+ }
+ } else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
+ char buf[FILENAME_MAX + SymlinkHeaderLen];
+ int cc;
+
+ (void) strlcpy(buf, SYMLINK_HEADER, sizeof(buf));
+ if ((cc = readlink(file, &buf[SymlinkHeaderLen],
+ sizeof(buf) - SymlinkHeaderLen)) < 0) {
+ warnx("can't readlink `%s'", file);
+ } else {
+ buf[SymlinkHeaderLen + cc] = 0x0;
+ if (strcmp(buf, p->next->name) != 0) {
+ printf("symlink (%s) is not same as recorded value, %s: %s\n",
+ file, buf, p->next->name);
+ }
+ }
}
}
filecnt++;
+ } else {
+ warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME);
}
break;
case PLIST_CWD:
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.1 b/pkgtools/pkg_install/files/admin/pkg_admin.1
index d24316ab09a..cd4dec35c69 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_admin.1,v 1.5 2003/09/23 07:13:48 grant Exp $
+.\" $NetBSD: pkg_admin.1,v 1.6 2004/02/07 10:37:52 grant Exp $
.\"
.\" Copyright (c) 1999-2002 Hubert Feyrer. All rights reserved.
.\"
@@ -28,7 +28,7 @@
.\" (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 September 8, 2003
+.Dd January 26, 2004
.Dt PKG_ADMIN 1
.Os
.Sh NAME
@@ -36,7 +36,9 @@
.Nd perform various administrative tasks to the pkg system
.Sh SYNOPSIS
.Nm
-.Op Fl V
+.Op Fl bSV
+.Nb -words
+.Op Fl d Ar lsdir
.Bk -words
.Op Fl K Ar pkg_dbdir
.Ek
@@ -79,7 +81,6 @@ names for
and
.Cm lsbest
to be the null suffix.
-The default pattern is ".t[bg]z".
.It Fl s Ar sfx_pattern
Set the shell glob pattern for package suffices when matching package
names for
@@ -101,17 +102,21 @@ This should be used only by
.Xr pkg_view 1 .
.It Cm check Op Ar pkg ...
Use this command to check the files belonging to some or all of the
-packages installed on the local machine against their MD5 checksum
-noted in their +CONTENTS files.
+packages installed on the local machine against the checksum
+which was recorded in the +CONTENTS files at package installation time.
+Symbolic links also have their integrity checked against the recorded
+value at package installation time.
If no additional argument is given, the files of all installed packages
are checked, else only the named packages will be checked (wildcards can
be used here, see
.Xr pkg_info 1 ) .
.Pp
-The packages' +CONTENTS files will be parsed and the MD5
+The packages' +CONTENTS files will be parsed and the
checksum will be checked for every file found.
A warning message is printed if the expected checksum differs from the
checksum of the file on disk.
+Symbolic links are also checked, ensuring that the targets on disk are
+the same as the contents recorded at package installation time.
.It Cm delete Ar pkg ...
For each listed package, remove all file entries in the package database that
belong to the package.
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.cat1 b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
index 38692b21fb4..58bd14b1314 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
@@ -4,7 +4,8 @@ NNAAMMEE
ppkkgg__aaddmmiinn - perform various administrative tasks to the pkg system
SSYYNNOOPPSSIISS
- ppkkgg__aaddmmiinn [--VV] [--KK _p_k_g___d_b_d_i_r] [--ss _s_f_x___p_a_t_t_e_r_n] _c_o_m_m_a_n_d [args ...]
+ ppkkgg__aaddmmiinn [--bbSSVV] [--dd _l_s_d_i_r] [--KK _p_k_g___d_b_d_i_r] [--ss _s_f_x___p_a_t_t_e_r_n] _c_o_m_m_a_n_d [args
+ ...]
DDEESSCCRRIIPPTTIIOONN
This command performs various administrative tasks around the NetBSD
@@ -27,8 +28,7 @@ OOPPTTIIOONNSS
otherwise it defaults to _/_v_a_r_/_d_b_/_p_k_g.
--SS Set the shell glob pattern for package suffices when matching
- package names for llssaallll and llssbbeesstt to be the null suffix. The
- default pattern is ".t[bg]z".
+ package names for llssaallll and llssbbeesstt to be the null suffix.
--ss _s_f_x___p_a_t_t_e_r_n
Set the shell glob pattern for package suffices when matching
@@ -47,16 +47,20 @@ OOPPTTIIOONNSS
cchheecckk [_p_k_g _._._.]
Use this command to check the files belonging to some or all of
- the packages installed on the local machine against their MD5
- checksum noted in their +CONTENTS files. If no additional argu-
- ment is given, the files of all installed packages are checked,
- else only the named packages will be checked (wildcards can be
- used here, see pkg_info(1)).
-
- The packages' +CONTENTS files will be parsed and the MD5 checksum
+ the packages installed on the local machine against the checksum
+ which was recorded in the +CONTENTS files at package installation
+ time. Symbolic links also have their integrity checked against
+ the recorded value at package installation time. If no addi-
+ tional argument is given, the files of all installed packages are
+ checked, else only the named packages will be checked (wildcards
+ can be used here, see pkg_info(1)).
+
+ The packages' +CONTENTS files will be parsed and the checksum
will be checked for every file found. A warning message is
printed if the expected checksum differs from the checksum of the
- file on disk.
+ file on disk. Symbolic links are also checked, ensuring that the
+ targets on disk are the same as the contents recorded at package
+ installation time.
ddeelleettee _p_k_g _._._.
For each listed package, remove all file entries in the package
@@ -133,4 +137,4 @@ HHIISSTTOORRYY
AAUUTTHHOORRSS
The ppkkgg__aaddmmiinn command was written by Hubert Feyrer.
-NetBSD 1.6 September 8, 2003 NetBSD 1.6
+NetBSD 1.6 January 26, 2004 NetBSD 1.6
diff --git a/pkgtools/pkg_install/files/create/pl.c b/pkgtools/pkg_install/files/create/pl.c
index 3e69e52ba82..2dfabc53290 100644
--- a/pkgtools/pkg_install/files/create/pl.c
+++ b/pkgtools/pkg_install/files/create/pl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl.c,v 1.6 2003/10/29 23:00:28 jlam Exp $ */
+/* $NetBSD: pl.c,v 1.7 2004/02/07 10:37:52 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
#else
-__RCSID("$NetBSD: pl.c,v 1.6 2003/10/29 23:00:28 jlam Exp $");
+__RCSID("$NetBSD: pl.c,v 1.7 2004/02/07 10:37:52 grant Exp $");
#endif
#endif
@@ -123,11 +123,13 @@ check_list(char *home, package_t *pkg, const char *PkgName)
struct stat st;
plist_t *tmp;
plist_t *p;
- char name[FILENAME_MAX];
char buf[ChecksumHeaderLen + LegibleChecksumLen];
+ char target[FILENAME_MAX + SymlinkHeaderLen];
+ char name[FILENAME_MAX];
char *cwd = home;
char *srcdir = NULL;
int dirc;
+ int cc;
/* Open Package Database for writing */
if (update_pkgdb && !pkgdb_open(ReadWrite)) {
@@ -203,6 +205,24 @@ check_list(char *home, package_t *pkg, const char *PkgName)
if (RelativeLinks) {
CheckSymlink(name, cwd, strlen(cwd));
}
+ (void) strlcpy(target, SYMLINK_HEADER,
+ sizeof(target));
+ if ((cc = readlink(name, &target[SymlinkHeaderLen],
+ sizeof(target) - SymlinkHeaderLen)) < 0) {
+ warnx("can't readlink `%s'", name);
+ continue;
+ }
+ target[SymlinkHeaderLen + cc] = 0x0;
+ tmp = new_plist_entry();
+ tmp->name = strdup(target);
+ tmp->type = PLIST_COMMENT;
+ tmp->next = p->next;
+ tmp->prev = p;
+ if (p == pkg->tail) {
+ pkg->tail = tmp;
+ }
+ p->next = tmp;
+ p = tmp;
break;
case S_IFCHR:
warnx("Warning - char special device `%s' in PLIST", name);
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c
index 8ce28d54c0e..4efa9381b75 100644
--- a/pkgtools/pkg_install/files/delete/perform.c
+++ b/pkgtools/pkg_install/files/delete/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.10 2003/10/29 23:00:28 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.11 2004/02/07 10:37:52 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.10 2003/10/29 23:00:28 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.11 2004/02/07 10:37:52 grant Exp $");
#endif
#endif
@@ -783,6 +783,9 @@ pkg_do(char *pkg)
"couldn't entirely delete package `%s'\n"
"(perhaps the packing list is incorrectly specified?)", pkg);
}
+ else { /* Fake means Verbose */
+ printf("Attempting to delete package `%s'\n", pkg);
+ }
if (!isemptyfile(DEPOT_FNAME)) {
if (Verbose)
printf("Attempting to remove the %s registration on package `%s'\n", VIEWS_FNAME, pkg);
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.1 b/pkgtools/pkg_install/files/delete/pkg_delete.1
index 6739c780849..04fbd7d3ee8 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.5 2003/09/23 07:13:50 grant Exp $
+.\" $NetBSD: pkg_delete.1,v 1.6 2004/02/07 10:37:52 grant Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -126,14 +126,13 @@ For most packages, the prefix will
be set automatically to the installed location by
.Xr pkg_add 1 .
.It Fl R
-Like the
-.Fl r
-option, this does a recursive delete.
-The
+This option triggers a recursive delete of the given package and any
+packages it depends on, unless some other package still needs a
+dependent package.
+This
.Fl R
-option deletes the given package and any packages required by
-it, unless some other package still needs them.
-This can be used to delete a package and all the packages it needs.
+option can be used to clean up by deleting a package and all its
+then-unneeded dependent packages.
.It Fl r
.Nm
first builds a list of all packages that require (directly and indirectly)
@@ -141,6 +140,10 @@ the one being deleted.
It then deletes these packages using
.Nm
with the given options before deleting the user specified package.
+This
+.Fl r
+option can be used to recursively delete a package and all of the
+packages which depend on that package.
.It Fl V
Print version number and exit.
.It Fl v
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.cat1 b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
index d5ba518a894..67c1e8af887 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.cat1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
@@ -72,15 +72,17 @@ OOPPTTIIOONNSS
packages, the prefix will be set automatically to the installed
location by pkg_add(1).
- --RR Like the --rr option, this does a recursive delete. The --RR option
- deletes the given package and any packages required by it, unless
- some other package still needs them. This can be used to delete
- a package and all the packages it needs.
+ --RR This option triggers a recursive delete of the given package and
+ any packages it depends on, unless some other package still needs
+ a dependent package. This --RR option can be used to clean up by
+ deleting a package and all its then-unneeded dependent packages.
--rr ppkkgg__ddeelleettee first builds a list of all packages that require
(directly and indirectly) the one being deleted. It then deletes
these packages using ppkkgg__ddeelleettee with the given options before
- deleting the user specified package.
+ deleting the user specified package. This --rr option can be used
+ to recursively delete a package and all of the packages which
+ depend on that package.
--VV Print version number and exit.
diff --git a/pkgtools/pkg_install/files/info/pkg_info.1 b/pkgtools/pkg_install/files/info/pkg_info.1
index 22aa621c952..c2486d69c5c 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.1
+++ b/pkgtools/pkg_install/files/info/pkg_info.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.7 2004/01/06 16:23:29 wiz Exp $
+.\" $NetBSD: pkg_info.1,v 1.8 2004/02/07 10:37:53 grant Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
diff --git a/pkgtools/pkg_install/files/info/pkg_info.cat1 b/pkgtools/pkg_install/files/info/pkg_info.cat1
index 3c3599df601..d4116848e6e 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.cat1
+++ b/pkgtools/pkg_install/files/info/pkg_info.cat1
@@ -14,10 +14,10 @@ DDEESSCCRRIIPPTTIIOONN
the pkg_create(1) command.
The _p_k_g_-_n_a_m_e may be the name of an installed package (with our without
- version), a pattern matching several installed packages (see the --ee
- switch for a description of possible patterns), the pathname to a package
- distribution file, a filename belonging to an installed package (if --FF is
- also given), or a URL to an ftp-available package.
+ version), a pattern matching several installed packages (see the _P_A_C_K_A_G_E
+ _W_I_L_D_C_A_R_D_S section for a description of possible patterns), the pathname
+ to a binary package, a filename belonging to an installed package (if --FF
+ is also given), or a URL to an ftp-available package.
The following command-line options are supported:
@@ -38,33 +38,12 @@ DDEESSCCRRIIPPTTIIOONN
--dd Show the long-description field for each package.
--ee _p_k_g_-_n_a_m_e
- This option allows you to test for the presence of another (per-
- haps prerequisite) package from a script. If the package identi-
- fied by _p_k_g_-_n_a_m_e is currently installed, return 0, otherwise
- return 1. In addition, the names of any package(s) found
- installed are printed to stdout unless turned off using the --qq
- option.
-
- If the given _p_k_g_-_n_a_m_e contains a shell meta character, it will be
- matched against all installed packages using fnmatch(3). csh(1)
- style {,} alternates have also been implemented in addition to
- this. Package version numbers can also be matched in a rela-
- tional manner using the _>_=_, _<_=_, _> and _< operators. For example,
- _p_k_g___i_n_f_o _-_e _'_n_a_m_e_>_=_1_._3_' will match versions 1.3 and later of the
- _n_a_m_e package. The collating sequence of the various package ver-
- sion numbers is unusual, but strives to be consistent. The magic
- string ``alpha'' equates to _a_l_p_h_a _v_e_r_s_i_o_n and sorts before a beta
- version. The magic string ``beta'' equates to _b_e_t_a _v_e_r_s_i_o_n and
- sorts before a release candidate. The magic string ``rc''
- equates to _r_e_l_e_a_s_e _c_a_n_d_i_d_a_t_e and sorts before a release. For
- example, _n_a_m_e_-_1_._3_r_c_3 will sort before _n_a_m_e_-_1_._3 and after
- _n_a_m_e_-_1_._2_._9 Similarly _n_a_m_e_-_1_._3_a_l_p_h_a_2 will sort before
- _n_a_m_e_-_1_._3_b_e_t_a_1 and they both sort before _n_a_m_e_-_1_._3_r_c_1 In addition,
- alphabetic characters sort in the same place as their numeric
- counterparts, so that _n_a_m_e_-_1_._2_e has the same sorting value as
- _n_a_m_e_-_1_._2_._5 The magic string ``pl'' equates to a _p_a_t_c_h _l_e_v_e_l and
- has the same value as a dot in the dewey-decimal ordering
- schemes.
+ This option allows you to test for the existence of a given pack-
+ age. If the package identified by _p_k_g_-_n_a_m_e is currently
+ installed, return code is 0, otherwise 1. The names of any pack-
+ age(s) found installed are printed to stdout unless turned off
+ using the --qq option. _p_k_g_-_n_a_m_e can contain wildcards, see the
+ _P_A_C_K_A_G_E _W_I_L_D_C_A_R_D_S section below.
--FF Interpret any pkg-name given as filename, and translate it to a
package name using the Package Database. This can be used to
@@ -122,6 +101,40 @@ DDEESSCCRRIIPPTTIIOONN
--vv Turn on verbose output.
+TTEECCHHNNIICCAALL DDEETTAAIILLSS
+ Package info is either extracted from package files named on the command
+ line, or from already installed package information in
+ _/_v_a_r_/_d_b_/_p_k_g_/_<_p_k_g_-_n_a_m_e_>.
+
+ A filename can be given instead of a (installed) package name to query
+ information on the package this file belongs to. This filename is then
+ resolved to a package name using the Package Database. For this transla-
+ tion to take place, the --FF flag must be given. The filename must be
+ absolute, compare the output of pkg_info --aaFF.
+
+PPAACCKKAAGGEE WWIILLDDCCAARRDDSS
+ In the places where a package name/version is expected, e.g. for the --ee
+ switch, several forms can be used. Either use a package name with or
+ without version, or specify a package wildcard that gets matched against
+ all installed packages.
+
+ Package wildcards use fnmatch(3). In addition, csh(1) style {,} alter-
+ nates have also been implemented. Package version numbers can also be
+ matched in a relational manner using the _>_=, _<_=, _>, and _< operators. For
+ example, _p_k_g___i_n_f_o _-_e _'_n_a_m_e_>_=_1_._3_' will match versions 1.3 and later of the
+ _n_a_m_e package. The collating sequence of the various package version num-
+ bers is unusual, but strives to be consistent. The magic string
+ ``alpha'' equates to _a_l_p_h_a _v_e_r_s_i_o_n and sorts before a beta version. The
+ magic string ``beta'' equates to _b_e_t_a _v_e_r_s_i_o_n and sorts before a release
+ candidate. The magic string ``rc'' equates to _r_e_l_e_a_s_e _c_a_n_d_i_d_a_t_e and
+ sorts before a release. For example, _n_a_m_e_-_1_._3_r_c_3 will sort before
+ _n_a_m_e_-_1_._3 and after _n_a_m_e_-_1_._2_._9 Similarly _n_a_m_e_-_1_._3_a_l_p_h_a_2 will sort before
+ _n_a_m_e_-_1_._3_b_e_t_a_1 and they both sort before _n_a_m_e_-_1_._3_r_c_1 In addition, alpha-
+ betic characters sort in the same place as their numeric counterparts, so
+ that _n_a_m_e_-_1_._2_e has the same sorting value as _n_a_m_e_-_1_._2_._5 The magic string
+ ``pl'' equates to a _p_a_t_c_h _l_e_v_e_l and has the same value as a dot in the
+ dewey-decimal ordering schemes.
+
EENNVVIIRROONNMMEENNTT
PKG_DBDIR If the --KK flag isn't given, then PKG_DBDIR is the location of
the package database directory. The default package database
@@ -146,17 +159,6 @@ EENNVVIIRROONNMMEENNTT
these environment variables would ever need to be used to work
around limited available space in the default locations.
-TTEECCHHNNIICCAALL DDEETTAAIILLSS
- Package info is either extracted from package files named on the command
- line, or from already installed package information in
- _/_v_a_r_/_d_b_/_p_k_g_/_<_p_k_g_-_n_a_m_e_>.
-
- A filename can be given instead of a (installed) package name to query
- information on the package this file belongs to. This filename is then
- resolved to a package name using the Package Database. For this transla-
- tion to take place, the --FF flag must be given. The filename must be
- absolute, compare the output of pkg_info --aaFF.
-
SSEEEE AALLSSOO
pkg_add(1), pkg_admin(1), pkg_create(1), pkg_delete(1), mktemp(3),
packages(7), mtree(8)
@@ -170,4 +172,4 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, depends displaying,
pkg size display etc.
-NetBSD 1.6 September 2, 2003 NetBSD 1.6
+NetBSD 1.6 January 6, 2004 NetBSD 1.6
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index 34bd366288a..2e6cd9d7520 100644
--- a/pkgtools/pkg_install/files/lib/lib.h
+++ b/pkgtools/pkg_install/files/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.8 2004/01/14 23:55:29 jlam Exp $ */
+/* $NetBSD: lib.h,v 1.9 2004/02/07 10:37:53 grant Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -215,10 +215,12 @@ typedef struct package_t {
plist_t *tail; /* tail of list */
} package_t;
+#define SYMLINK_HEADER "Symlink:"
#define CHECKSUM_HEADER "MD5:"
enum {
ChecksumHeaderLen = 4, /* strlen(CHECKSUM_HEADER) */
+ SymlinkHeaderLen = 8, /* strlen(SYMLINK_HEADER) */
ChecksumLen = 16,
LegibleChecksumLen = 33
};
diff --git a/pkgtools/pkg_install/files/lib/plist.c b/pkgtools/pkg_install/files/lib/plist.c
index c8f93c48f16..ded4b8780ab 100644
--- a/pkgtools/pkg_install/files/lib/plist.c
+++ b/pkgtools/pkg_install/files/lib/plist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: plist.c,v 1.7 2003/09/23 13:22:42 grant Exp $ */
+/* $NetBSD: plist.c,v 1.8 2004/02/07 10:37:53 grant Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
-__RCSID("$NetBSD: plist.c,v 1.7 2003/09/23 13:22:42 grant Exp $");
+__RCSID("$NetBSD: plist.c,v 1.8 2004/02/07 10:37:53 grant Exp $");
#endif
#endif
@@ -381,16 +381,36 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
warnx("attempting to delete directory `%s' as a file\n"
"this packing list is incorrect - ignoring delete request", tmp);
} else {
- if (p->next &&
- p->next->type == PLIST_COMMENT && /* || PLIST_MD5 - HF */
- strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
- char *cp, buf[LegibleChecksumLen];
-
- if ((cp = MD5File(tmp, buf)) != NULL) {
- /* Mismatch? */
- if (strcmp(cp, p->next->name + ChecksumHeaderLen) != 0) {
- printf("original MD5 checksum failed, %s: %s\n",
- Force ? "deleting anyway" : "not deleting", tmp);
+ if (p->next && p->next->type == PLIST_COMMENT) {
+ if (strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
+ char *cp, buf[LegibleChecksumLen];
+
+ if ((cp = MD5File(tmp, buf)) != NULL) {
+ /* Mismatch? */
+ if (strcmp(cp, p->next->name + ChecksumHeaderLen) != 0) {
+ printf("original MD5 checksum failed, %s: %s\n",
+ Force ? "deleting anyway" : "not deleting", tmp);
+ if (!Force) {
+ fail = FAIL;
+ continue;
+ }
+ }
+ }
+ } else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
+ char buf[FILENAME_MAX + SymlinkHeaderLen];
+ int cc;
+
+ (void) strlcpy(buf, SYMLINK_HEADER,
+ sizeof(buf));
+ if ((cc = readlink(tmp, &buf[SymlinkHeaderLen],
+ sizeof(buf) - SymlinkHeaderLen)) < 0) {
+ warnx("can't readlink `%s'", tmp);
+ continue;
+ }
+ buf[SymlinkHeaderLen + cc] = 0x0;
+ if (strcmp(buf, p->next->name) != 0) {
+ printf("symlink %s is not same as recorded value, %s: %s\n",
+ buf, Force ? "deleting anyway" : "not deleting", tmp);
if (!Force) {
fail = FAIL;
continue;
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 56253168af5..4b92bb5a2d8 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.22 2004/01/14 23:55:29 jlam Exp $ */
+/* $NetBSD: version.h,v 1.23 2004/02/07 10:37:53 grant Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20040114"
+#define PKGTOOLS_VERSION "20040115"
#endif /* _INST_LIB_VERSION_H_ */