pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk When making an entry to the CHANGES-* file using 'm...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a905eda2e5ed
branches:  trunk
changeset: 397978:a905eda2e5ed
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Fri Aug 21 12:51:07 2009 +0000

description:
When making an entry to the CHANGES-* file using 'make changes-entry',
the target now automatically also removes any TODO entries for the
package that was updated.

Script improved based on version by dholland; further suggestions
by gdt and joerg.

diffstat:

 mk/misc/developer.mk   |  32 ++++++++++++++++++++++----------
 mk/scripts/remove_todo |  42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 10 deletions(-)

diffs (132 lines):

diff -r 9a365b144ba6 -r a905eda2e5ed mk/misc/developer.mk
--- a/mk/misc/developer.mk      Fri Aug 21 12:48:14 2009 +0000
+++ b/mk/misc/developer.mk      Fri Aug 21 12:51:07 2009 +0000
@@ -1,10 +1,12 @@
-# $NetBSD: developer.mk,v 1.15 2008/11/05 08:21:56 rillig Exp $
+# $NetBSD: developer.mk,v 1.16 2009/08/21 12:51:07 wiz Exp $
 #
 # Public targets for developers:
 #
 # changes-entry-noupdate:
-#      Appends a correctly-formatted entry to the pkgsrc CHANGES file.
-#      The CHANGES file is presumed to be up to date and writable.
+#      Appends a correctly-formatted entry to the pkgsrc CHANGES file,
+#      and removes any TODO entries that were completed with this
+#      update from the TODO file.
+#      The CHANGES and TODO files are presumed to be up to date and writable.
 #      Note that the first assumption is often wrong and that the
 #      second is wrong for those that set CVSREAD.
 #
@@ -30,13 +32,18 @@
 #              is appended.
 #              The default is ${PKGSRCDIR}/doc/CHANGES-YYYY.
 #
+#      PKGSRC_TODO
+#              The path to the TODO file from which now possibly
+#              obsolete entries are removed
+#              The default is ${PKGSRCDIR}/TODO.
+#
 #      Example usage:
 #              % cd /usr/pkgsrc/category/package
 #              % make changes-entry CTYPE=Added
 #
 # changes-entry:
-#      Like changes-entry-noupdate, plus the CHANGES file is updated,
-#      and if not writable, "cvs edit" is done.
+#      Like changes-entry-noupdate, plus the CHANGES and TODO files
+#      are updated, and if not writable, "cvs edit" is done.
 #
 # commit-changes-entry:
 # cce:
@@ -51,6 +58,7 @@
 PKGSRC_CHANGES_DIR=    ${PKGSRCDIR}/doc/
 PKGSRC_CHANGES_BASE=   CHANGES-${_CYEAR_cmd:sh}
 PKGSRC_CHANGES?=       ${PKGSRC_CHANGES_DIR}/${PKGSRC_CHANGES_BASE}
+PKGSRC_TODO?=          ${PKGSRC_CHANGES_DIR}/TODO
 
 _CYEAR_cmd=            ${DATE} -u +%Y
 _CDATE_cmd=            ${DATE} -u +%Y-%m-%d
@@ -89,17 +97,21 @@
 
 # Targets for the update, add, commit elementary operations.
 changes-entry-update: .PHONY ce-error-check
-       @${STEP_MSG} "Updating ${PKGSRC_CHANGES:T}"
-       ${RUN} cd ${PKGSRC_CHANGES_DIR} && cvs update ${PKGSRC_CHANGES:T}
+       @${STEP_MSG} "Updating ${PKGSRC_CHANGES:T} and ${PKGSRC_TODO:T}"
+       ${RUN} cd ${PKGSRC_CHANGES_DIR} && cvs update ${PKGSRC_CHANGES:T} ${PKGSRC_TODO:T}
        ${RUN} cd ${PKGSRC_CHANGES_DIR} && test -w ${PKGSRC_CHANGES:T} || cvs edit ${PKGSRC_CHANGES:T}
+       ${RUN} cd ${PKGSRC_CHANGES_DIR} && test -w ${PKGSRC_TODO:T} || cvs edit ${PKGSRC_TODO:T}
 
 changes-entry-add: .PHONY ce-error-check
        @${STEP_MSG} "Adding the change"
        ${RUN} ${ECHO} "        "${_CE_MSG:Q} >> ${PKGSRC_CHANGES}
 
+todo-entry-remove:
+       ${RUN} ${SH} ${PKGSRCDIR}/mk/scripts/remove_todo ${PKGSRC_TODO} ${PKGBASE} ${PKGVERSION}
+
 changes-entry-commit: .PHONY ce-error-check
        @${STEP_MSG} "Committing the change"
-       ${RUN} cd ${PKGSRC_CHANGES_DIR} && cvs commit -m ${_CE_MSG1:Q} ${PKGSRC_CHANGES:T}
+       ${RUN} cd ${PKGSRC_CHANGES_DIR} && cvs commit -m ${_CE_MSG1:Q} ${PKGSRC_CHANGES:T} ${PKGSRC_TODO:T}
 
 ce-error-check: .PHONY
 .if defined(_CE_ERRORS) && !empty(_CE_ERRORS:M*)
@@ -109,10 +121,10 @@
 .endif
 
 # Public targets
-changes-entry-noupdate: .PHONY ce-error-check changes-entry-add
+changes-entry-noupdate: .PHONY ce-error-check changes-entry-add todo-entry-remove
        @${DO_NADA}
 
-changes-entry: .PHONY ce-error-check changes-entry-update changes-entry-add
+changes-entry: .PHONY ce-error-check changes-entry-update changes-entry-add todo-entry-remove
        @${DO_NADA}
 
 commit-changes-entry cce: .PHONY ce-error-check changes-entry-update changes-entry-add changes-entry-commit
diff -r 9a365b144ba6 -r a905eda2e5ed mk/scripts/remove_todo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/scripts/remove_todo    Fri Aug 21 12:51:07 2009 +0000
@@ -0,0 +1,42 @@
+#!/bin/sh
+# usage:
+# $0 TODO-FILE PKGBASE PKGVERSION
+# for example
+# $0 /usr/pkgsrc/doc/TODO opal 3.6.4
+# removes an entry for opal 3.6.4 or an older version from /usr/pkgsrc/doc/TODO
+#
+# test cases:
+# remove_todo foo-1.2 with no foo entry in TODO
+# remove_todo foo-1.2 with "foo-1.1", "foo-1.2", or "foo-1.3" in TODO
+# remove_todo foo-1.2 with "foo-bar-1.1" in TODO
+# remove_todo foo-1.2 with "foo-1.1 [some comment]", "foo-1.2 [some comment]", "foo-1.3 [some comment] in TODO
+set -e
+
+if [ "$#" != 3 ]
+then
+    echo incorrect number of arguments >&2
+    echo usage: $0 TODO-FILE PKGBASE PKGVERSION >&2
+    exit 1
+fi
+
+TODO=$1
+PKGBASE=$2
+PKGVERSION=$3
+TMPFILE="$TODO.$$"
+
+MATCH=$(grep -n '^[    ]*o '"$PKGBASE"'-[0-9]' "$TODO" | sed 's/^\([^:]*:\)[   ]*o /\1/;s/ .*//')
+
+if [ $(echo "$MATCH" | wc -l) != 1 ]; then
+     echo "$0: multiple matches" 1>&2
+     echo "$MATCH" 1>&2
+     exit 1
+fi
+
+LINE=$(echo "$MATCH" | sed 's/:.*//')
+FOUNDPKG=$(echo "$MATCH" | sed -e "s/^[^:]*://")
+
+if pkg_admin pmatch "$PKGBASE"\<="$PKGVERSION" "$FOUNDPKG"; then
+    echo Removing "$FOUNDPKG" from TODO
+    sed < "$TODO" "$LINE"d > "$TMPFILE"
+    mv "$TMPFILE" "$TODO"
+fi



Home | Main Index | Thread Index | Old Index