pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pbulk pbulk-0.34:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3df1f7a19eea
branches:  trunk
changeset: 547237:3df1f7a19eea
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Sep 14 18:59:02 2008 +0000

description:
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.

diffstat:

 pkgtools/pbulk/Makefile                                 |   4 +-
 pkgtools/pbulk/files/pbulk/pbuild/jobs.c                |  36 +------------
 pkgtools/pbulk/files/pbulk/pbuild/pbuild.h              |   9 +--
 pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk |  48 ++++++++++++----
 pkgtools/pbulk/files/pbulk/scripts/create-report.awk    |   6 +-
 5 files changed, 42 insertions(+), 61 deletions(-)

diffs (209 lines):

diff -r 8b4b8feb2d97 -r 3df1f7a19eea pkgtools/pbulk/Makefile
--- a/pkgtools/pbulk/Makefile   Sun Sep 14 18:09:19 2008 +0000
+++ b/pkgtools/pbulk/Makefile   Sun Sep 14 18:59:02 2008 +0000
@@ -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 -r 8b4b8feb2d97 -r 3df1f7a19eea pkgtools/pbulk/files/pbulk/pbuild/jobs.c
--- a/pkgtools/pbulk/files/pbulk/pbuild/jobs.c  Sun Sep 14 18:09:19 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/pbuild/jobs.c  Sun Sep 14 18:59:02 2008 +0000
@@ -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@localhost>.
@@ -174,35 +174,6 @@
        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 @@
                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 @@
                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 @@
                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 -r 8b4b8feb2d97 -r 3df1f7a19eea pkgtools/pbulk/files/pbulk/pbuild/pbuild.h
--- a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h        Sun Sep 14 18:09:19 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.h        Sun Sep 14 18:59:02 2008 +0000
@@ -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@localhost>.
@@ -97,13 +97,6 @@
        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 -r 8b4b8feb2d97 -r 3df1f7a19eea pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk
--- a/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk   Sun Sep 14 18:09:19 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/compute-packages.awk   Sun Sep 14 18:59:02 2008 +0000
@@ -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@localhost>.
 # 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 @@
                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")
+       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 (pkg in restricted)
                        continue;
-               # skip restricted packages
-               if (subset[pkg] != "no")
-                       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 @@
                        print "+ " cat "/" pkg ".tgz"
                }
        }
+       close(success_file)
 }
diff -r 8b4b8feb2d97 -r 3df1f7a19eea pkgtools/pbulk/files/pbulk/scripts/create-report.awk
--- a/pkgtools/pbulk/files/pbulk/scripts/create-report.awk      Sun Sep 14 18:09:19 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/create-report.awk      Sun Sep 14 18:59:02 2008 +0000
@@ -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@localhost>.
 # All rights reserved.
@@ -83,10 +83,6 @@
        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)



Home | Main Index | Thread Index | Old Index