summaryrefslogtreecommitdiff
path: root/bin/ooo-news-filter-old
blob: b79b1306c66da7084419581ca260e24987dee4ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

usage()
{
    echo "This script filter the ooo-build NEWS file to show only the changes"
    echo "that are not mentioned in another NEWS file from another branch."
    echo
    echo "Usage: ${0##*/} new_news other_news"
    echo
    echo "Parameters:"
    echo
    echo "	new_news	news files including some newer changes"
    echo "	other_news	news file from other ooo-build branch that"
    echo "			includes some changes from new_news"
}

if test "$1" = "--help" -o $# -ne 2 ; then
    usage
    exit 0;
fi

new_news="$1"
other_news="$2"

for file in "$new_news" "$other_news" ; do
    if test ! -f "$file" ; then
	echo "Error: the file does not exist: $file"
	exit 1;
    fi
done

# create grep patterns from the other news file
# do not put there version and section lines; just changes entries
patterns=`mktemp /tmp/ooo-news-filer-old-XXXXXX`
grep "^	+ " "$other_news" | \
    sed -e "s|\#|\\\#|" \
	-e "s|\[|\\\[|" \
	-e "s|\]|\\\]|"  >"$patterns"

# print the new log without the old entries
echo "Filtering - go and have some tee..." 1>&2
grep -f "$patterns" -v "$new_news"

# remove temporary files
rm $patterns