1999-10-27 03:30:08 +08:00
|
|
|
#!/bin/sh
|
2005-10-22 23:35:28 +08:00
|
|
|
#
|
2007-02-15 06:25:02 +08:00
|
|
|
# Copyright by The HDF Group.
|
2005-10-22 23:35:28 +08:00
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
# is linked from the top-level documents page. It can also be found at
|
2007-02-15 06:25:02 +08:00
|
|
|
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
# access to either file, you may request a copy from help@hdfgroup.org.
|
2005-10-22 23:35:28 +08:00
|
|
|
#
|
1999-10-27 03:30:08 +08:00
|
|
|
|
|
|
|
# Check that all the files in MANIFEST exist and that (if this is a
|
2006-07-21 03:02:14 +08:00
|
|
|
# SVN checkout) that all the SVN-managed files appear in the
|
1999-10-27 03:30:08 +08:00
|
|
|
# MANIFEST.
|
|
|
|
|
|
|
|
verbose=yes
|
2007-06-25 08:15:56 +08:00
|
|
|
MANIFEST=/tmp/HD_MANIFEST.$$
|
2006-07-21 03:02:14 +08:00
|
|
|
|
|
|
|
# Main
|
|
|
|
test "$verbose" && echo " Checking MANIFEST..." 1>&2
|
2000-06-08 04:41:49 +08:00
|
|
|
# clean up $MANIFEST file when exits
|
|
|
|
trap "rm -f $MANIFEST" 0
|
|
|
|
|
2015-02-26 22:02:48 +08:00
|
|
|
# Only split lines on newline, not whitespace
|
|
|
|
set -f
|
|
|
|
IFS='
|
|
|
|
'
|
|
|
|
|
2006-08-06 15:45:52 +08:00
|
|
|
# First make sure i am in the directory in which there is an MANIFEST file
|
|
|
|
# and then do the checking from there. Will try the following,
|
|
|
|
# current directory, parent directory, the directory this command resides.
|
|
|
|
if [ -f MANIFEST ]; then
|
|
|
|
continue
|
|
|
|
elif [ -f ../MANIFEST ]; then
|
|
|
|
cd ..
|
|
|
|
else
|
|
|
|
commanddir=`dirname $0`
|
|
|
|
if [ -d "$commanddir" -a -f $commanddir/MANIFEST ]; then
|
|
|
|
cd $commanddir
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
echo MANIFEST file not found. Abort.
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-07-21 03:02:14 +08:00
|
|
|
fi
|
|
|
|
|
2009-07-10 00:46:41 +08:00
|
|
|
# Check for duplicate entries. This can be done at any time, but it may as
|
|
|
|
# well be sooner so that if something else fails the presence of duplicates
|
|
|
|
# will already be known.
|
|
|
|
errcode=0
|
|
|
|
DUPLICATES=`perl -ne 's/#.*//; next if /^\s*$/; if ($uniq{$_}++) { print $_; }' MANIFEST`
|
|
|
|
if [ "$DUPLICATES" ]; then
|
|
|
|
cat 1>&2 <<EOF
|
|
|
|
These entries appear more than once in the MANIFEST:
|
|
|
|
$DUPLICATES
|
|
|
|
Please remove the duplicate lines and try again.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
errcode=1
|
|
|
|
fi
|
|
|
|
|
1999-10-27 03:30:08 +08:00
|
|
|
# Copy the manifest file to get a list of file names.
|
|
|
|
grep '^\.' MANIFEST | expand | cut -f1 -d' ' >$MANIFEST
|
|
|
|
|
|
|
|
for file in `cat $MANIFEST`; do
|
|
|
|
if [ ! -f $file ]; then
|
|
|
|
echo "- $file"
|
|
|
|
fail=yes
|
|
|
|
fi
|
|
|
|
done
|
2006-07-21 03:02:14 +08:00
|
|
|
|
2015-02-26 22:02:48 +08:00
|
|
|
# Get the list of files under version control and check that they are
|
|
|
|
# present.
|
|
|
|
#
|
|
|
|
# First get a list of all the pending files with svn stat and
|
|
|
|
# check those.
|
2015-03-11 14:40:54 +08:00
|
|
|
svn_stat=`svn stat -q`
|
2015-02-26 22:02:48 +08:00
|
|
|
for file in $svn_stat; do
|
2015-03-11 14:40:54 +08:00
|
|
|
|
2015-02-26 22:02:48 +08:00
|
|
|
# Newly added files are not listed by svn ls, which
|
2015-03-11 14:40:54 +08:00
|
|
|
# we check later.
|
|
|
|
|
|
|
|
# The line listing new files starts with 'A'.
|
|
|
|
letter=`echo $file | head -c 1`
|
2015-02-26 22:02:48 +08:00
|
|
|
if [ "$letter" = "A" ]; then
|
2015-03-04 07:31:31 +08:00
|
|
|
# Convert the seven Subversion status columns to './' so it matches
|
2015-02-26 22:02:48 +08:00
|
|
|
# the manifest file name.
|
2015-03-04 07:31:31 +08:00
|
|
|
#
|
|
|
|
# There is a space between the status columns and file name, hence
|
|
|
|
# the '8' instead of '7'.
|
|
|
|
path=`echo $file | sed 's/^.\{8\}/\.\//g'`
|
2015-02-26 22:02:48 +08:00
|
|
|
# Ignore directories
|
|
|
|
if [ ! -d $path ]; then
|
|
|
|
if (grep ^$path$ $MANIFEST >/dev/null); then
|
|
|
|
:
|
|
|
|
else
|
2015-03-04 07:31:31 +08:00
|
|
|
echo "- $path"
|
2015-02-26 22:02:48 +08:00
|
|
|
fail=yes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2009-07-10 00:46:41 +08:00
|
|
|
|
2015-02-26 22:02:48 +08:00
|
|
|
# Next check svn ls, which gets a list of all files that are
|
|
|
|
# checked in.
|
2015-03-11 14:40:54 +08:00
|
|
|
svn_ls=`svn ls -R`
|
2015-02-26 22:02:48 +08:00
|
|
|
for file in $svn_ls; do
|
|
|
|
path="./${file}"
|
|
|
|
# Ignore directories
|
|
|
|
if [ ! -d $path ]; then
|
|
|
|
if (grep ^$path$ $MANIFEST >/dev/null); then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "+ $path"
|
|
|
|
fail=yes
|
|
|
|
fi
|
|
|
|
fi
|
1999-10-27 03:30:08 +08:00
|
|
|
done
|
|
|
|
|
2015-02-26 22:02:48 +08:00
|
|
|
# Finish up
|
1999-10-27 03:30:08 +08:00
|
|
|
if [ "X$fail" = "Xyes" ]; then
|
|
|
|
cat 1>&2 <<EOF
|
|
|
|
The MANIFEST is out of date. Files marked with a minus sign (-) no
|
2006-07-21 03:02:14 +08:00
|
|
|
longer exist; files marked with a plus sign (+) are SVN-managed but do
|
1999-10-27 03:30:08 +08:00
|
|
|
not appear in the MANIFEST. Please remedy the situation and try again.
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-10-01 11:44:43 +08:00
|
|
|
if [ $errcode -ne 0 ]; then
|
|
|
|
exit 1
|
2009-07-10 00:46:41 +08:00
|
|
|
fi
|
|
|
|
|
2000-01-08 07:23:57 +08:00
|
|
|
test "$verbose" && echo " The MANIFEST is up to date." 1>&2
|
1999-10-27 03:30:08 +08:00
|
|
|
exit 0
|