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 Restore ignorance of entry ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/72f31c60906b
branches: trunk
changeset: 532146:72f31c60906b
user: joerg <joerg%pkgsrc.org@localhost>
date: Sun Aug 12 18:54:08 2007 +0000
description:
Restore ignorance of entry types for lsbest and lsall for now.
The check for already installed packages depends on being able
to run them in PKGDB_DIR. This is clearly obnoxius, but leave it
for later.
diffstat:
pkgtools/pkg_install/files/admin/main.c | 10 +++++-----
pkgtools/pkg_install/files/lib/file.c | 6 +++---
pkgtools/pkg_install/files/lib/iterate.c | 15 +++++++++------
pkgtools/pkg_install/files/lib/lib.h | 8 ++++----
4 files changed, 21 insertions(+), 18 deletions(-)
diffs (167 lines):
diff -r 65d209ff6aa1 -r 72f31c60906b pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c Sun Aug 12 17:51:36 2007 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c Sun Aug 12 18:54:08 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.27 2007/08/12 17:51:36 joerg Exp $ */
+/* $NetBSD: main.c,v 1.28 2007/08/12 18:54:08 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.27 2007/08/12 17:51:36 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2007/08/12 18:54:08 joerg Exp $");
#endif
/*
@@ -708,9 +708,9 @@
err(EXIT_FAILURE, "getcwd");
if (show_basename_only)
- rc = match_local_files(cwd, use_default_sfx, basep, lsbasepattern, NULL);
+ rc = match_local_files(cwd, use_default_sfx, 1, basep, lsbasepattern, NULL);
else
- rc = match_local_files(cwd, use_default_sfx, basep, lspattern, cwd);
+ rc = match_local_files(cwd, use_default_sfx, 1, basep, lspattern, cwd);
if (rc == -1)
errx(EXIT_FAILURE, "Error from match_local_files(\"%s\", \"%s\", ...)",
cwd, basep);
@@ -746,7 +746,7 @@
if (getcwd(cwd, sizeof(cwd)) == NULL)
err(EXIT_FAILURE, "getcwd");
- p = find_best_matching_file(cwd, basep, use_default_sfx);
+ p = find_best_matching_file(cwd, basep, use_default_sfx, 1);
if (p) {
if (show_basename_only)
diff -r 65d209ff6aa1 -r 72f31c60906b pkgtools/pkg_install/files/lib/file.c
--- a/pkgtools/pkg_install/files/lib/file.c Sun Aug 12 17:51:36 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/file.c Sun Aug 12 18:54:08 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.20 2007/08/12 16:47:17 joerg Exp $ */
+/* $NetBSD: file.c,v 1.21 2007/08/12 18:54:09 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -17,7 +17,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
#else
-__RCSID("$NetBSD: file.c,v 1.20 2007/08/12 16:47:17 joerg Exp $");
+__RCSID("$NetBSD: file.c,v 1.21 2007/08/12 18:54:09 joerg Exp $");
#endif
#endif
@@ -324,7 +324,7 @@
return tmp; /* return expanded URL w/ corrent pkg */
}
else if (ispkgpattern(name)) {
- cp = find_best_matching_file(dirname_of(name), basename_of(name), 1);
+ cp = find_best_matching_file(dirname_of(name), basename_of(name), 1, 0);
if (cp) {
snprintf(tmp, sizeof(tmp), "%s/%s", dirname_of(name), cp);
free(cp);
diff -r 65d209ff6aa1 -r 72f31c60906b pkgtools/pkg_install/files/lib/iterate.c
--- a/pkgtools/pkg_install/files/lib/iterate.c Sun Aug 12 17:51:36 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/iterate.c Sun Aug 12 18:54:08 2007 +0000
@@ -68,6 +68,7 @@
struct pkg_dir_iter_arg {
DIR *dirp;
int filter_suffix;
+ int allow_nonfiles;
};
static const char *
@@ -79,7 +80,8 @@
while ((dp = readdir(arg->dirp)) != NULL) {
#if defined(DT_UNKNOWN) && defined(DT_DIR)
- if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_REG)
+ if (arg->allow_nonfiles == 0 &&
+ dp->d_type != DT_UNKNOWN && dp->d_type != DT_REG)
continue;
#endif
len = strlen(dp->d_name);
@@ -98,7 +100,7 @@
* Call matchiter for every package in the directory.
*/
int
-iterate_local_pkg_dir(const char *dir, int filter_suffix,
+iterate_local_pkg_dir(const char *dir, int filter_suffix, int allow_nonfiles,
int (*matchiter)(const char *, void *), void *cookie)
{
struct pkg_dir_iter_arg arg;
@@ -108,6 +110,7 @@
return -1;
arg.filter_suffix = filter_suffix;
+ arg.allow_nonfiles = allow_nonfiles;
retval = iterate_pkg_generic_src(matchiter, cookie, pkg_dir_iter, &arg);
if (closedir(arg.dirp) == -1)
@@ -403,7 +406,7 @@
* If no package matched the pattern or an error occured, return NULL.
*/
char *
-find_best_matching_file(const char *dir, const char *pattern, int filter_suffix)
+find_best_matching_file(const char *dir, const char *pattern, int filter_suffix, int allow_nonfiles)
{
struct best_file_match_arg arg;
@@ -412,7 +415,7 @@
arg.best_current_match = NULL;
arg.best_current_match_filtered = NULL;
- if (iterate_local_pkg_dir(dir, filter_suffix, match_best_file, &arg) == -1) {
+ if (iterate_local_pkg_dir(dir, filter_suffix, allow_nonfiles, match_best_file, &arg) == -1) {
warnx("could not process directory");
return NULL;
}
@@ -472,7 +475,7 @@
* callback returned otherwise.
*/
int
-match_local_files(const char *dir, int filter_suffix, const char *pattern,
+match_local_files(const char *dir, int filter_suffix, int allow_nonfiles, const char *pattern,
int (*cb)(const char *, void *), void *cookie)
{
struct call_matching_file_arg arg;
@@ -482,5 +485,5 @@
arg.cookie = cookie;
arg.filter_suffix = filter_suffix;
- return iterate_local_pkg_dir(dir, filter_suffix, match_file_and_call, &arg);
+ return iterate_local_pkg_dir(dir, filter_suffix, allow_nonfiles, match_file_and_call, &arg);
}
diff -r 65d209ff6aa1 -r 72f31c60906b pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h Sun Aug 12 17:51:36 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h Sun Aug 12 18:54:08 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.33 2007/08/12 16:47:18 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.34 2007/08/12 18:54:09 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -330,16 +330,16 @@
/* Iterator functions */
int iterate_pkg_generic_src(int (*)(const char *, void *), void *,
const char *(*)(void *),void *);
-int iterate_local_pkg_dir(const char *, int, int (*)(const char *, void *),
+int iterate_local_pkg_dir(const char *, int, int, int (*)(const char *, void *),
void *);
int iterate_pkg_db(int (*)(const char *, void *), void *);
int add_installed_pkgs_by_basename(const char *, lpkg_head_t *);
int add_installed_pkgs_by_pattern(const char *, lpkg_head_t *);
char *find_best_matching_installed_pkg(const char *);
-char *find_best_matching_file(const char *, const char *, int);
+char *find_best_matching_file(const char *, const char *, int, int);
int match_installed_pkgs(const char *, int (*)(const char *, void *), void *);
-int match_local_files(const char *, int, const char *, int (*cb)(const char *, void *), void *);
+int match_local_files(const char *, int, int, const char *, int (*cb)(const char *, void *), void *);
/* File */
Boolean fexists(const char *);
Home |
Main Index |
Thread Index |
Old Index