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 Split pattern related funct...
details: https://anonhg.NetBSD.org/pkgsrc/rev/d86171dd7568
branches: trunk
changeset: 531138:d86171dd7568
user: joerg <joerg%pkgsrc.org@localhost>
date: Fri Jul 20 22:22:52 2007 +0000
description:
Split pattern related functions from lib/str.c off into lib/opattern.c.
Rename pmatch to pkg_match and add new function pkg_order that
implements the order logic used by pkg_add internally.
Change the interface of findmatchingname's callback to take the pattern
used for the matching as first argument. The new pkg_order function
takes it and it doesn't hurt in other cases. Adjust callers and
corresponding callbacks accordingly.
Remove an unused matchfn typedef in dewey.c.
Bump to 20070720. OK jlam@
diffstat:
pkgtools/pkg_install/files/add/perform.c | 8 +-
pkgtools/pkg_install/files/admin/main.c | 18 +-
pkgtools/pkg_install/files/audit-packages/audit-packages.c | 10 +-
pkgtools/pkg_install/files/delete/perform.c | 8 +-
pkgtools/pkg_install/files/info/perform.c | 6 +-
pkgtools/pkg_install/files/lib/Makefile.in | 6 +-
pkgtools/pkg_install/files/lib/dewey.c | 3 +-
pkgtools/pkg_install/files/lib/ftpio.c | 16 +-
pkgtools/pkg_install/files/lib/lib.h | 13 +-
pkgtools/pkg_install/files/lib/opattern.c | 165 +++++++++++++
pkgtools/pkg_install/files/lib/str.c | 116 +--------
pkgtools/pkg_install/files/lib/version.h | 4 +-
12 files changed, 221 insertions(+), 152 deletions(-)
diffs (truncated from 713 to 300 lines):
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.47 2007/04/20 14:25:13 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.48 2007/07/20 22:22:52 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -14,7 +14,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.47 2007/04/20 14:25:13 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.48 2007/07/20 22:22:52 joerg Exp $");
#endif
#endif
@@ -583,7 +583,7 @@
/*
* step into pkg2chk, read it's +CONTENTS file and see if
- * all @pkgdep lines agree with PkgName (using pmatch())
+ * all @pkgdep lines agree with PkgName (using pkg_match())
*/
snprintf(depC, sizeof(depC), "%s/%s/%s", dbdir, pkg2chk, CONTENTS_FNAME);
depf = fopen(depC , "r");
@@ -630,7 +630,7 @@
}
if (strcmp(base_new, base_exist) == 0) {
/* Same pkg, so do the interesting compare */
- if (pmatch(depp->name, PkgName)) {
+ if (pkg_match(depp->name, PkgName)) {
if (Verbose)
printf("@pkgdep check: %s is ok for %s (in %s pkg)\n",
PkgName, depp->name, pkg2chk);
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.20 2006/04/04 06:25:59 wiz Exp $ */
+/* $NetBSD: main.c,v 1.21 2007/07/20 22:22:52 joerg 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.20 2006/04/04 06:25:59 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2007/07/20 22:22:52 joerg Exp $");
#endif
/*
@@ -83,7 +83,7 @@
static int quiet;
-static int checkpattern_fn(const char *, void *);
+static int checkpattern_fn(const char *, const char *, void *);
static void set_unset_variable(char **, Boolean);
/* print usage message and exit */
@@ -414,7 +414,7 @@
}
static int
-checkpattern_fn(const char *pkg, void *vp)
+checkpattern_fn(const char *pattern, const char *pkg, void *vp)
{
int rc;
@@ -433,7 +433,7 @@
}
static int
-lspattern_fn(const char *pkg, void *vp)
+lspattern_fn(const char *pattern, const char *pkg, void *vp)
{
char *data = vp;
printf("%s/%s\n", data, pkg);
@@ -441,7 +441,7 @@
}
static int
-lsbasepattern_fn(const char *pkg, void *vp)
+lsbasepattern_fn(const char *pattern, const char *pkg, void *vp)
{
printf("%s\n", pkg);
return 0;
@@ -523,7 +523,7 @@
pattern = argv[0];
pkg = argv[1];
- if (pmatch(pattern, pkg)){
+ if (pkg_match(pattern, pkg)){
return 0;
} else {
return 1;
@@ -757,7 +757,7 @@
};
static int
-set_installed_info_var(const char *name, void *ud)
+set_installed_info_var(const char *pattern, const char *name, void *ud)
{
char filename[BUFSIZ];
struct varval *varval;
@@ -823,7 +823,7 @@
ret++;
}
} else if (isdir(*argv) || islinktodir(*argv))
- set_installed_info_var(*argv, &varval);
+ set_installed_info_var(NULL, *argv, &varval);
else {
/* try 'pkg-[0-9]*' */
char try[MaxPathSize];
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/audit-packages/audit-packages.c
--- a/pkgtools/pkg_install/files/audit-packages/audit-packages.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/audit-packages/audit-packages.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audit-packages.c,v 1.1 2007/07/14 20:17:08 adrianp Exp $ */
+/* $NetBSD: audit-packages.c,v 1.2 2007/07/20 22:22:52 joerg Exp $ */
/*
* Copyright (c) 2007 Adrian Portelli <adrianp%NetBSD.org@localhost>.
@@ -105,7 +105,7 @@
int main(int, char **);
void *safe_calloc(size_t, size_t);
char *ap_fixpkgname(char *);
-static int foundpkg(const char *, void *);
+static int foundpkg(const char *, const char *, void *);
static int checkforpkg(char *);
void usage(void);
int dvl(void);
@@ -460,12 +460,12 @@
/*
* if we're checking for just one package (i.e.
* check_one) regardless if it's installed or not
- * (i.e. -n and -p) then use pmatch
+ * (i.e. -n and -p) then use pkg_match
* to see if we have a hit using pattern
* matching.
*/
- if ((pmatch(pv_entry[0], one_package)) == 1) {
+ if ((pkg_match(pv_entry[0], one_package)) == 1) {
/* flag to indicate we have found something */
vuln_found = TRUE;
@@ -645,7 +645,7 @@
/* called by checkforpkg to see if a package exists */
static int
-foundpkg(const char *found, void *vp)
+foundpkg(const char *pattern, const char *found, void *vp)
{
char *data = vp;
char *buf;
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/delete/perform.c
--- a/pkgtools/pkg_install/files/delete/perform.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/delete/perform.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.16 2005/05/30 13:23:31 wiz Exp $ */
+/* $NetBSD: perform.c,v 1.17 2007/07/20 22:22:52 joerg 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.16 2005/05/30 13:23:31 wiz Exp $");
+__RCSID("$NetBSD: perform.c,v 1.17 2007/07/20 22:22:52 joerg Exp $");
#endif
#endif
@@ -83,7 +83,7 @@
static int require_find(char *, rec_find_t);
static int require_delete(char *, int);
static void require_print(void);
-static int undepend(const char *, void *);
+static int undepend(const char *, const char *, void *);
static char LogDir[MaxPathSize];
static char linebuf[MaxPathSize];
@@ -118,7 +118,7 @@
* findmatchingname(), deppkgname is expanded from a (possible) pattern.
*/
static int
-undepend(const char *deppkgname, void *vp)
+undepend(const char *pattern, const char *deppkgname, void *vp)
{
char *pkg2delname = vp;
char fname[MaxPathSize], ftmp[MaxPathSize];
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/info/perform.c
--- a/pkgtools/pkg_install/files/info/perform.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/info/perform.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.30 2007/03/11 22:05:03 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.31 2007/07/20 22:22:52 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -14,7 +14,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.30 2007/03/11 22:05:03 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.31 2007/07/20 22:22:52 joerg Exp $");
#endif
#endif
@@ -334,7 +334,7 @@
* Function to be called for pkgs found
*/
static int
-foundpkg(const char *found, void *vp)
+foundpkg(const char *pattern, const char *found, void *vp)
{
char *data = vp;
char buf[MaxPathSize+1];
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/lib/Makefile.in
--- a/pkgtools/pkg_install/files/lib/Makefile.in Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/Makefile.in Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.14 2007/07/16 09:57:59 joerg Exp $
+# $NetBSD: Makefile.in,v 1.15 2007/07/20 22:22:53 joerg Exp $
srcdir= @srcdir@
@@ -24,8 +24,8 @@
LIB= libinstall.a
-OBJS= automatic.o dewey.o fexec.o file.o ftpio.o global.o lpkg.o path.o pen.o \
- pexec.o pkgdb.o plist.o str.o var.o version.o
+OBJS= automatic.o dewey.o fexec.o file.o ftpio.o global.o lpkg.o opattern.o \
+ path.o pen.o pexec.o pkgdb.o plist.o str.o var.o version.o
all: $(LIB)
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/lib/dewey.c
--- a/pkgtools/pkg_install/files/lib/dewey.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/dewey.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dewey.c,v 1.5 2006/04/04 06:30:10 wiz Exp $ */
+/* $NetBSD: dewey.c,v 1.6 2007/07/20 22:22:53 joerg Exp $ */
/*
* Copyright © 2002 Alistair G. Crooks. All rights reserved.
@@ -44,7 +44,6 @@
#include "dewey.h"
#define PKG_PATTERN_MAX 1024
-typedef int (*matchfn) (const char *, void *);
/* do not modify these values, or things will NOT work */
enum {
diff -r b95e44d4cd57 -r d86171dd7568 pkgtools/pkg_install/files/lib/ftpio.c
--- a/pkgtools/pkg_install/files/lib/ftpio.c Fri Jul 20 19:39:33 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/ftpio.c Fri Jul 20 22:22:52 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpio.c,v 1.22 2007/07/14 22:57:15 joerg Exp $ */
+/* $NetBSD: ftpio.c,v 1.23 2007/07/20 22:22:53 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.22 2007/07/14 22:57:15 joerg Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.23 2007/07/20 22:22:53 joerg Exp $");
#endif
/*-
@@ -686,7 +686,7 @@
/* replace possible version(wildcard) given with "-*".
* we can't use the pkg wildcards here as dewey compare
* and alternates won't be handled by ftp(1); sort
- * out later, using pmatch() */
+ * out later, using pkg_match() */
if (retry_tbz) {
retry_with_tbz:
(void) snprintf(buf, sizeof(buf), "nlist %.*s*.tbz %s\n",
@@ -742,11 +742,11 @@
strip_txz(s_filename, NULL, filename);
strip_txz(s_pattern, NULL, pattern);
- if (pmatch(s_pattern, s_filename)) {
+ if (pkg_match(s_pattern, s_filename)) {
matches++;
/* compare findbestmatchingname() */
- findbestmatchingname_fn(filename, best);
+ findbestmatchingname_fn(pattern, filename, best);
}
}
(void) fclose(f);
Home |
Main Index |
Thread Index |
Old Index