diff options
author | wiz <wiz> | 2003-07-13 16:15:34 +0000 |
---|---|---|
committer | wiz <wiz> | 2003-07-13 16:15:34 +0000 |
commit | 3a35a8eddbee764ccaf7498692c949126dd3f6e8 (patch) | |
tree | 91e9ff07e8b4ceb529ee9dec8cd068dd06381512 | |
parent | 6b615426db9551d241993b72dccd79c52051ba45 (diff) | |
download | pkgsrc-3a35a8eddbee764ccaf7498692c949126dd3f6e8.tar.gz |
Initial import of pkg_filecheck, a tool to compare the file system
contents with the package database, reporting files that are in
the file system but not in the package database.
Written by Dieter Baron (dillo@) with man pages from Thomas Klausner (wiz@).
-rw-r--r-- | pkgtools/pkg_filecheck/DESCR | 3 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/Makefile | 45 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/PLIST | 8 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/builddb.1 | 65 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/builddb.pl | 133 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/pkg_filecheck.1 | 65 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/pkg_filecheck.c | 315 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/pkg_filecheck.conf | 17 | ||||
-rw-r--r-- | pkgtools/pkg_filecheck/files/pkg_filecheck.conf.5 | 75 |
9 files changed, 726 insertions, 0 deletions
diff --git a/pkgtools/pkg_filecheck/DESCR b/pkgtools/pkg_filecheck/DESCR new file mode 100644 index 00000000000..d054ef1d3e2 --- /dev/null +++ b/pkgtools/pkg_filecheck/DESCR @@ -0,0 +1,3 @@ +pkg_filecheck compares the file system contents with the list of +files recorded in the package database, and reports any files that +are in the file system, but not in the database. diff --git a/pkgtools/pkg_filecheck/Makefile b/pkgtools/pkg_filecheck/Makefile new file mode 100644 index 00000000000..7d70dd49216 --- /dev/null +++ b/pkgtools/pkg_filecheck/Makefile @@ -0,0 +1,45 @@ +# $NetBSD: Makefile,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +# + +DISTNAME= pkg_filecheck-0.1 +WRKSRC= ${WRKDIR} +CATEGORIES= pkgtools devel +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= dillo@netbsd.org +#HOMEPAGE= http://www.netbsd.org/Documentation/netbsd/Packages.txt +COMMENT= check for files not owned by any package + +USE_PERL5= run + +EXTRACT_ONLY= # empty +NO_CHECKSUM= yes +NO_CONFIGURE= yes + +CONF_FILES= ${PREFIX}/share/examples/pkg_filecheck/pkg_filecheck.conf \ + ${PKG_SYSCONFDIR}/pkg_filecheck.conf + +do-build: +.for f in builddb.pl builddb.1 pkg_filecheck.conf pkg_filecheck.conf.5 \ + pkg_filecheck.c pkg_filecheck.1 + ${SED} -e 's|@PREFIX@|${PREFIX}|g' \ + -e 's|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g' \ + -e 's|@X11PREFIX@|${X11PREFIX}|g' \ + < ${FILESDIR}/${f} \ + > ${WRKSRC}/${f} +.endfor + cd ${WRKSRC} && ${MAKE} pkg_filecheck + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/builddb.pl ${PREFIX}/bin/builddb + ${INSTALL_PROGRAM} ${WRKSRC}/pkg_filecheck ${PREFIX}/bin/pkg_filecheck + ${INSTALL_MAN} ${WRKSRC}/builddb.1 ${PREFIX}/man/man1 + ${INSTALL_MAN} ${WRKSRC}/pkg_filecheck.1 ${PREFIX}/man/man1 + ${INSTALL_MAN} ${WRKSRC}/pkg_filecheck.conf.5 ${PREFIX}/man/man5 + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/pkg_filecheck + ${INSTALL_DATA} ${WRKSRC}/pkg_filecheck.conf \ + ${PREFIX}/share/examples/pkg_filecheck/pkg_filecheck.conf + +.include "../../mk/bsd.pkg.install.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/pkgtools/pkg_filecheck/PLIST b/pkgtools/pkg_filecheck/PLIST new file mode 100644 index 00000000000..7c2575fa179 --- /dev/null +++ b/pkgtools/pkg_filecheck/PLIST @@ -0,0 +1,8 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +bin/builddb +bin/pkg_filecheck +man/man1/builddb.1 +man/man1/pkg_filecheck.1 +man/man5/pkg_filecheck.conf.5 +share/examples/pkg_filecheck/pkg_filecheck.conf +@dirrm share/examples/pkg_filecheck diff --git a/pkgtools/pkg_filecheck/files/builddb.1 b/pkgtools/pkg_filecheck/files/builddb.1 new file mode 100644 index 00000000000..518225d692b --- /dev/null +++ b/pkgtools/pkg_filecheck/files/builddb.1 @@ -0,0 +1,65 @@ +.\" $NetBSD: builddb.1,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +.\" +.\" Copyright (c) 2003 Thomas Klausner +.\" All rights reserved. +.\" +.\" 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 AUTHOR, THOMAS KLAUSNER, +.\" ``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 July 13, 2003 +.Dt BUILDDB 1 +.Os +.Sh NAME +.Nm builddb +.Nd create database from file system or tar file +.Sh SYNOPSIS +.Nm +.Op Fl hv +.Op Fl o Ar db-file +.Ar tar-file | Ar directory +.Op Ar ... +.Sh DESCRIPTION +.Nm +reads the tar file +.Ar tar-file +or the contents of the directory hierarchy starting at +.Ar directory +and creates a database from it which can be used by +.Nm pkg_filecheck . +.Pp +Supported options: +.Bl -tag -width XoXdbXfileX -offset indent +.It Fl h +Display a short help message. +.It Fl o Ar db-file +Use +.Ar db-file +as database output file instead of the default +.Pa /var/db/pkg/xdb.byfile.db . +.It Fl v +Verbose mode. +Report each file found. +.El +.Sh SEE ALSO +.Xr pkg_filecheck 1 +.Sh BUGS +.Nm +is written in Perl. diff --git a/pkgtools/pkg_filecheck/files/builddb.pl b/pkgtools/pkg_filecheck/files/builddb.pl new file mode 100644 index 00000000000..74778cf7bdc --- /dev/null +++ b/pkgtools/pkg_filecheck/files/builddb.pl @@ -0,0 +1,133 @@ +#!@PREFIX@/bin/perl + +# $NetBSD: builddb.pl,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +# +# builddb -- build .byfile.db from tgz files or directory hierarchies. +# Copyright (C) 2000, 2003 Dieter Baron +# +# This file is part of img2eps, an image to EPS file converter. +# The author can be contacted at <dillo@giga.or.at> +# +# 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. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY DIETER BARON ``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 DIETER BARON 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. + +use strict; +use Getopt::Std; +use DB_File; + +my $prg; +my $options = 'hvo:'; +my $usage = '[-hv] [-o db-file] tar-file|directory ...'; +my %opt; +my ($verbose, $dbfile); +my %db; +my ($file, $pkg, $opkg); + +# +# defaults +# + +$verbose = 0; +$dbfile = '/var/db/pkg/xdb.byfile.db'; + +# +# command line handling +# + +($prg) = ($0 =~ /([^\/]+)$/); + +getopts($options, \%opt); + +if ($opt{h}) { + print <<EOF; +usage: $prg $usage + -h display this help message + -o DB-FILE output to DB-FILE + -v verbose mode +EOF + exit 0; +} + +if (@ARGV == 0) { + print STDERR "usage: $prg $usage\n"; + exit 1; +} + +$verbose = $opt{v} if ($opt{v}); +$dbfile = $opt{o} if ($opt{o}); + +# +# setup +# + +tie %db, 'DB_File', $dbfile, O_RDWR|O_CREAT, 0666, $DB_BTREE + or die "cannot open db `$dbfile': $!\n"; + +# +# process tar files +# + +foreach $file (@ARGV) { + if (-f $file) { + unless (open LST, "tar -tzf $file |") { + warn "cannot list `$file': $!\n"; + next; + } + + ($pkg) = ($file =~ m/([^\/]+)\.tgz$/); + } + elsif (-d $file) { + $pkg = $file; + + $file = "`pwd`/$file" unless ($file =~ m!^/!); + unless (open LST, "find $file -type f |") { + warn "cannot list `$file': $!\n"; + next; + } + } + else { + warn "no such file or directory: `$file'"; + next; + } + + while (<LST>) { + chomp; + if (exists($db{"$_\0"})) { + ($opkg = $db{"$_\0"}) =~ s/\0//; + warn "overwriting `$_' (old: $opkg, new: $pkg)\n"; + } + print "$pkg: $_\n" if ($verbose); + $db{"$_\0"} = "$pkg\0"; + } + + close LST; +} + +# +# cleanup +# + +untie %db; diff --git a/pkgtools/pkg_filecheck/files/pkg_filecheck.1 b/pkgtools/pkg_filecheck/files/pkg_filecheck.1 new file mode 100644 index 00000000000..27da94bf175 --- /dev/null +++ b/pkgtools/pkg_filecheck/files/pkg_filecheck.1 @@ -0,0 +1,65 @@ +.\" $NetBSD: pkg_filecheck.1,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +.\" +.\" Copyright (c) 2003 Thomas Klausner +.\" All rights reserved. +.\" +.\" 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 AUTHOR, THOMAS KLAUSNER, +.\" ``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 July 13, 2003 +.Dt PKG_FILECHECK 1 +.Os +.Sh NAME +.Nm pkg_filecheck +.Nd compare file system contents with package database +.Sh SYNOPSIS +.Nm +.Op Fl h +.Op Fl c Ar config-file +.Sh DESCRIPTION +.Nm +reads the package tools database and and compares it with the actual +contents of the directory hierarchy starting at +.Pa @PREFIX@ , +reporting any files that are on the file system, but not in the +database. +The database used and the hierarchy to be checked can be changed +in the config file. +.Pp +Supported options: +.Bl -tag -width XcXconfigXfileX -offset indent +.It Fl c Ar config-file +Use +.Ar config-file +as config file instead of the default +.Pa @PKG_SYSCONFDIR@/pkg_filecheck.conf . +.It Fl h +Display a very short help message. +.El +.Sh SEE ALSO +.Xr builddb 1 +.Sh BUGS +.Nm +does not report files that are in the database, but not in the file +system. +You can use +.Dq Ic pkg_admin Ar check +for that. diff --git a/pkgtools/pkg_filecheck/files/pkg_filecheck.c b/pkgtools/pkg_filecheck/files/pkg_filecheck.c new file mode 100644 index 00000000000..b372c625d69 --- /dev/null +++ b/pkgtools/pkg_filecheck/files/pkg_filecheck.c @@ -0,0 +1,315 @@ +/* + $NetBSD: pkg_filecheck.c,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ + + pkg_filecheck.c -- check for files not owned by any package + Copyright (C) 2001 Dieter Baron + + 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. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY DIETER BARON ``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 DIETER BARON 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. +*/ + +#include <sys/types.h> +#include <sys/stat.h> +#include <db.h> +#include <errno.h> +#include <fcntl.h> +#include <fts.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +struct array { + void **p; + int len, alen; +}; + +char *prg; + +static int check(char **dir, DB **db, char **ignore); +static int fts_sort(const FTSENT **e1, const FTSENT **e2); +static void push(struct array *a, void *el); +static int read_conf(char *fname, char ***dirp, DB ***dbp, char ***ignorep); + + + +int +main(int argc, char *argv[]) +{ + DB **db; + char **dir, **ignore; + + char *cfgfile; + int c, i, err; + + prg = argv[0]; + opterr = 0; + + cfgfile = "@PKG_SYSCONFDIR@/pkg_filecheck.conf"; + + while ((c=getopt(argc, argv, "c:h")) != -1) { + switch (c) { + case 'c': + cfgfile = optarg; + break; + + case 'h': + printf("usage: %s [-h] [-c config-file]\n", prg); + exit(0); + + default: + fprintf(stderr, "usage: %s [-h] [-c config-file]\n", prg); + exit(1); + } + } + + if (read_conf(cfgfile, &dir, &db, &ignore) < 0) + exit(1); + + err = check(dir, db, ignore); + + for (i=0; db[i]; i++) + db[i]->close(db[i]); + free(dir); + free(db); + free(ignore); + + exit(err ? 1 : 0); +} + + + +static int +check(char **dir, DB **db, char **ignore) +{ + FTS *fts; + FTSENT *ent; + DBT key, val; + int i, found; + + if ((fts=fts_open(dir, FTS_PHYSICAL, fts_sort)) == NULL) { + fprintf(stderr, "%s: cannot walk direcotry hierarchy: %s", + prg, strerror(errno)); + return -1; + } + + while ((ent=fts_read(fts))) { + switch (ent->fts_info) { + case FTS_F: + key.data = ent->fts_path; + key.size = ent->fts_pathlen+1; + + found = 0; + for (i=0; db[i]; i++) + if (db[i]->get(db[i], &key, &val, 0) == 0) { + found = 1; + break; + } + + if (!found) + printf("%s\n", ent->fts_path); + break; + + case FTS_D: + if (ignore) + for (i=0; ignore[i]; i++) + if (strcmp(ignore[i], ent->fts_path) == 0) { + fts_set(fts, ent, FTS_SKIP); + break; + } + break; + + case FTS_DNR: + fprintf(stderr, "%s: cannot read directory `%s', skipped: %s\n", + prg, ent->fts_path, strerror(ent->fts_errno)); + break; + + case FTS_NS: + fprintf(stderr, "%s: cannot stat file `%s', skipped: %s\n", + prg, ent->fts_path, strerror(ent->fts_errno)); + break; + + case FTS_ERR: + fprintf(stderr, "%s: directory traversal error: %s\n", + prg, strerror(ent->fts_errno)); + break; + + case FTS_DC: + case FTS_DP: + case FTS_SL: + case FTS_SLNONE: + case FTS_DEFAULT: + /* ignore */ + break; + + default: + fprintf(stderr, "%s: unknown FTSENT type %d ignored\n", + prg, ent->fts_info); + break; + } + } + + fts_close(fts); + return 0; +} + + + +static int +fts_sort(const FTSENT **e1, const FTSENT **e2) +{ + return strcmp((*e1)->fts_name, (*e2)->fts_name); +} + + + +static int +read_conf(char *fname, char ***dirp, DB ***dbp, char ***ignorep) +{ + struct array dir, db, ignore; + FILE *f; + DB *cdb; + char b[8192], *curd, *dbname, *cmd, *p; + int lineno, err; + + dir.p = db.p = ignore.p = NULL; + dir.len = db.len = ignore.len = 0; + dir.alen = db.alen = ignore.alen = 0; + + if ((f=fopen(fname, "r")) == NULL) { + fprintf(stderr, "%s: cannot open config file `%s': %s\n", + prg, fname, strerror(errno)); + return -1; + } + + curd = NULL; + + lineno = 0; + while (fgets(b, 8192, f)) { + lineno++; + if (b[0] == '#') + continue; + + cmd = b+strspn(b, " \t"); + p = cmd+strcspn(cmd, " \t\n"); + *(p++) = '\0'; + p += strspn(p, " \t"); + if (*p == '\n' || *p == '\0') + continue; + + if (p[strlen(p)-1] == '\n') + p[strlen(p)-1] = '\0'; + + if (strcmp(cmd, "dir") == 0) { + free(curd); + curd = strdup(p); + } + else if (strcmp(cmd, "db") == 0) { + if (curd) { + dbname = malloc(strlen(curd) + strlen(p) + 2); + sprintf(dbname, "%s/%s", curd, p); + } + else + dbname = p; + if ((cdb=dbopen(dbname, O_RDONLY, 0, DB_BTREE, NULL)) == NULL) { + fprintf(stderr, "%s:%s:%d: cannot open data base `%s': %s\n", + prg, fname, lineno, dbname, strerror(errno)); + free(dir.p); + free(db.p); + free(ignore.p); + return -1; + } + else + push(&db, cdb); + + if (curd) + free(dbname); + } + else if (strcmp(cmd, "check") == 0) + push(&dir, strdup(p)); + else if (strcmp(cmd, "ignore") == 0) + push(&ignore, strdup(p)); + else { + fprintf(stderr, "%s:%s:%d: unrecognized command `%s'\n", + prg, fname, lineno, cmd); + } + } + + fclose(f); + + err = 0; + + if (dir.p == NULL) { + fprintf(stderr, "%s: no directories to check\n", + prg); + err = 1; + } + if (db.p == NULL) { + fprintf(stderr, "%s: no file data bases given\n", + prg); + err = 1; + } + + if (err) { + free(dir.p); + free(db.p); + free(ignore.p); + return -1; + } + + *dirp = (char **)dir.p; + *dbp = (DB **)db.p; + *ignorep = (char **)ignore.p; + + return 0; +} + + + +static void +push(struct array *a, void *el) +{ + int alen; + void *p; + + if (a->len + 2 > a->alen) { + if (a->alen > 1024) + alen = a->alen+1024; + else + alen = a->alen * 2; + + if ((p=realloc(a->p, alen*sizeof(void *))) == NULL) { + fprintf(stderr, "%s: malloc failure\n", prg); + exit(1); + } + + a->p = p; + a->alen = alen; + } + + a->p[a->len++] = el; + a->p[a->len] = NULL; +} diff --git a/pkgtools/pkg_filecheck/files/pkg_filecheck.conf b/pkgtools/pkg_filecheck/files/pkg_filecheck.conf new file mode 100644 index 00000000000..1b5878f37ea --- /dev/null +++ b/pkgtools/pkg_filecheck/files/pkg_filecheck.conf @@ -0,0 +1,17 @@ +# $NetBSD: pkg_filecheck.conf,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ + +# location of package database +dir /var/db/pkg +# name of package database +db pkgdb.byfile.db +# installation prefix for packages +check @PREFIX@ + +# If not using xpkgwedge: +# xdb.byfile.db has to be created by running builddb +#db xdb.byfile.db +# installation prefix for X11-based packages +#check @X11PREFIX@ + +ignore @PREFIX@/etc +ignore @PREFIX@/var/scrollkeeper diff --git a/pkgtools/pkg_filecheck/files/pkg_filecheck.conf.5 b/pkgtools/pkg_filecheck/files/pkg_filecheck.conf.5 new file mode 100644 index 00000000000..98ed173f7c9 --- /dev/null +++ b/pkgtools/pkg_filecheck/files/pkg_filecheck.conf.5 @@ -0,0 +1,75 @@ +.\" $NetBSD: pkg_filecheck.conf.5,v 1.1.1.1 2003/07/13 16:15:34 wiz Exp $ +.\" +.\" Copyright (c) 2003 Thomas Klausner +.\" All rights reserved. +.\" +.\" 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 AUTHOR, THOMAS KLAUSNER, +.\" ``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 July 13, 2003 +.Dt PKG_FILECHECK.CONF 5 +.Os +.Sh NAME +.Nm pkg_filecheck.conf +.Nd +.Xr pkg_filecheck 1 +configuration file +.Sh DESCRIPTION +.Nm +configures the behaviour of +.Xr pkg_filecheck 1 . +.Pp +Each line can contain one of the following keywords: +.Bl -tag -width XdbXdbfileX -offset indent +.It Sy check Ar dir +Directory hierarchy to check. +.It Sy db Ar dbfile +Read database +.Ar dbfile +as input file. +.Ar dbfile +currently may not contain a path, just a filename. +.It Sy dir Ar path +Directory containing the database files. +Affects the following +.Sy db +lines (until the next +.Sy dir +line or EOF). +.It Sy ignore Ar dir +Do not report files found in the directory +.Ar dir +(even if they are not in the databases). +.El +.Pp +All keywords can be specified multiple times. +.Pp +Empty lines or lines starting with a hash sign +.Pq Sq # +are ignored. +.Sh SEE ALSO +.Xr pkg_filecheck 1 +.Sh BUGS +.Nm +only allows filenames, not paths, as +.Sy db +arguments. + |