diff options
author | joerg <joerg@pkgsrc.org> | 2015-11-03 19:06:47 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2015-11-03 19:06:47 +0000 |
commit | 1c475de4460011a10611f29e46e926113fe1b69e (patch) | |
tree | a7f6ae05836a1dcdb7b4a66a11078231e0472c15 /pkgtools | |
parent | b51f4767d0762e2c0055cf7bfdd25f8377659077 (diff) | |
download | pkgsrc-1c475de4460011a10611f29e46e926113fe1b69e.tar.gz |
pbulk-base-0.50: Don't go into master mode if there is nothing to do.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pbulk-base/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/jobs.c | 8 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/pbuild.c | 13 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/pbuild.h | 3 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/jobs.c | 24 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/pscan.c | 12 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/pscan.h | 3 |
7 files changed, 51 insertions, 16 deletions
diff --git a/pkgtools/pbulk-base/Makefile b/pkgtools/pbulk-base/Makefile index dc914907cb4..67a23e1e135 100644 --- a/pkgtools/pbulk-base/Makefile +++ b/pkgtools/pbulk-base/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.16 2015/10/21 23:03:17 joerg Exp $ +# $NetBSD: Makefile,v 1.17 2015/11/03 19:06:48 joerg Exp $ -DISTNAME= pbulk-base-0.49 +DISTNAME= pbulk-base-0.50 COMMENT= Core components of the modular bulk build framework .include "../../pkgtools/pbulk/Makefile.common" diff --git a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c index 46c05e5064b..001cacc9347 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.15 2014/01/15 13:52:10 joerg Exp $ */ +/* $NetBSD: jobs.c,v 1.16 2015/11/03 19:06:47 joerg Exp $ */ /*- * Copyright (c) 2007, 2009, 2011 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -364,6 +364,12 @@ build_tree(void) } } +int +has_job(void) +{ + return !TAILQ_EMPTY(&buildable_jobs); +} + struct build_job * get_job(void) { diff --git a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c index 979fae7ee34..a0e92f7dd6d 100644 --- a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c +++ b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c @@ -1,4 +1,4 @@ -/* $NetBSD: pbuild.c,v 1.6 2013/01/14 14:33:28 jperkin Exp $ */ +/* $NetBSD: pbuild.c,v 1.7 2015/11/03 19:06:47 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -150,6 +150,7 @@ main(int argc, char **argv) if (argc != 0) usage(); client_mode(client_port); + /* UNREACHABLE */ } if (argc != 3) @@ -160,10 +161,12 @@ main(int argc, char **argv) init_jobs(argv[0], argv[1], argv[2]); - if (master_port != NULL) - master_mode(master_port, start_script); - else - standalone_mode(); + if (has_job()) { + if (master_port != NULL) + master_mode(master_port, start_script); + else + standalone_mode(); + } if (report_file) finish_build(report_file); diff --git a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h index 052e884b4d2..3ac6ad0696f 100644 --- a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h +++ b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h @@ -1,4 +1,4 @@ -/* $NetBSD: pbuild.h,v 1.6 2011/11/27 19:53:30 joerg Exp $ */ +/* $NetBSD: pbuild.h,v 1.7 2015/11/03 19:06:47 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -114,6 +114,7 @@ struct build_job { extern int verbosity; void init_jobs(const char *, const char *, const char *); +int has_job(void); struct build_job *get_job(void); void process_job(struct build_job *, enum job_state, int); int build_package(const char *, size_t); diff --git a/pkgtools/pbulk/files/pbulk/pscan/jobs.c b/pkgtools/pbulk/files/pbulk/pscan/jobs.c index 8b11e059ed9..1ae250e2d9c 100644 --- a/pkgtools/pbulk/files/pbulk/pscan/jobs.c +++ b/pkgtools/pbulk/files/pbulk/pscan/jobs.c @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.c,v 1.7 2012/11/30 16:22:49 joerg Exp $ */ +/* $NetBSD: jobs.c,v 1.8 2015/11/03 19:06:48 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -296,6 +296,28 @@ add_job_full(const char *location) ++len_jobs; } +int +has_job(void) +{ + size_t i; + struct scan_entry *e; + struct scan_job * job; + + for (i = first_undone_job; i < len_jobs; ++i) { + job = &jobs[i]; + if (job->state != JOB_OPEN) + continue; + e = find_old_scan(job->pkg_location); + if (e == NULL) + return 1; + job->scan_output = xstrdup(e->data); + process_job(job, JOB_DONE); + i = first_undone_job - 1; + } + + return 0; +} + struct scan_job * get_job(void) { diff --git a/pkgtools/pbulk/files/pbulk/pscan/pscan.c b/pkgtools/pbulk/files/pbulk/pscan/pscan.c index 415e558a530..393868a4380 100644 --- a/pkgtools/pbulk/files/pbulk/pscan/pscan.c +++ b/pkgtools/pbulk/files/pbulk/pscan/pscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: pscan.c,v 1.8 2012/11/23 12:13:35 joerg Exp $ */ +/* $NetBSD: pscan.c,v 1.9 2015/11/03 19:06:48 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -150,10 +150,12 @@ main(int argc, char **argv) else read_limited_list(); - if (master_port != NULL) - master_mode(master_port, start_script); - else - standalone_mode(); + if (has_job()) { + if (master_port != NULL) + master_mode(master_port, start_script); + else + standalone_mode(); + } write_jobs(output_file); diff --git a/pkgtools/pbulk/files/pbulk/pscan/pscan.h b/pkgtools/pbulk/files/pbulk/pscan/pscan.h index c0664817a36..61ad5381213 100644 --- a/pkgtools/pbulk/files/pbulk/pscan/pscan.h +++ b/pkgtools/pbulk/files/pbulk/pscan/pscan.h @@ -1,4 +1,4 @@ -/* $NetBSD: pscan.h,v 1.3 2012/11/23 12:13:35 joerg Exp $ */ +/* $NetBSD: pscan.h,v 1.4 2015/11/03 19:06:48 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -60,5 +60,6 @@ void add_job_full(const char *); struct scan_job *get_job(void); void process_job(struct scan_job *, enum job_state); void write_jobs(const char *); +int has_job(void); void read_old_scan(const char *); |