diff options
author | joerg <joerg> | 2012-11-23 12:13:34 +0000 |
---|---|---|
committer | joerg <joerg> | 2012-11-23 12:13:34 +0000 |
commit | b7bd3ae418ba12d483acfbb197d6ee7aed28edcc (patch) | |
tree | 7a3f5dc9fbb776757ced53728c97bff7388fd63f | |
parent | 75335e4e9d1609d44a11e52652d0cb9814206647 (diff) | |
download | pkgsrc-b7bd3ae418ba12d483acfbb197d6ee7aed28edcc.tar.gz |
Update pbulk to 0.51 and pbulk-base to 0.46. Add support for reusing old
scan results to speed up the process. Fix a bug that overwrote the
package.log during installation.
-rw-r--r-- | doc/CHANGES-2012 | 4 | ||||
-rw-r--r-- | mk/pbulk/pbulk-index.mk | 3 | ||||
-rw-r--r-- | pkgtools/pbulk-base/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pbulk/Makefile | 6 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/lib/alloc.c | 22 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/lib/pbulk.h | 5 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/jobs.c | 7 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbulk.conf | 5 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/jobs.c | 232 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/pscan.c | 20 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/pscan.h | 4 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/pkg-build | 4 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/pre-build | 13 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/scan | 13 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/scan-client-start | 10 |
15 files changed, 316 insertions, 36 deletions
diff --git a/doc/CHANGES-2012 b/doc/CHANGES-2012 index 4d21eb9d4f1..883feac3686 100644 --- a/doc/CHANGES-2012 +++ b/doc/CHANGES-2012 @@ -1,4 +1,4 @@ -$NetBSD: CHANGES-2012,v 1.3613 2012/11/23 08:48:33 he Exp $ +$NetBSD: CHANGES-2012,v 1.3614 2012/11/23 12:13:34 joerg Exp $ Changes to the packages collection and infrastructure in 2012: @@ -5541,3 +5541,5 @@ Changes to the packages collection and infrastructure in 2012: Updated mail/thunderbird to 17.0 [ryoon 2012-11-23] Updated mail/thunderbird-l10n to 17.0 [ryoon 2012-11-23] Updated lang/parrot to 4.8.0 [he 2012-11-23] + Updated pkgtools/pbulk-base to 0.46 [joerg 2012-11-22] + Updated pkgtools/pbulk to 0.51 [joerg 2012-11-22] diff --git a/mk/pbulk/pbulk-index.mk b/mk/pbulk/pbulk-index.mk index 4641c6ee852..96eaff895fe 100644 --- a/mk/pbulk/pbulk-index.mk +++ b/mk/pbulk/pbulk-index.mk @@ -1,4 +1,4 @@ -# $NetBSD: pbulk-index.mk,v 1.14 2011/11/12 15:21:53 dholland Exp $ +# $NetBSD: pbulk-index.mk,v 1.15 2012/11/23 12:13:35 joerg Exp $ # This Makefile fragment is included by bsd.pkg.mk and provides all # variables and targets related to the parallel bulk build @@ -102,6 +102,7 @@ pbulk-index-item: @echo "USE_DESTDIR="${_USE_DESTDIR:Q} @echo "BOOTSTRAP_PKG="${BOOTSTRAP_PKG} @echo "USERGROUP_PHASE="${USERGROUP_PHASE:Q} + @echo "SCAN_DEPENDS="${.MAKE.MAKEFILES:Q} .if defined(_PBULK_MULTI_NEEDED) @printf "MULTI_VERSION=" .for _t in ${_PBULK_MULTI_NEEDED} diff --git a/pkgtools/pbulk-base/Makefile b/pkgtools/pbulk-base/Makefile index ceb100e7072..869be8985e8 100644 --- a/pkgtools/pbulk-base/Makefile +++ b/pkgtools/pbulk-base/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.9 2012/09/11 23:19:36 asau Exp $ +# $NetBSD: Makefile,v 1.10 2012/11/23 12:13:35 joerg Exp $ -DISTNAME= pbulk-base-0.45 +DISTNAME= pbulk-base-0.46 COMMENT= Core components of the modular bulk build framework .include "../../pkgtools/pbulk/Makefile.common" diff --git a/pkgtools/pbulk/Makefile b/pkgtools/pbulk/Makefile index 60397f54676..e99a3a1550a 100644 --- a/pkgtools/pbulk/Makefile +++ b/pkgtools/pbulk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.65 2012/09/11 23:19:36 asau Exp $ +# $NetBSD: Makefile,v 1.66 2012/11/23 12:13:34 joerg Exp $ -DISTNAME= pbulk-0.50 +DISTNAME= pbulk-0.51 COMMENT= Modular bulk build framework .include "../../pkgtools/pbulk/Makefile.common" @@ -39,7 +39,7 @@ SUBST_VARS.tools= AWK BZIP2 CHOWN DIGEST GZIP_CMD ID MAIL_CMD NEATO \ CONF_FILES+= share/examples/pbulk/pbulk.conf ${PKG_SYSCONFDIR}/pbulk.conf PBULK_CONFIG= ${PKG_SYSCONFDIR}/pbulk.conf -PBULK_CONFIG_VERSION= 0.34 +PBULK_CONFIG_VERSION= 0.51 INSTALLATION_DIRS= bin libexec/pbulk share/examples/pbulk USE_BSD_MAKEFILE= yes diff --git a/pkgtools/pbulk/files/pbulk/lib/alloc.c b/pkgtools/pbulk/files/pbulk/lib/alloc.c index 508bfc91933..b54372e1d5d 100644 --- a/pkgtools/pbulk/files/pbulk/lib/alloc.c +++ b/pkgtools/pbulk/files/pbulk/lib/alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.2 2007/06/25 21:38:43 joerg Exp $ */ +/* $NetBSD: alloc.c,v 1.3 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -95,3 +95,23 @@ xstrndup(const char *str, size_t len) return buf; } + +size_t +djb_hash(const char *s) +{ + size_t h = 5381; + + while (*s) + h = h * 33 + (size_t)(unsigned char)*s++; + return h; +} + +size_t +djb_hash2(const char *s, const char *e) +{ + size_t h = 5381; + + while (*s && s < e) + h = h * 33 + (size_t)(unsigned char)*s++; + return h; +} diff --git a/pkgtools/pbulk/files/pbulk/lib/pbulk.h b/pkgtools/pbulk/files/pbulk/lib/pbulk.h index 5290848448c..f21688f43df 100644 --- a/pkgtools/pbulk/files/pbulk/lib/pbulk.h +++ b/pkgtools/pbulk/files/pbulk/lib/pbulk.h @@ -1,4 +1,4 @@ -/* $NetBSD: pbulk.h,v 1.3 2009/01/31 23:25:38 joerg Exp $ */ +/* $NetBSD: pbulk.h,v 1.4 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -91,3 +91,6 @@ char *xstrndup(const char *, size_t); int pkg_match(const char *, const char *); const char *pkg_order(const char *, const char *); + +size_t djb_hash(const char *); +size_t djb_hash2(const char *, const char *); diff --git a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c index 596894b1961..86f38876e92 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.13 2011/11/27 19:53:30 joerg Exp $ */ +/* $NetBSD: jobs.c,v 1.14 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007, 2009, 2011 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -536,10 +536,7 @@ finish_build(const char *report_file) static size_t hash_item(const char *s, size_t len) { - size_t h = 5381; - while (len--) - h = h * 33 + *s++; - return h & (HASH_SIZE - 1); + return djb_hash2(s, s + len) % HASH_SIZE; } static struct buildhash hash_table[HASH_SIZE]; diff --git a/pkgtools/pbulk/files/pbulk/pbulk.conf b/pkgtools/pbulk/files/pbulk/pbulk.conf index f5a74b79851..f9992c485b1 100644 --- a/pkgtools/pbulk/files/pbulk/pbulk.conf +++ b/pkgtools/pbulk/files/pbulk/pbulk.conf @@ -1,4 +1,4 @@ -# $NetBSD: pbulk.conf,v 1.17 2010/02/24 22:51:37 joerg Exp $ +# $NetBSD: pbulk.conf,v 1.18 2012/11/23 12:13:34 joerg Exp $ # Version of the configuration file. This is bumped whenver the default # config changes to notify the administrator about updates. @@ -10,6 +10,9 @@ config_version=@PBULK_CONFIG_VERSION@ # base_url=http://www.pkgsrc-box.org/reports/current/DragonFly-1.8 +# If yes, keep the last scan results in ${bulklog}.orig and try to reuse them. +reuse_scan_results=no + # The pbulk framework can use multiple machines to build the packages. # On a single-processor, non-distributed build, you may want to say "no" # here. diff --git a/pkgtools/pbulk/files/pbulk/pscan/jobs.c b/pkgtools/pbulk/files/pbulk/pscan/jobs.c index a422ed6415f..d046598d1ec 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.5 2008/01/15 22:14:30 joerg Exp $ */ +/* $NetBSD: jobs.c,v 1.6 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -46,6 +46,218 @@ #define UNCONST(x) ((void *)(uintptr_t)(x)) +#define STAT_HASH_SIZE 131072 +#define HASH_SIZE 32768 + +struct stat_cache { + char *path; + time_t mtime; + SLIST_ENTRY(stat_cache) hash_link; +}; +SLIST_HEAD(stat_cache_hash, stat_cache); + +static struct stat_cache_hash stat_hash_table[STAT_HASH_SIZE]; + +static time_t +stat_path(const char *path) +{ + size_t val = djb_hash(path) % STAT_HASH_SIZE; + struct stat_cache_hash *h = &stat_hash_table[val]; + struct stat_cache *e; + struct stat sb; + + SLIST_FOREACH(e, h, hash_link) { + if (strcmp(path, e->path) == 0) + return e->mtime; + } + e = xmalloc(sizeof(*e)); + e->path = xstrdup(path); + if (stat(path, &sb) == -1) + e->mtime = -1; + else + e->mtime = sb.st_mtime; + SLIST_INSERT_HEAD(h, e, hash_link); + return e->mtime; +} + +struct scan_entry { + char *location; + char *data; + char *scan_depends; + SLIST_ENTRY(scan_entry) hash_link; +}; +SLIST_HEAD(scan_entry_hash, scan_entry); + +static struct scan_entry_hash hash_table[HASH_SIZE]; +static time_t scan_mtime; + +static size_t +hash_entry(const char *path) +{ + return djb_hash(path) % HASH_SIZE; +} + +static size_t +hash_entry2(const char *path, const char *path_end) +{ + + return djb_hash2(path, path_end) % HASH_SIZE; +} + +static void +add_entry(const char *l_start, const char *l_end, + const char *s_start, const char *s_end, + const char *d_start, const char *d_end) +{ + struct scan_entry *e; + struct scan_entry_hash *h; + + if (l_start == l_end) + errx(1, "Location entry missing"); + + h = &hash_table[hash_entry2(l_start, l_end)]; + SLIST_FOREACH(e, h, hash_link) { + if (strncmp(e->location, l_start, l_end - l_start) == 0 && + e->location[l_end - l_start] == '\0') { + size_t l1, l2, l3; + l1 = strlen(e->data); + l2 = d_end - d_start; + l_start -= 13; + ++l_end; + l3 = l_start - d_start; + e->data = xrealloc(e->data, l1 + l2 + 1); + memcpy(e->data + l1, d_start, l3); + memcpy(e->data + l1 + l3, l_end, d_end - l_end); + e->data[l1 + l3 + d_end - l_end] = '\0'; + return; + } + } + e = xmalloc(sizeof(*e)); + e->location = xstrndup(l_start, l_end - l_start); + e->data = xmalloc(d_end - d_start + 1); + l_start -= 13; + ++l_end; + memcpy(e->data, d_start, l_start - d_start); + memcpy(e->data + (l_start - d_start), l_end, d_end - l_end); + e->data[l_start - d_start + d_end - l_end] = '\0'; + + if (s_start != s_end) + e->scan_depends = xstrndup(s_start, s_end - s_start); + else + e->scan_depends = NULL; + SLIST_INSERT_HEAD(h, e, hash_link); +} + +void +read_old_scan(const char *path) +{ + size_t i; + int fd; + char *buf; + struct stat sb; + const char *entry_start; + const char *l_start, *l_end; + const char *s_start, *s_end; + const char *line, *eol; + + for (i = 0; i < HASH_SIZE; ++i) + SLIST_INIT(&hash_table[i]); + + if (path == NULL) + return; + if ((fd = open(path, O_RDONLY)) == -1) + return; + if (fstat(fd, &sb) == -1) { + close(fd); + return; + } + scan_mtime = sb.st_mtime; + buf = read_from_file(fd); + entry_start = buf; + l_start = l_end = NULL; + entry_start = buf; + for (line = buf; *line; line = eol) { + eol = strchr(line, '\n'); + if (eol == NULL) + errx(1, "Incomplete old scan"); + ++eol; + if (strncmp(line, "PKGNAME=", 8) == 0) { + if (line == buf) + continue; + add_entry(l_start, l_end, s_start, s_end, + entry_start, line); + l_start = l_end = NULL; + entry_start = line; + } else if (strncmp(line, "PKG_LOCATION=", 13) == 0) { + l_start = line + 13; + l_end = eol - 1; + } else if (strncmp(line, "SCAN_DEPENDS=", 13) == 0) { + s_start = line + 13; + s_end = eol - 1; + } + } + if (entry_start != line) + add_entry(l_start, l_end, s_start, s_end, + entry_start, line); +} + +static struct scan_entry * +find_old_scan(const char *location) +{ + struct scan_entry *e; + char *dep, *dep2, *path, *fullpath; + int is_current; + time_t mtime; + + e = SLIST_FIRST(&hash_table[hash_entry(location)]); + while (e) { + if (strcmp(e->location, location) == 0) + break; + e = SLIST_NEXT(e, hash_link); + } + if (e == NULL) + return NULL; + + if (e->scan_depends == NULL) + return e; + + is_current = 1; + dep2 = dep = xstrdup(e->scan_depends); + while ((path = strtok(dep, " ")) != NULL) { + dep = NULL; + if (*path == '\0') + continue; + if (*path == '/') { + mtime = stat_path(path); + if (mtime == -1 || mtime >= scan_mtime) { + is_current = 0; + break; + } + continue; + } + if (strncmp("../../", path, 6) == 0) { + const char *s1 = strrchr(location, '/'); + const char *s2 = strchr(location, '/'); + if (s1 == s2) + fullpath = xasprintf("%s/%s", pkgsrc_tree, + path + 6); + else + fullpath = xasprintf("%s/%s/%s", pkgsrc_tree, + location, path); + } else { + fullpath = xasprintf("%s/%s/%s", pkgsrc_tree, + location, path); + } + mtime = stat_path(fullpath); + if (mtime == -1 || mtime >= scan_mtime) { + is_current = 0; + break; + } + } + free(dep2); + return is_current ? e : NULL; +} + static struct scan_job *jobs; static size_t len_jobs, allocated_jobs, first_undone_job, done_jobs; @@ -86,12 +298,21 @@ struct scan_job * get_job(void) { size_t i; + struct scan_entry *e; + struct scan_job * job; for (i = first_undone_job; i < len_jobs; ++i) { - if (jobs[i].state == JOB_OPEN) { - jobs[i].state = JOB_IN_PROCESSING; - return &jobs[i]; + job = &jobs[i]; + if (job->state != JOB_OPEN) + continue; + e = find_old_scan(job->pkg_location); + if (e == NULL) { + job->state = JOB_IN_PROCESSING; + return job; } + job->scan_output = xstrdup(e->data); + process_job(job, JOB_DONE); + i = first_undone_job - 1; } return NULL; @@ -139,8 +360,7 @@ pkgname_dup(const char *line) return xstrndup(pkgname, pkgname_len); } -#define HASH_SIZE 1024 -#define HASH_ITEM(x) (((unsigned char)(x)[0] + (unsigned char)(x)[1] * 257) & (HASH_SIZE - 1)) +#define HASH_ITEM(x) (djb_hash(x) % HASH_SIZE) static struct pkgname_hash *pkgname_hash[HASH_SIZE]; diff --git a/pkgtools/pbulk/files/pbulk/pscan/pscan.c b/pkgtools/pbulk/files/pbulk/pscan/pscan.c index c98a4285d2e..415e558a530 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.7 2011/03/06 02:23:32 seanb Exp $ */ +/* $NetBSD: pscan.c,v 1.8 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -33,11 +33,13 @@ #include <nbcompat.h> +#include <sys/stat.h> #include <sys/uio.h> #include <nbcompat/err.h> #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif +#include <fcntl.h> #include <nbcompat/limits.h> #include <signal.h> #include <nbcompat/stdio.h> @@ -52,7 +54,7 @@ int verbosity; static const char *bmake_path; static const char *output_file; -static const char *pkgsrc_tree; +const char *pkgsrc_tree; static void find_full_tree(void); static void read_limited_list(void); @@ -62,14 +64,16 @@ static void usage(void) { (void)fprintf(stderr, "usage: pbulk-scan -c <master> [ -v ] -M <make> <pkgsrc tree>\n"); - (void)fprintf(stderr, "usage: pbulk-scan [ -I <start> ] [ -l ] [ -v ] [ -m <port> ] -M <make> <pksgrc tree> <output file>\n"); + (void)fprintf(stderr, "usage: pbulk-scan [ -I <start> ] [ -L <old scan> ] [ -l ] [ -v ]\n" + " [ -m <port> ] -M <make> <pksgrc tree> <output file>\n"); exit(1); } int main(int argc, char **argv) { - const char *client_port = NULL, *master_port = NULL, *start_script = NULL; + const char *client_port = NULL, *last_scan = NULL, *master_port = NULL; + const char *start_script = NULL; int ch, limited_scan; struct sigaction sa; @@ -77,7 +81,7 @@ main(int argc, char **argv) limited_scan = 0; - while ((ch = getopt(argc, argv, "I:M:lc:m:v")) != -1) { + while ((ch = getopt(argc, argv, "I:M:L:lc:m:v")) != -1) { switch (ch) { case 'I': start_script = optarg; @@ -85,6 +89,9 @@ main(int argc, char **argv) case 'c': client_port = optarg; break; + case 'L': + last_scan = optarg; + break; case 'l': limited_scan = 1; break; @@ -121,6 +128,9 @@ main(int argc, char **argv) usage(); } + if (client_port == NULL) + read_old_scan(last_scan); + if (client_port) { if (limited_scan != 0 || argc != 1) usage(); diff --git a/pkgtools/pbulk/files/pbulk/pscan/pscan.h b/pkgtools/pbulk/files/pbulk/pscan/pscan.h index 45fb2403c60..c0664817a36 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.2 2007/06/25 21:38:46 joerg Exp $ */ +/* $NetBSD: pscan.h,v 1.3 2012/11/23 12:13:35 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -48,6 +48,7 @@ struct scan_job { }; extern int verbosity; +extern const char *pkgsrc_tree; char *scan_pkglocation(const char *); @@ -60,3 +61,4 @@ struct scan_job *get_job(void); void process_job(struct scan_job *, enum job_state); void write_jobs(const char *); +void read_old_scan(const char *); diff --git a/pkgtools/pbulk/files/pbulk/scripts/pkg-build b/pkgtools/pbulk/files/pbulk/scripts/pkg-build index b95edba1a53..7bc2acd3ad0 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build +++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: pkg-build,v 1.24 2012/06/19 13:40:07 jperkin Exp $ +# $NetBSD: pkg-build,v 1.25 2012/11/23 12:13:35 joerg Exp $ # # Copyright (c) 2007, 2008 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -193,7 +193,7 @@ run_make run_direct package > ${bulklog}/${pkgname}/package.log 2>&1 || cleanup if [ "${use_destdir}" != "no" ] && \ [ -z "${is_bootstrap}" ]; then if ! ${pkg_add_cmd} ${pkgname} \ - > ${bulklog}/${pkgname}/package.log 2>&1; then + >> ${bulklog}/${pkgname}/package.log 2>&1; then run_make run_direct package-clean cleanup fi diff --git a/pkgtools/pbulk/files/pbulk/scripts/pre-build b/pkgtools/pbulk/files/pbulk/scripts/pre-build index ec3afa7493c..1b0fe32e167 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/pre-build +++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: pre-build,v 1.10 2009/12/16 19:41:41 joerg Exp $ +# $NetBSD: pre-build,v 1.11 2012/11/23 12:13:35 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -63,9 +63,18 @@ if [ -d "${bulklog}/meta" ]; then echo "Warning: All log files of the previous pbulk run will be" echo "removed in 5 seconds. If you want to abort, press Ctrl-C." sleep 5 + if [ "${reuse_scan_results}" = yes -a -f "${bulklog}/meta/pscan" ]; then + echo "Reusing old scan results" + rm -rf "${bulklog}.old" + mv "${bulklog}" "${bulklog}.old" + else + echo "Removing old scan results" + rm -rf "${bulklog}"/* || true + fi +else + rm -rf "${bulklog}"/* || true fi -rm -rf "${bulklog}"/* || true mkdir -p "${bulklog}" "${loc}" @PREFIX@/libexec/pbulk/client-clean diff --git a/pkgtools/pbulk/files/pbulk/scripts/scan b/pkgtools/pbulk/files/pbulk/scripts/scan index 09b0ae65879..71c19a9e43e 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/scan +++ b/pkgtools/pbulk/files/pbulk/scripts/scan @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: scan,v 1.7 2010/06/15 21:11:43 joerg Exp $ +# $NetBSD: scan,v 1.8 2012/11/23 12:13:35 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -40,14 +40,21 @@ if [ "${config_version}" != "@PBULK_CONFIG_VERSION@" ]; then exit 1 fi +if [ "${reuse_scan_results}" = yes -a -f "${bulklog}.old/meta/pscan" ]; then + echo "Using old scan results from ${bulklog}.old/meta/pscan" + extra_pscan_args="-L ${bulklog}.old/meta/pscan" +else + extra_pscan_args="" +fi + if [ -z "${limited_list}" ]; then echo "Scanning..." case "${master_mode}" in [nN][oO]) - ${pscan} -v -M ${make} ${pkgsrc} ${loc}/pscan 2>> ${loc}/pscan.stderr + ${pscan} -v -M ${make} ${extra_pscan_args} ${pkgsrc} ${loc}/pscan 2>> ${loc}/pscan.stderr ;; [yY][eE][sS]) - ${pscan} -v -I ${pscan_start_script} -m ${master_port_scan} -M ${make} ${pkgsrc} ${loc}/pscan 2>> ${loc}/pscan.stderr + ${pscan} -v -I ${pscan_start_script} -m ${master_port_scan} -M ${make} ${extra_pscan_args} ${pkgsrc} ${loc}/pscan 2>> ${loc}/pscan.stderr ;; *) echo "master_mode must be either yes or no." diff --git a/pkgtools/pbulk/files/pbulk/scripts/scan-client-start b/pkgtools/pbulk/files/pbulk/scripts/scan-client-start index 2db99d6517b..2049b437804 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/scan-client-start +++ b/pkgtools/pbulk/files/pbulk/scripts/scan-client-start @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: scan-client-start,v 1.2 2008/09/16 18:21:30 joerg Exp $ +# $NetBSD: scan-client-start,v 1.3 2012/11/23 12:13:35 joerg Exp $ . @PBULK_CONFIG@ @@ -11,6 +11,12 @@ if [ "${config_version}" != "@PBULK_CONFIG_VERSION@" ]; then exit 1 fi +if [ -f "${bulklog}.old/meta/pscan" ]; then + extra_pscan_args="-L ${bulklog}.old/meta/pscan" +else + extra_pscan_args="" +fi + for client in ${scan_clients}; do - ssh $client "${pscan_prepare} && ${pscan} -c ${master_port_scan} -M ${make} ${pkgsrc}" & + ssh $client "${pscan_prepare} && ${pscan} -c ${master_port_scan} -M ${make} ${extra_pscan_args} ${pkgsrc}" & done |