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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
#!/bin/bash
#
# Regina - A Normal Surface Theory Calculator
# Source Distribution Verification
#
# Copyright (c) 2003-2006, Ben Burton
# For further details contact Ben Burton (bab@debian.org).
#
# Usage: distcheck <dist-tarball>
#
# Verifies that a tarball formed using "make dist" contains all the
# files it should. This script outputs a list of files contained in
# the subversion source tree that are missing from the tarball.
#
# Files that are not necessary for inclusion in the tarball (such as
# auto-generated files or the Regina website) are not included in this
# output.
#
# This script must be run from either the top-level source directory within
# the subversion source tree, or from the admin/ directory beneath it.
#
# Requires: diff, find, grep, mktemp, sed, sort, tar
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
set -e
# Command-line sanity check.
if [ "$#" != 1 ]; then
echo "Usage: distcheck <dist-tarball>"
exit 1
fi
# Locate the top of the subversion source tree.
if [ ! -d .svn ]; then
echo "This script must be run from within the subversion source tree."
exit 1
fi
if [ -d admin -a -f HIGHLIGHTS.txt ]; then
svntree=.
elif [ -d ../admin -a -f ../HIGHLIGHTS.txt ]; then
svntree=..
else
echo "This script must be run from either the top-level source directory"
echo "within the subversion source tree, or from the admin/ directory"
echo "beneath it."
exit 1
fi
# Prepare the two temporary file lists.
svnlist="`mktemp -t svnlist.XXXXXXXXXX`" || svnlist=
distlist="`mktemp -t distlist.XXXXXXXXXX`" || distlist=
if [ -z "$svnlist" -o -z "$distlist" ]; then
echo "Error creating temporary files."
exit 1
fi
# Make a list of files in the distribution tarball.
echo "Analysing distribution tarball..."
if [ ! -f "$1" ]; then
echo "The distribution tarball $1 does not exist or is not a regular file."
exit 1
fi
case "$1" in
*.tar.gz )
taropts=-ztf
;;
*.tgz )
taropts=-ztf
;;
*.tar.bz2 )
taropts=-jtf
;;
*.tar )
taropts=-tf
;;
* )
echo "The distribution tarball $1 is not of the correct type."
exit 1
;;
esac
if ! tar "$taropts" "$1" | sed -e 's%^[^/]*/%%' -e 's%/$%%' | \
sort > "$distlist"; then
echo "The contents of the distribution tarball $1 could not be listed."
exit 1
fi
# Make a list of files in the subversion source tree.
echo "Analysing subversion source tree..."
if ! find "$svntree" | sed -e 's%^[^/]*/%%' | \
grep -v '^\.$' | \
grep -v '^\.\.$' | \
grep -v '\(^\|/\)\.svn$' | \
grep -v '\.svn/' | \
grep -v 'Makefile$' | \
grep -v '\.a$' | \
grep -v '\.deps$' | \
grep -v '\.deps/' | \
grep -v '\.kidl$' | \
grep -v '\.la$' | \
grep -v '\.la\.closure$' | \
grep -v '\.libs\(/\|$\)' | \
grep -v '\.lo$' | \
grep -v '\.moc$' | \
grep -v '\.o$' | \
grep -v '^autom4te.cache' | \
grep -v '^config.log$' | \
grep -v '^config.status$' | \
grep -v '^debian' | \
grep -v '^docs/engine/.*\.css$' | \
grep -v '^docs/engine/.*\.gif$' | \
grep -v '^docs/engine/.*\.html$' | \
grep -v '^docs/engine/.*\.png$' | \
grep -v '^docs/engine/doxygen' | \
grep -v '^docs/engine/graph_legend' | \
grep -v '^docs/man/manpage\.' | \
grep -v '^engine/engine/regina-config\.h$' | \
grep -v '^engine/engine/regina-engine-config$' | \
grep -v '^engine/engine/snappea/kernel/unused\(/\|$\)' | \
grep -v '^engine/engine/stamp-h' | \
grep -v '^icons/src\(/\|$\)' | \
grep -v '^kdeui/.*/index.cache.bz2$' | \
grep -v '^kdeui/src/shell/regina-kde$' | \
grep -v '^libtool$' | \
grep -v '^metrics' | \
grep -v '^python/regina-python$' | \
grep -v '^python/tests\(/\|$\)' | \
grep -v '^regina.*\.tar\.bz2$' | \
grep -v '^regina.*\.tar\.gz$' | \
grep -v '^regina.*\.zip$' | \
grep -v '^regina.spec$' | \
grep -v '^rpmspec' | \
grep -v '^sfdist' | \
grep -v '^stuff' | \
grep -v '^test$' | \
grep -v '^test/' | \
grep -v '^testsuite/regtestsuite$' | \
grep -v '^utils/reg[a-z]\+$' | \
grep -v '^utils/[a-z]\+census[a-z]*$' | \
grep -v '^utils/trisetcmp$' | \
grep -v '^utils/local\(/\|$\)' | \
grep -v '^utils/mpi/[a-z\-]\+-mpi$' | \
grep -v '^utils/snappea\(/\|$\)' | \
grep -v '^www' | \
sort > "$svnlist" ; then
echo "The contents of the subversion source tree could not be listed."
exit 1
fi
# Output the differences.
diff -B "$svnlist" "$distlist" | grep -v '^[0-9]'
# Clean up.
rm "$svnlist" "$distlist"
|