diff options
author | wiz <wiz> | 2009-08-21 12:51:07 +0000 |
---|---|---|
committer | wiz <wiz> | 2009-08-21 12:51:07 +0000 |
commit | 59d5e98fa79fe928c12568c6bbc6badfa1d6abce (patch) | |
tree | 74eb3fb860b3d8ff0df79ece0a8087e3efd33983 /mk/scripts | |
parent | 78fec6218c8c4e27e9481bfbd8be5f2db88d48bf (diff) | |
download | pkgsrc-59d5e98fa79fe928c12568c6bbc6badfa1d6abce.tar.gz |
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 (limited to 'mk/scripts')
-rwxr-xr-x | mk/scripts/remove_todo | 42 |
1 files changed, 42 insertions, 0 deletions
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 |