diff options
author | wiz <wiz> | 2009-08-21 12:51:07 +0000 |
---|---|---|
committer | wiz <wiz> | 2009-08-21 12:51:07 +0000 |
commit | a7ba7f282c99a8756485ccc3093a1d775e9bf7fd (patch) | |
tree | 74eb3fb860b3d8ff0df79ece0a8087e3efd33983 /mk/scripts | |
parent | a4afead85a072477dc156207d294d3ba25ddc8c0 (diff) | |
download | pkgsrc-a7ba7f282c99a8756485ccc3093a1d775e9bf7fd.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 |