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
|
2017-04-18 03:32:16 +08:00
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# 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
|
|
|
|
2016-10-25 05:27:17 +08:00
|
|
|
# Check that all the files in MANIFEST exist and (if this is a
|
|
|
|
# GIT checkout) that all the GIT-managed files appear in the
|
1999-10-27 03:30:08 +08:00
|
|
|
# MANIFEST.
|
2015-11-19 01:31:51 +08:00
|
|
|
#
|
1999-10-27 03:30:08 +08:00
|
|
|
|
|
|
|
verbose=yes
|
2007-06-25 08:15:56 +08:00
|
|
|
MANIFEST=/tmp/HD_MANIFEST.$$
|
2015-11-19 01:31:51 +08:00
|
|
|
AUTOGEN=./autogen.sh
|
|
|
|
AUTOGEN_LOG=/tmp/autogen.log.$$
|
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
|
|
|
|
|
2015-11-19 01:31:51 +08:00
|
|
|
# Do an autogen if generated files (e.g., configure) is not present
|
|
|
|
if [ ! -f configure ]; then
|
2016-08-30 23:58:12 +08:00
|
|
|
echo " running $AUTOGEN"
|
|
|
|
$AUTOGEN > $AUTOGEN_LOG 2>&1
|
2015-11-19 01:31:51 +08:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo $AUTOGEN encountered error. Abort.
|
|
|
|
echo output from $AUTOGEN:
|
|
|
|
cat $AUTOGEN_LOG
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
rm $AUTOGEN_LOG
|
|
|
|
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.
|
|
|
|
#
|
2016-08-30 05:42:53 +08:00
|
|
|
# First get a list of all the pending files with git status and
|
2015-02-26 22:02:48 +08:00
|
|
|
# check those.
|
2016-08-30 05:42:53 +08:00
|
|
|
git_stat=`git status -s`
|
|
|
|
for file in $git_stat; do
|
2015-03-11 14:40:54 +08:00
|
|
|
|
2016-08-30 05:42:53 +08:00
|
|
|
# Newly added files are not listed by git ls-files, 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
|
2016-08-30 05:42:53 +08:00
|
|
|
# Convert the git 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
|
2016-08-30 05:42:53 +08:00
|
|
|
# the '3'.
|
|
|
|
path=`echo $file | sed 's/^.\{3\}/\.\//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
|
|
|
|
2016-08-30 05:42:53 +08:00
|
|
|
# Next check git ls-files, which gets a list of all files that are
|
2015-02-26 22:02:48 +08:00
|
|
|
# checked in.
|
2016-08-30 05:42:53 +08:00
|
|
|
git_ls=`git ls-files`
|
|
|
|
for file in $git_ls; do
|
2015-02-26 22:02:48 +08:00
|
|
|
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
|
2016-10-25 05:27:17 +08:00
|
|
|
longer exist; files marked with a plus sign (+) are GIT-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
|