summaryrefslogtreecommitdiffstats
path: root/bin/chkmanifest
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-02-26 14:02:48 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-02-26 14:02:48 (GMT)
commita83b6d665123ed36b72607b1e17aa7cb96696eb9 (patch)
treed1367b2c08db3f37fee422fb0ba6b73798b0f4fc /bin/chkmanifest
parentaad4250bd6f90e914ab71ce85c7d9e8793554b96 (diff)
downloadhdf5-a83b6d665123ed36b72607b1e17aa7cb96696eb9.zip
hdf5-a83b6d665123ed36b72607b1e17aa7cb96696eb9.tar.gz
hdf5-a83b6d665123ed36b72607b1e17aa7cb96696eb9.tar.bz2
[svn-r26311] Merged r26266-7 from features/autotools_rework
Updates the bin/chkmanifest script so that it parses the output of svn commands instead of hacking at the .svn/entries file. This will make the script more future-proof and allows it to work with current Subversion repositories. Tested on: jam (bin/chkmanifest only)
Diffstat (limited to 'bin/chkmanifest')
-rwxr-xr-xbin/chkmanifest136
1 files changed, 46 insertions, 90 deletions
diff --git a/bin/chkmanifest b/bin/chkmanifest
index 70c38a9..6188eab 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,50 @@ 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
+ # Newly added files are not listed by svn ls, which
+ # we check below..
+ # The line listing them starts with 'A'.
+ letter="$(echo $file | head -c 1)"
+ if [ "$letter" = "A" ]; then
+ # Convert 'A ' to './' so it matches
+ # the manifest file name.
+ 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 ls, which gets a list of all files that are
+# checked in.
+svn_ls="$(svn ls -R)"
+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
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