summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/misc/developer.mk32
-rwxr-xr-xmk/scripts/remove_todo42
2 files changed, 64 insertions, 10 deletions
diff --git a/mk/misc/developer.mk b/mk/misc/developer.mk
index 8fbe82c0aea..08a779019f3 100644
--- a/mk/misc/developer.mk
+++ b/mk/misc/developer.mk
@@ -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 @@ NETBSD_LOGIN_NAME?= ${_NETBSD_LOGIN_NAME_cmd:sh}
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 @@ _CE_MSG= ${_CE_MSG1} ${_CE_MSG2}
# 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 @@ ce-error-check: .PHONY
.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 --git a/mk/scripts/remove_todo b/mk/scripts/remove_todo
new file mode 100755
index 00000000000..191a5dd733d
--- /dev/null
+++ b/mk/scripts/remove_todo
@@ -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