pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pbulk Always call setprogname for platforms t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b95e44d4cd57
branches:  trunk
changeset: 531137:b95e44d4cd57
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Jul 20 19:39:33 2007 +0000

description:
Always call setprogname for platforms that don't have __progname.
Don't depend on date to implement %s or even %F and %R or support -r,
compute dates as one comment and split. This works even with the very
special HP-UX date. Requested and tested by tnn@

Bump to pbulk-0.7.

diffstat:

 pkgtools/pbulk/Makefile                                   |   4 +-
 pkgtools/pbulk/files/pbulk/pbuild/pbuild.c                |   4 +-
 pkgtools/pbulk/files/pbulk/presolve/presolve.c            |   4 +-
 pkgtools/pbulk/files/pbulk/pscan/pscan.c                  |   4 +-
 pkgtools/pbulk/files/pbulk/scripts/build                  |   4 +-
 pkgtools/pbulk/files/pbulk/scripts/create-report-html.awk |  23 ++++---------
 pkgtools/pbulk/files/pbulk/scripts/create-report-txt.awk  |  25 ++++++---------
 pkgtools/pbulk/files/pbulk/scripts/pre-build              |   7 ++-
 pkgtools/pbulk/files/pbulk/scripts/report                 |  17 +++++----
 9 files changed, 44 insertions(+), 48 deletions(-)

diffs (262 lines):

diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/Makefile
--- a/pkgtools/pbulk/Makefile   Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/Makefile   Fri Jul 20 19:39:33 2007 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.8 2007/07/16 20:35:04 joerg Exp $
+# $NetBSD: Makefile,v 1.9 2007/07/20 19:39:33 joerg Exp $
 
-DISTNAME=      pbulk-0.6
+DISTNAME=      pbulk-0.7
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/pbuild/pbuild.c
--- a/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c        Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/pbuild/pbuild.c        Fri Jul 20 19:39:33 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pbuild.c,v 1.2 2007/06/25 21:38:45 joerg Exp $ */
+/* $NetBSD: pbuild.c,v 1.3 2007/07/20 19:39:34 joerg Exp $ */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -73,6 +73,8 @@
        struct sigaction sa;
        int ch, modes;
 
+       setprogname("pbulk-build");
+
        client_port = NULL;
        master_port = NULL;
        stat_port = NULL;
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/presolve/presolve.c
--- a/pkgtools/pbulk/files/pbulk/presolve/presolve.c    Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/presolve/presolve.c    Fri Jul 20 19:39:33 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: presolve.c,v 1.2 2007/06/25 21:38:45 joerg Exp $ */
+/* $NetBSD: presolve.c,v 1.3 2007/07/20 19:39:34 joerg Exp $ */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -84,6 +84,8 @@
        size_t i;
        int ch, ret;
 
+       setprogname("pbulk-resolve");
+
        while ((ch = getopt(argc, argv, "i:v")) != -1) {
                switch (ch) {
                case 'i':
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/pscan/pscan.c
--- a/pkgtools/pbulk/files/pbulk/pscan/pscan.c  Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/pscan/pscan.c  Fri Jul 20 19:39:33 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pscan.c,v 1.2 2007/06/25 21:38:46 joerg Exp $ */
+/* $NetBSD: pscan.c,v 1.3 2007/07/20 19:39:34 joerg Exp $ */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -74,6 +74,8 @@
        int ch, limited_scan;
        struct sigaction sa;
 
+       setprogname("pbulk-scan");
+
        limited_scan = 0;
 
        while ((ch = getopt(argc, argv, "I:M:lc:m:v")) != -1) {
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/scripts/build
--- a/pkgtools/pbulk/files/pbulk/scripts/build  Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/build  Fri Jul 20 19:39:33 2007 +0000
@@ -1,5 +1,5 @@
 #!@SH@
-# $NetBSD: build,v 1.1.1.1 2007/06/19 19:49:59 joerg Exp $
+# $NetBSD: build,v 1.2 2007/07/20 19:39:34 joerg Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -48,7 +48,7 @@
        ;;
 esac
 
-echo "BUILD_END=`date +%s`" >> ${loc}/status
+date '+BUILD_END_ISO=%Y-%m-%d %H:%M' >> ${loc}/status
 
 echo "Building pkg_summary..."
 cd ${packages}/All
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/scripts/create-report-html.awk
--- a/pkgtools/pbulk/files/pbulk/scripts/create-report-html.awk Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/create-report-html.awk Fri Jul 20 19:39:33 2007 +0000
@@ -1,5 +1,5 @@
 #!@AWK@ -f
-# $NetBSD: create-report-html.awk,v 1.3 2007/07/07 13:54:36 wiz Exp $
+# $NetBSD: create-report-html.awk,v 1.4 2007/07/20 19:39:34 joerg Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -101,13 +101,6 @@
        print "</tr>" > html_report
 }
 
-function format_time(FORMAT, TIME, format_cmd) {
-       format_cmd = sprintf("date -r %d \"+%s\"", TIME, FORMAT)
-       format_cmd | getline
-       close format_cmd
-       return $0
-}
-
 BEGIN {
        meta_dir = ARGV[1]
        log_dir = ARGV[2]
@@ -127,10 +120,10 @@
                        pkgsrc_platform = substr($0, 10)
                else if ($0 ~ "^COMPILER=")
                        pkgsrc_compiler = substr($0, 10)
-               else if ($0 ~ "^BUILD_START=")
-                       pkgsrc_build_start = substr($0, 13)
-               else if ($0 ~ "^BUILD_END=")
-                       pkgsrc_build_end = substr($0, 11)
+               else if ($0 ~ "^BUILD_START_ISO=")
+                       pkgsrc_build_start_iso = substr($0, 17)
+               else if ($0 ~ "^BUILD_END_ISO=")
+                       pkgsrc_build_end_iso = substr($0, 14)
                else if ($0 ~ "^BASE_URL=")
                        pkgsrc_base_url = substr($0, 10)
        }
@@ -167,12 +160,12 @@
        print "<html>" > html_report
        print "  <head>" > html_report
        printf("    <title> pkgsrc bulk build for %s from %s</title>\n",
-           pkgsrc_platform, format_time("%F %R")) > html_report
+           pkgsrc_platform, pkgsrc_build_start_iso) > html_report
        print "  </head>" > html_report
        print "  <body>" > html_report
        printf("    <h1> pkgsrc bulk build for %s</h1>\n", pkgsrc_platform) > html_report
-       printf("    <h2> Build start: %s</h2>\n", format_time("%F %R", pkgsrc_build_start)) > html_report
-       printf("    <h2> Build end: %s</h2>\n", format_time("%F %R", pkgsrc_build_end)) > html_report
+       printf("    <h2> Build start: %s</h2>\n", pkgsrc_build_start_iso) > html_report
+       printf("    <h2> Build end: %s</h2>\n", pkgsrc_build_end_iso)) > html_report
        print "    <hr />" > html_report
 
        all_pkgs = pkgs_done + pkgs_failed + pkgs_prefailed + pkgs_indirect_failed + pkgs_indirect_prefailed
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/scripts/create-report-txt.awk
--- a/pkgtools/pbulk/files/pbulk/scripts/create-report-txt.awk  Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/create-report-txt.awk  Fri Jul 20 19:39:33 2007 +0000
@@ -1,5 +1,5 @@
 #!@AWK@ -f
-# $NetBSD: create-report-txt.awk,v 1.2 2007/06/29 22:43:26 joerg Exp $
+# $NetBSD: create-report-txt.awk,v 1.3 2007/07/20 19:39:34 joerg Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -45,13 +45,6 @@
        system("rm " tmp_sort)
 }
 
-function format_time(FORMAT, TIME, format_cmd) {
-       format_cmd = sprintf("date -r %d \"+%s\"", TIME, FORMAT)
-       format_cmd | getline
-       close format_cmd
-       return $0
-}
-
 BEGIN {
        meta_dir = ARGV[1]
        report_file = meta_dir "/report"
@@ -71,10 +64,12 @@
                        pkgsrc_platform = substr($0, 10)
                else if ($0 ~ "^COMPILER=")
                        pkgsrc_compiler = substr($0, 10)
-               else if ($0 ~ "^BUILD_START=")
-                       pkgsrc_build_start = substr($0, 13)
-               else if ($0 ~ "^BUILD_END=")
-                       pkgsrc_build_end = substr($0, 11)
+               else if ($0 ~ "^BUILD_START_ISO=")
+                       pkgsrc_build_start_iso = substr($0, 17)
+               else if ($0 ~ "^BUILD_START_DIR=")
+                       pkgsrc_build_start_dir = substr($0, 17)
+               else if ($0 ~ "^BUILD_END_ISO=")
+                       pkgsrc_build_end_iso = substr($0, 14)
                else if ($0 ~ "^BASE_URL=")
                        pkgsrc_base_url = substr($0, 10)
        }
@@ -129,10 +124,10 @@
        print pkgsrc_platform > txt_report
        print "Compiler: " pkgsrc_compiler > txt_report
        print "" > txt_report   
-       print "Build start: " format_time("%F %R", pkgsrc_build_start) > txt_report
-       print "Build end:   " format_time("%F %R", pkgsrc_build_end) > txt_report
+       print "Build start: " pkgsrc_build_start_iso > txt_report
+       print "Build end:   " pkgsrc_build_end_iso > txt_report
        print "" > txt_report
-       report_base_url = pkgsrc_base_url format_time("/%Y%m%d.%H%M", pkgsrc_build_start)
+       report_base_url = pkgsrc_base_url pkgsrc_build_start_dir
        print "Full report: " report_base_url "/meta/report.html" > txt_report
        print "Machine readable version: " report_base_url "/meta/report.bz2" > txt_report
        print "" > txt_report
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/scripts/pre-build
--- a/pkgtools/pbulk/files/pbulk/scripts/pre-build      Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build      Fri Jul 20 19:39:33 2007 +0000
@@ -1,5 +1,5 @@
 #!@SH@
-# $NetBSD: pre-build,v 1.1.1.1 2007/06/19 19:49:59 joerg Exp $
+# $NetBSD: pre-build,v 1.2 2007/07/20 19:39:34 joerg Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -50,6 +50,7 @@
 
 echo "PLATFORM=${opsys} ${opver}/${platform}" > ${loc}/status
 echo "COMPILER=${compiler}" >> ${loc}/status
-build_start=`date +%s`
-echo "BUILD_START=${build_start}" >> ${loc}/status
+
+date '+%Y-%m-%d %H:%M|%Y%m%d.%H%M' | sed 's/^\(.*\)|\(.*\)$/BUILD_START_ISO=\1\
+BUILD_START_DIR=\2/' >> ${loc}/status
 echo "BASE_URL=${base_url}" >> ${loc}/status
diff -r f7bb64c24c9d -r b95e44d4cd57 pkgtools/pbulk/files/pbulk/scripts/report
--- a/pkgtools/pbulk/files/pbulk/scripts/report Fri Jul 20 17:46:57 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/report Fri Jul 20 19:39:33 2007 +0000
@@ -1,5 +1,5 @@
 #!@SH@
-# $NetBSD: report,v 1.2 2007/07/16 20:35:04 joerg Exp $
+# $NetBSD: report,v 1.3 2007/07/20 19:39:34 joerg Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -51,23 +51,24 @@
 
 while read line; do
        case "${line}" in
-       BUILD_START=*)
-               build_start=${line#BUILD_START=}
+       BUILD_START_ISO=*)
+               build_start_iso=${line#BUILD_START_ISO=}
+               ;;
+       BUILD_START_DIR=*)
+               build_start_iso=${line#BUILD_START_DIR=}
                ;;
        PLATFORM=*)
                platform=${line#PLATFORM=}
        esac
 done < ${loc}/status
 
-if [ -z "${build_start}" ]; then
+if [ -z "${build_start_iso}" ] || [ -z "${build_start_dir}" ]; then
        echo "Could not find start time of build."
        exit 1
 fi
 
 echo "Sending report mail..."
-formatted_start=`date -r ${build_start} "+%F %R"`
-report_dir=`date -r ${build_start} "+%Y%m%d.%H%M"`
-cat ${loc}/report.txt | ${mail} -s "${report_subject_prefix} ${platform} ${formatted_start}" ${report_recipient}
+cat ${loc}/report.txt | ${mail} -s "${report_subject_prefix} ${platform} ${build_start_iso}" ${report_recipient}
 
 cd ${bulklog}
 echo "Uploading report..."
@@ -100,4 +101,4 @@
                [ -f "$file" ] && echo "+ $file"
        done
        echo "- *"
-} | ${rsync} --exclude-from=- ${report_rsync_args} . ${report_rsync_target}/${report_dir}
+} | ${rsync} --exclude-from=- ${report_rsync_args} . ${report_rsync_target}/${build_start_dir}



Home | Main Index | Thread Index | Old Index