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
|
#!/bin/sh
echo "Getting the contents files from sid for amd64 and all ..."
wget --quiet https://deb.debian.org/debian/dists/sid/main/Contents-amd64.gz
wget --quiet https://deb.debian.org/debian/dists/sid/main/Contents-all.gz
echo "Filtering out only manpages ..."
gzip -dc Contents-amd64.gz Contents-all.gz | grep "^usr/share/man/man*" > only-manpages.txt
rm -f Contents-amd64.gz Contents-all.gz
echo "Searching for conflicting manpages ..."
for manpage in man*/*; do
grep "usr/share/man/$manpage.gz" only-manpages.txt |
grep -v "[^,]doc/manpages-dev$" |
grep -v "[^,]doc/manpages$"
done > manpages-in-other-packages.txt
LC_ALL=C sort -o manpages-in-other-packages.txt manpages-in-other-packages.txt
rm -f only-manpages.txt
echo "Refreshing debian/rules ..."
cut -d" " -f1 manpages-in-other-packages.txt | while IFS= read -r manpage; do
section=$(basename "$manpage" .gz | sed -e "s/.*\.//")
if [ "$section" -ge 2 ] && [ "$section" -le 3 ]; then
debian_path="debian/manpages-dev"
else
debian_path="debian/manpages"
fi
debian_path=$debian_path/$(dirname "$manpage")
debian_path=$debian_path/$(basename "$manpage" .gz)
printf "\trm -f %s\n" "$debian_path"
done > rules-snippet
rm -f manpages-in-other-packages.txt
lead="^\t# Start of automatically added files by debian\/check-conflicts$"
tail="^\t# End of automatically added files by debian\/check-conflicts$"
sed -i -e "/$lead/,/$tail/{ /$lead/{p; r rules-snippet
}; /$tail/p; d }" debian/rules
rm -f rules-snippet
|