diff options
author | joerg <joerg@pkgsrc.org> | 2008-09-14 18:59:02 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2008-09-14 18:59:02 +0000 |
commit | a40b8ff745a084eeb0816248ca32039e81540087 (patch) | |
tree | 895c42872eff029bc77b5723a83af1e482a49089 | |
parent | 77394ec802009fb5cdcc9177b10cf1f28118848b (diff) | |
download | pkgsrc-a40b8ff745a084eeb0816248ca32039e81540087.tar.gz |
pbulk-0.34:
Isolate rules to compute the restricted subset in the upload script.
Make the upload script independent from the report file to allow
uploading partial builds.
Only depend on NO_BIN_ON_FTP to decide what to upload and what not.
-rw-r--r-- | pkgtools/pbulk/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/jobs.c | 36 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbuild/pbuild.h | 9 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk | 46 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/create-report.awk | 6 |
5 files changed, 41 insertions, 60 deletions
diff --git a/pkgtools/pbulk/Makefile b/pkgtools/pbulk/Makefile index a3942e5baee..3fe901d9e8e 100644 --- a/pkgtools/pbulk/Makefile +++ b/pkgtools/pbulk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.44 2008/09/06 21:39:52 wiz Exp $ +# $NetBSD: Makefile,v 1.45 2008/09/14 18:59:02 joerg Exp $ -DISTNAME= pbulk-0.33.1 +DISTNAME= pbulk-0.34 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c index f09c7ee4f0e..cd3b036fd38 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.8 2008/02/24 15:35:42 tnn Exp $ */ +/* $NetBSD: jobs.c,v 1.9 2008/09/14 18:59:02 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -174,35 +174,6 @@ compute_tree_depth(struct build_job *job) compute_tree_depth_rec(job, job, &head, &job->pkg_depth); } -static void -mark_restricted_rec(struct build_job *job) -{ - struct dependency_list *iter; - - if (job->unrestricted_subset == 0) - return; - - job->unrestricted_subset = 0; - - SLIST_FOREACH(iter, &job->depending_pkgs, depends_link) - mark_restricted_rec(iter->dependency); -} - -static void -mark_restricted(void) -{ - size_t i; - const char *restricted, *no_bin_on_ftp; - - for (i = 0; i < len_jobs; ++i) { - restricted = find_content(&jobs[i], "RESTRICTED="); - no_bin_on_ftp = find_content(&jobs[i], "NO_BIN_ON_FTP="); - if ((restricted != NULL && *restricted != '\0' && *restricted != '\n') || - (no_bin_on_ftp != NULL && *no_bin_on_ftp != '\0' && *no_bin_on_ftp != '\n')) - mark_restricted_rec(&jobs[i]); - } -} - void init_jobs(const char *scan_output, const char *success_file, const char *error_file) { @@ -236,7 +207,6 @@ init_jobs(const char *scan_output, const char *success_file, const char *error_f jobs[len_jobs].end = pbulk_item_end(input_iter); jobs[len_jobs].state = JOB_INIT; jobs[len_jobs].open_depends = 0; - jobs[len_jobs].unrestricted_subset = 1; SLIST_INIT(&jobs[len_jobs].depending_pkgs); if (jobs[len_jobs].end == NULL) errx(1, "Invalid input"); @@ -259,7 +229,6 @@ init_jobs(const char *scan_output, const char *success_file, const char *error_f compute_tree_depth(&jobs[i]); mark_initial(); - mark_restricted(); for (i = 0; i < len_jobs; ++i) { if (jobs[i].state == JOB_INIT) @@ -538,8 +507,7 @@ finish_build(const char *report_file) default: errx(1, "internal error"); } - fprintf(report, "%s|%s|%s|%d\n", jobs[i].pkgname, status, - jobs[i].unrestricted_subset == 0 ? "restricted" : "", + fprintf(report, "%s|%s||%d\n", jobs[i].pkgname, status, jobs[i].pkg_depth); } } diff --git a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h index 1bcd7bc804a..2a9b2724121 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.4 2007/11/28 11:34:20 rillig Exp $ */ +/* $NetBSD: pbuild.h,v 1.5 2008/09/14 18:59:02 joerg Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -97,13 +97,6 @@ struct build_job { int pkg_depth; /** - * Iff this is 1, this package and all its dependencies do not - * have any definition for RESTRICTED or NO_BIN_ON_FTP, and thus - * may be uploaded on a public FTP server. - */ - int unrestricted_subset; - - /** * The number of direct dependencies that must be built before * this package can be tried. */ diff --git a/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk b/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk index 5a3f7b960f9..300331b3ca2 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk +++ b/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk @@ -1,5 +1,5 @@ #!@AWK@ -f -# $NetBSD: compute-packages.awk,v 1.2 2007/06/29 22:43:26 joerg Exp $ +# $NetBSD: compute-packages.awk,v 1.3 2008/09/14 18:59:02 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -30,11 +30,23 @@ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. +function mark_restricted(PKG, dep, depend_list) { + if (PKG in restricted) + return + + restricted[PKG] = 1 + + split(reverse_depends[PKG], depend_list, "[ \t]+") + for (dep in depend_list) + mark_restricted(depend_list[dep]) +} + BEGIN { meta_dir = ARGV[1] - report_file = meta_dir "/report" + success_file = meta_dir "/success" + presolve_file = meta_dir "/presolve" - while ((getline < report_file) > 0) { + while ((getline < presolve_file) > 0) { if ($0 ~ "^PKGNAME=") { cur = substr($0, 9) pkgs[cur] = cur @@ -46,19 +58,30 @@ BEGIN { if ($0 ~ "^BUILD_STATUS=") status[cur] = substr($0, 14) - if ($0 ~ "^RESTRICTED_SUBSET=") - subset[cur] = substr($0, 19) + if ($0 ~ "^NO_BIN_ON_FTP=.") + initial_restricted[cur] = 1 + + if ($0 ~ "^DEPENDS=") + depends[cur] = substr($0, 9) } close(presolve_file) - for (pkg in pkgs) { - # skip failed build - if (status[pkg] != "done") - continue; + for (pkg in depends) { + split(depends[pkg], depend_list, "[ \t]+") + for (dep in depend_list) { + cur_dep = depend_list[dep] + reverse_depends[cur_dep] = pkg " " cur_dep + } + } + + for (pkg in initial_restricted) + mark_restricted(pkg) + + while ((getline pkg < success_file) > 0) { # skip restricted packages - if (subset[pkg] != "no") + if (pkg in restricted) continue; - # for the rest, build category/file list + # build category/file list split(categories[pkg], cats, "[ \t]+") cats[0] = "All" for (cat_idx in cats) { @@ -70,4 +93,5 @@ BEGIN { print "+ " cat "/" pkg ".tgz" } } + close(success_file) } diff --git a/pkgtools/pbulk/files/pbulk/scripts/create-report.awk b/pkgtools/pbulk/files/pbulk/scripts/create-report.awk index 78c732798b8..b496ac2eab2 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/create-report.awk +++ b/pkgtools/pbulk/files/pbulk/scripts/create-report.awk @@ -1,5 +1,5 @@ #!@AWK@ -f -# $NetBSD: create-report.awk,v 1.3 2007/08/16 13:02:05 joerg Exp $ +# $NetBSD: create-report.awk,v 1.4 2008/09/14 18:59:02 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -83,10 +83,6 @@ BEGIN { for (p in pkg) { print pkg[p] > full_pbuild_file print "PKG_DEPTH=" depth[p] > full_pbuild_file - if (restricted[p] == "restricted") - print "RESTRICTED_SUBSET=yes" > full_pbuild_file - else - print "RESTRICTED_SUBSET=no" > full_pbuild_file print "BUILD_STATUS=" status[p] > full_pbuild_file } close(full_pbuild_file) |