summaryrefslogtreecommitdiff
path: root/pkgtools/pbulk
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2010-05-05 00:07:07 +0000
committerjoerg <joerg@pkgsrc.org>2010-05-05 00:07:07 +0000
commit59cac6ad3886582c15e9b0b6f3a41c122ccf2d23 (patch)
treed5fe718ed1406a1d99dcdf8fe5fa058e351b5166 /pkgtools/pbulk
parentd84a1a28eedae07d3cb75a7b8c1ba68ded71e00c (diff)
downloadpkgsrc-59cac6ad3886582c15e9b0b6f3a41c122ccf2d23.tar.gz
pbulk-base-0.41:
Improve diagnostic message for dependency cycles by actually showing the path.
Diffstat (limited to 'pkgtools/pbulk')
-rw-r--r--pkgtools/pbulk/files/pbulk/pbuild/jobs.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c
index 485fea39fbe..324bbc7a381 100644
--- a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c
+++ b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: jobs.c,v 1.11 2010/02/26 16:25:49 joerg Exp $ */
+/* $NetBSD: jobs.c,v 1.12 2010/05/05 00:07:07 joerg Exp $ */
/*-
* Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -146,24 +146,32 @@ pbulk_item_end(const char *line)
SLIST_HEAD(depth_tree_head, build_job);
-static void
+static int
compute_tree_depth_rec(struct build_job *job, struct build_job *root,
struct depth_tree_head *head, int *count)
{
struct dependency_list *dep_iter;
struct build_job *job_iter;
- if (job == root && *count != 0)
- errx(1, "Cyclic dependency for package %s", job->pkgname);
+ if (job == root && *count != 0) {
+ fprintf(stderr, "Cyclic dependency for package:\n%s\n", job->pkgname);
+ return -1;
+ }
SLIST_FOREACH(job_iter, head, depth_tree_link) {
if (job_iter == job)
- return;
+ return 0;
}
SLIST_INSERT_HEAD(head, job, depth_tree_link);
*count = *count + 1;
- SLIST_FOREACH(dep_iter, &job->depending_pkgs, depends_link)
- compute_tree_depth_rec(dep_iter->dependency, root, head, count);
+ SLIST_FOREACH(dep_iter, &job->depending_pkgs, depends_link) {
+ if (compute_tree_depth_rec(dep_iter->dependency, root,
+ head, count)) {
+ fprintf(stderr, "%s\n", job->pkgname);
+ return -1;
+ }
+ }
+ return 0;
}
static void
@@ -173,7 +181,8 @@ compute_tree_depth(struct build_job *job)
SLIST_INIT(&head);
job->pkg_depth = 0;
- compute_tree_depth_rec(job, job, &head, &job->pkg_depth);
+ if (compute_tree_depth_rec(job, job, &head, &job->pkg_depth))
+ exit(1);
}
void