debian/xz-utils: Remove old NEWS.Debian
[xz/debian.git] / src / liblzma / validate_map.sh
blob3aee46687c38a376bef334522bcdedf1bf04308b
1 #!/bin/sh
3 ###############################################################################
5 # Check liblzma.map for certain types of errors
7 # Author: Lasse Collin
9 # This file has been put into the public domain.
10 # You can do whatever you want with this file.
12 ###############################################################################
14 LC_ALL=C
15 export LC_ALL
17 STATUS=0
19 cd "$(dirname "$0")"
21 # Get the list of symbols that aren't defined in liblzma.map.
22 SYMS=$(sed -n 's/^extern LZMA_API([^)]*) \([a-z0-9_]*\)(.*$/\1;/p' \
23 api/lzma/*.h \
24 | sort \
25 | grep -Fve "$(sed '/[{}:*]/d;/^$/d;s/^ //' liblzma.map)")
27 # Check that there are no old alpha or beta versions listed.
28 VER=$(cd ../.. && sh build-aux/version.sh)
29 NAMES=
30 case $VER in
31 *alpha | *beta)
32 NAMES=$(sed -n 's/^.*XZ_\([^ ]*\)\(alpha\|beta\) .*$/\1\2/p' \
33 liblzma.map | grep -Fv "$VER")
35 esac
37 # Check for duplicate lines. It can catch missing dependencies.
38 DUPS=$(sort liblzma.map | sed '/^$/d;/^global:$/d' | uniq -d)
40 # Print error messages if needed.
41 if test -n "$SYMS$NAMES$DUPS"; then
42 echo
43 echo 'validate_map.sh found problems from liblzma.map:'
44 echo
46 if test -n "$SYMS"; then
47 echo 'liblzma.map lacks the following symbols:'
48 echo "$SYMS"
49 echo
52 if test -n "$NAMES"; then
53 echo 'Obsolete alpha or beta version names:'
54 echo "$NAMES"
55 echo
58 if test -n "$DUPS"; then
59 echo 'Duplicate lines:'
60 echo "$DUPS"
61 echo
64 STATUS=1
67 # Exit status is 1 if problems were found, 0 otherwise.
68 exit "$STATUS"