Wed May 5 00:07:08 2010 UTC ()
pbulk-base-0.41:
Improve diagnostic message for dependency cycles by actually showing the
path.


(joerg)
diff -r1.3 -r1.4 pkgsrc/pkgtools/pbulk-base/Makefile
diff -r1.11 -r1.12 pkgsrc/pkgtools/pbulk/files/pbulk/pbuild/jobs.c

cvs diff -r1.3 -r1.4 pkgsrc/pkgtools/pbulk-base/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pbulk-base/Makefile 2010/02/26 16:25:49 1.3
+++ pkgsrc/pkgtools/pbulk-base/Makefile 2010/05/05 00:07:07 1.4
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.3 2010/02/26 16:25:49 joerg Exp $ 1# $NetBSD: Makefile,v 1.4 2010/05/05 00:07:07 joerg Exp $
2 2
3DISTNAME= pbulk-base-0.40 3DISTNAME= pbulk-base-0.41
4COMMENT= Core components of the modular bulk build framework 4COMMENT= Core components of the modular bulk build framework
5 5
6PKG_DESTDIR_SUPPORT= user-destdir 6PKG_DESTDIR_SUPPORT= user-destdir
7 7
8.include "../../pkgtools/pbulk/Makefile.common" 8.include "../../pkgtools/pbulk/Makefile.common"
9 9
10USE_FEATURES= nbcompat 10USE_FEATURES= nbcompat
11USE_TOOLS+= groff nroff 11USE_TOOLS+= groff nroff
12 12
13INSTALLATION_DIRS= bin ${PKGMANDIR}/cat1 ${PKGMANDIR}/man1 13INSTALLATION_DIRS= bin ${PKGMANDIR}/cat1 ${PKGMANDIR}/man1
14USE_BSD_MAKEFILE= yes 14USE_BSD_MAKEFILE= yes
15 15
16CONFLICTS= pbulk<0.39 16CONFLICTS= pbulk<0.39

cvs diff -r1.11 -r1.12 pkgsrc/pkgtools/pbulk/files/pbulk/pbuild/jobs.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/pbulk/files/pbulk/pbuild/jobs.c 2010/02/26 16:25:49 1.11
+++ pkgsrc/pkgtools/pbulk/files/pbulk/pbuild/jobs.c 2010/05/05 00:07:07 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: jobs.c,v 1.11 2010/02/26 16:25:49 joerg Exp $ */ 1/* $NetBSD: jobs.c,v 1.12 2010/05/05 00:07:07 joerg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. 4 * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code was developed as part of Google's Summer of Code 2007 program. 7 * This code was developed as part of Google's Summer of Code 2007 program.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -136,54 +136,63 @@ pbulk_item_end(const char *line) @@ -136,54 +136,63 @@ pbulk_item_end(const char *line)
136 line_end = strchr(line, '\n'); 136 line_end = strchr(line, '\n');
137 if (line_end == NULL) 137 if (line_end == NULL)
138 return NULL; 138 return NULL;
139 line = line_end + 1; 139 line = line_end + 1;
140 if (strncmp(line, "PKGNAME=", 8) == 0) 140 if (strncmp(line, "PKGNAME=", 8) == 0)
141 return line; 141 return line;
142 } while (*line != '\0'); 142 } while (*line != '\0');
143 143
144 return line; 144 return line;
145} 145}
146 146
147SLIST_HEAD(depth_tree_head, build_job); 147SLIST_HEAD(depth_tree_head, build_job);
148 148
149static void 149static int
150compute_tree_depth_rec(struct build_job *job, struct build_job *root, 150compute_tree_depth_rec(struct build_job *job, struct build_job *root,
151 struct depth_tree_head *head, int *count) 151 struct depth_tree_head *head, int *count)
152{ 152{
153 struct dependency_list *dep_iter; 153 struct dependency_list *dep_iter;
154 struct build_job *job_iter; 154 struct build_job *job_iter;
155 155
156 if (job == root && *count != 0) 156 if (job == root && *count != 0) {
157 errx(1, "Cyclic dependency for package %s", job->pkgname); 157 fprintf(stderr, "Cyclic dependency for package:\n%s\n", job->pkgname);
 158 return -1;
 159 }
158 160
159 SLIST_FOREACH(job_iter, head, depth_tree_link) { 161 SLIST_FOREACH(job_iter, head, depth_tree_link) {
160 if (job_iter == job) 162 if (job_iter == job)
161 return; 163 return 0;
162 } 164 }
163 SLIST_INSERT_HEAD(head, job, depth_tree_link); 165 SLIST_INSERT_HEAD(head, job, depth_tree_link);
164 *count = *count + 1; 166 *count = *count + 1;
165 SLIST_FOREACH(dep_iter, &job->depending_pkgs, depends_link) 167 SLIST_FOREACH(dep_iter, &job->depending_pkgs, depends_link) {
166 compute_tree_depth_rec(dep_iter->dependency, root, head, count); 168 if (compute_tree_depth_rec(dep_iter->dependency, root,
 169 head, count)) {
 170 fprintf(stderr, "%s\n", job->pkgname);
 171 return -1;
 172 }
 173 }
 174 return 0;
167} 175}
168 176
169static void 177static void
170compute_tree_depth(struct build_job *job) 178compute_tree_depth(struct build_job *job)
171{ 179{
172 struct depth_tree_head head; 180 struct depth_tree_head head;
173 181
174 SLIST_INIT(&head); 182 SLIST_INIT(&head);
175 job->pkg_depth = 0; 183 job->pkg_depth = 0;
176 compute_tree_depth_rec(job, job, &head, &job->pkg_depth); 184 if (compute_tree_depth_rec(job, job, &head, &job->pkg_depth))
 185 exit(1);
177} 186}
178 187
179void 188void
180init_jobs(const char *scan_output, const char *success_file, const char *error_file) 189init_jobs(const char *scan_output, const char *success_file, const char *error_file)
181{ 190{
182 char *input; 191 char *input;
183 const char *input_iter; 192 const char *input_iter;
184 int fd; 193 int fd;
185 size_t i; 194 size_t i;
186 195
187 TAILQ_INIT(&buildable_jobs); 196 TAILQ_INIT(&buildable_jobs);
188 197
189 if ((fd = open(scan_output, O_RDONLY, 0)) == -1) 198 if ((fd = open(scan_output, O_RDONLY, 0)) == -1)