summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-02-21 19:26:03 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-02-21 19:26:03 (GMT)
commitcec02b0b3e68743dacb5d68d42603d8280f9a3a0 (patch)
tree1c765b0060242c3cfee6b44c5c053ab408f9a890
parenta93751a342ec3e1d8aba71a25f4a68719d8503c9 (diff)
downloadhdf5-cec02b0b3e68743dacb5d68d42603d8280f9a3a0.zip
hdf5-cec02b0b3e68743dacb5d68d42603d8280f9a3a0.tar.gz
hdf5-cec02b0b3e68743dacb5d68d42603d8280f9a3a0.tar.bz2
[svn-r26266] Updated bin/chkmanifest to use 'svn stat' and 'svn ls' instead
of hacking at the .svn/entries file that changes format all the time.
-rwxr-xr-xbin/chkmanifest124
1 files changed, 34 insertions, 90 deletions
diff --git a/bin/chkmanifest b/bin/chkmanifest
index 70c38a9..02127cc 100755
--- a/bin/chkmanifest
+++ b/bin/chkmanifest
@@ -20,75 +20,17 @@
verbose=yes
MANIFEST=/tmp/HD_MANIFEST.$$
-SVNENTRY=/tmp/HD_SVNENTRY.$$
-
-# function definitions
-
-GETSVNENTRIES_13 ()
-# Purpose: Extract filenames from the svn v1.3.* entries file
-# $1: directory name in which the svn entries is.
-# steps:
-# 1. remove all single line entries so that step 2 does not fail on them.
-# 2. merge all multiple lines entries into single lines.
-# 3. remove all non file entries.
-# 4. insert a blank line because some entries files has no kind="file"
-# entry and ed does not like to do g on an empty file.
-# 5. remove everything except the file name.
-# 6. remove all blank lines, including the inserted one.
-{
-cp $1/entries $SVNENTRY
-chmod u+w $SVNENTRY # entries file is not writable.
-ed - $SVNENTRY <<EOF
-g/^<.*>$/d
-g/^</.,/>$/j
-v/kind="file"/d
-a
-
-.
-g/.*name="/s///
-g/".*/s///
-g/^$/d
-w
-q
-EOF
-cat $SVNENTRY
-rm $SVNENTRY
-}
-
-GETSVNENTRIES_14 ()
-# Purpose: Extract filenames from the svn v1.4.* entries file
-# $1: directory name in which the svn entries is.
-# steps:
-# 1. all valid files are followed by a line containing "file" only.
-# 2. find them by looking for "file" first, then mark its preceding line as
-# wanted.
-# 3. remove all non-marked line.
-# 4. insert a blank line because some entries files has no kind="file"
-# entry and ed does not like to do g on an empty file.
-# 5. remove the marks.
-{
-cp $1/entries $SVNENTRY
-chmod u+w $SVNENTRY # entries file is not writable.
-ed - $SVNENTRY <<EOF
-g/^file$/-s/^/%WANTED%/
-v/%WANTED%/d
-a
-
-.
-g/^%WANTED%/s///
-w
-q
-EOF
-cat $SVNENTRY
-rm $SVNENTRY
-}
-
# Main
test "$verbose" && echo " Checking MANIFEST..." 1>&2
# clean up $MANIFEST file when exits
trap "rm -f $MANIFEST" 0
+# Only split lines on newline, not whitespace
+set -f
+IFS='
+'
+
# 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.
@@ -132,36 +74,38 @@ for file in `cat $MANIFEST`; do
fi
done
+# 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.
+svn_stat="$(svn stat -q)"
+for file in $svn_stat; do
+ letter="$(echo $file | head -c 1)"
+ if [ "$letter" = "A" ]; then
+ path=`echo $file | sed 's/^A\s*/\.\//g'`
+ # Ignore directories
+ if [ ! -d $path ]; then
+ if (grep ^$path$ $MANIFEST >/dev/null); then
+ :
+ else
+ echo "+ $path"
+ fail=yes
+ fi
+ fi
+ fi
+done
-# Inspect the .svn/entries to figure out what version of svn file entry is
-# used.
-# The following algorithm is formed via reverse engineering.
-# I don't know what the official svn format is if such a specification exists.
-# Algorithm:
-# If the first line of the file has 'xml version="1.0"' in it, it is created
-# by svn 1.3 or older; else if it has '^file$' in it, it is created by svn 1.4.
-svn_entry_file=.svn/entries
-if head -1 $svn_entry_file | grep 'xml version="1.0"' > /dev/null 2>&1;then
- getsvnentries=GETSVNENTRIES_13
-elif grep '^file$' $svn_entry_file > /dev/null 2>&1; then
- getsvnentries=GETSVNENTRIES_14
-else
- echo "Unknown svn entries format. Aborted"
- exit 1
-fi
-
-for svn in `find . -type d -name .svn -print`; do
- path=`echo $svn |sed 's/\/.svn//'`
- for file in `$getsvnentries $svn`; do
- if (grep ^$path/$file$ $MANIFEST >/dev/null); then
- :
- else
- echo "+ $path/$file"
- fail=yes
- fi
- done
+# Next check svn info, which gets a list of all files that are
+# checked in.
+svn_ls="$(svn ls -R)"
+for file in $svn_ls; do
+ path="./${file}"
done
+
+
+# Finish up
if [ "X$fail" = "Xyes" ]; then
cat 1>&2 <<EOF
The MANIFEST is out of date. Files marked with a minus sign (-) no