summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2009-05-27 20:26:03 +0000
committerjoerg <joerg@pkgsrc.org>2009-05-27 20:26:03 +0000
commit57dea0dd708993ab7c966486a92e293acdafc4b9 (patch)
tree99f9dd474a68bf31218d105f5018615b866a7dba /pkgtools
parent558dee39774d31692dda3f70ed87ce0eb227fce7 (diff)
downloadpkgsrc-57dea0dd708993ab7c966486a92e293acdafc4b9.tar.gz
pkg_install-20090527:
Try harder to mimic the old pkg_delete behavior and provide a topologically sorted output for pkg_info -r. Bail out on dependency cycles based on recursion depth, currently 64K.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/info/perform.c17
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 13 insertions, 8 deletions
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index cdfe5ad6c05..c1d8dc1c30d 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.56 2009/04/22 19:18:06 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.57 2009/05/27 20:26:03 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -13,7 +13,7 @@
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.56 2009/04/22 19:18:06 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.57 2009/05/27 20:26:03 joerg Exp $");
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -287,12 +287,15 @@ read_meta_data_from_pkgdb(const char *pkg)
}
static void
-build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta)
+build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta, int limit)
{
char *iter, *eol, *next;
lpkg_t *lpp;
struct pkg_meta *meta_dep;
+ if (limit == 65536)
+ errx(1, "Cycle in the dependency tree, bailing out");
+
if (meta->is_installed == 0 || meta->meta_required_by == NULL)
return;
@@ -316,12 +319,14 @@ build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta)
lpp = alloc_lpkg(iter);
if (next != eol)
*eol = '\n';
- TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
+
meta_dep = read_meta_data_from_pkgdb(lpp->lp_name);
if (meta_dep == NULL)
continue;
- build_full_reqby(reqby, meta_dep);
+ build_full_reqby(reqby, meta_dep, limit + 1);
free_pkg_meta(meta_dep);
+
+ TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
}
}
@@ -438,7 +443,7 @@ pkg_do(const char *pkg)
if ((Flags & SHOW_FULL_REQBY) && meta->is_installed) {
lpkg_head_t reqby;
TAILQ_INIT(&reqby);
- build_full_reqby(&reqby, meta);
+ build_full_reqby(&reqby, meta, 0);
show_list(&reqby, "Full required by list:\n");
}
if (Flags & SHOW_DESC) {
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 8bd27f7f671..a76976bf3b3 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.128 2009/05/18 10:01:37 wiz Exp $ */
+/* $NetBSD: version.h,v 1.129 2009/05/27 20:26:03 joerg Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -27,6 +27,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20090518"
+#define PKGTOOLS_VERSION "20090527"
#endif /* _INST_LIB_VERSION_H_ */