Fix typos
[xorg-util-modular.git] / check-tarball.sh
blobd9f44312953560c262dde268bfbd2148c66d5b1d
1 #!/bin/bash
3 # This script checks the contents of a dist tarball against a make
4 # clean'ed working copy. The idea is to see if we have unused files
5 # sitting in cvs that could be removed or if we have files that should
6 # be dist'ed but aren't.
8 # Of course, a working copy will have a number of files that the
9 # tarball shouldn't have (e.g. autogen.sh) and vice versa
10 # (e.g. Makefile). Fortunately, that's a pretty small fixed list so
11 # we just filter out those differences.
13 # The script should be run on a ./configure'd component from the
14 # modular release, for example:
16 # ./check-tarball.sh cvs/lib/Xi
18 # will check the Xi library, assuming that ./configure has already
19 # been run in that working copy. As the script runs, it will make
20 # clean the working copy.
22 # At the end of the run, the script will diff the list of files in the
23 # working copy against the list of files in the tarball. Files in the
24 # working copy but not in the tarball will show up as deleted lines in
25 # the diff output. For example, lib/Xi has XFreeLst.c in the working
26 # copy but it isn't dist'ed, giving this output:
28 # --- module-files-24058.txt 2005-09-28 14:09:48.000000000 -0400
29 # +++ tar-files-24058.txt 2005-09-28 14:09:49.000000000 -0400
30 # @@ -50,7 +50,6 @@
31 # src/XDevBell.c
32 # src/XExtInt.c
33 # src/XExtToWire.c
34 # -src/XFreeLst.c
35 # src/XGetBMap.c
36 # src/XGetDCtl.c
37 # src/XGetFCtl.c
39 # Strip trailing /
40 dir=${1%%/}
42 echo Checking $dir
44 if test ! -e $dir/Makefile; then
45 echo $dir not ./configure\'d, bailing out
46 exit 1
49 make -C $dir dist
50 make -C $dir clean
52 # We can't easily extract name and version from the configure.ac, so
53 # we just glob for the dist tarball.
55 tarball=$dir/*.tar.bz2
57 blacklist="config.log config.status autogen.sh$ Makefile.in$ Makefile$ config.h$ .libs/ .deps/ configure$ ^autom4te.cache.* CVS/.* .*/$ .cvsignore$ .*tar.bz2$ .*tar.gz$ .*\.o$ .*\.lo$ .*\.Plo$ .*\.la$ .*\.pc$ stamp-h1$ ^libtool$ .*~$"
59 # handle grep escape madness
60 escaped_blacklist=$(for f in $blacklist; do echo -n '\('$f'\)\|'; done)
61 escaped_blacklist=${escaped_blacklist%%\\|}
63 module_files=module-files-$$.txt
64 tar_files=tar-files-$$.txt
66 find -L $dir -type f | sed -e "s,^$dir/,," | grep -v $escaped_blacklist | sort > $module_files
68 tar tf $tarball | cut -d / -f 2- | grep -v $escaped_blacklist | sort | tail +2 > $tar_files
70 echo
71 echo === diffs to module files: ===
72 echo
74 diff -u $module_files $tar_files
76 rm $module_files $tar_files