pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files sync with NetBSD-current's ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/511e0bf41f49
branches: trunk
changeset: 467844:511e0bf41f49
user: grant <grant%pkgsrc.org@localhost>
date: Sat Feb 07 10:37:52 2004 +0000
description:
sync with NetBSD-current's pkg_install from 20040207.
diffstat:
pkgtools/pkg_install/files/admin/main.c | 45 +++++++---
pkgtools/pkg_install/files/admin/pkg_admin.1 | 19 +++-
pkgtools/pkg_install/files/admin/pkg_admin.cat1 | 26 +++--
pkgtools/pkg_install/files/create/pl.c | 26 ++++++-
pkgtools/pkg_install/files/delete/perform.c | 7 +-
pkgtools/pkg_install/files/delete/pkg_delete.1 | 19 ++--
pkgtools/pkg_install/files/delete/pkg_delete.cat1 | 12 +-
pkgtools/pkg_install/files/info/pkg_info.1 | 2 +-
pkgtools/pkg_install/files/info/pkg_info.cat1 | 88 +++++++++++-----------
pkgtools/pkg_install/files/lib/lib.h | 4 +-
pkgtools/pkg_install/files/lib/plist.c | 42 ++++++++--
pkgtools/pkg_install/files/lib/version.h | 4 +-
12 files changed, 185 insertions(+), 109 deletions(-)
diffs (truncated from 580 to 300 lines):
diff -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c Sat Feb 07 10:37:52 2004 +0000
@@ -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 @@
(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);
+ }
+ } else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
+ char buf[FILENAME_MAX + SymlinkHeaderLen];
+ int cc;
- free(md5file);
+ (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 -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/admin/pkg_admin.1
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1 Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1 Sat Feb 07 10:37:52 2004 +0000
@@ -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 @@
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 @@
.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 -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/admin/pkg_admin.cat1
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1 Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1 Sat Feb 07 10:37:52 2004 +0000
@@ -4,7 +4,8 @@
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 @@
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 @@
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 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 MD5 checksum
+ 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 @@
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 -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/create/pl.c
--- a/pkgtools/pkg_install/files/create/pl.c Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/create/pl.c Sat Feb 07 10:37:52 2004 +0000
@@ -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 @@
struct stat st;
plist_t *tmp;
plist_t *p;
+ char buf[ChecksumHeaderLen + LegibleChecksumLen];
+ char target[FILENAME_MAX + SymlinkHeaderLen];
char name[FILENAME_MAX];
- char buf[ChecksumHeaderLen + LegibleChecksumLen];
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 @@
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 -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/delete/perform.c
--- a/pkgtools/pkg_install/files/delete/perform.c Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/delete/perform.c Sat Feb 07 10:37:52 2004 +0000
@@ -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 @@
"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 -r 1139bfbd40b2 -r 511e0bf41f49 pkgtools/pkg_install/files/delete/pkg_delete.1
--- a/pkgtools/pkg_install/files/delete/pkg_delete.1 Sat Feb 07 10:37:51 2004 +0000
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1 Sat Feb 07 10:37:52 2004 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index