diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2007-01-22 21:36:33 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2007-01-22 21:36:33 (GMT) |
commit | 6efb39a88e9a882d183b58c90dc0bab1bd3fbd88 (patch) | |
tree | fa05f94f9d575b9816d2b426ea70a620f07a5aa6 /bin/chkmanifest | |
parent | dc41c7371153fc4cf7bba6cf09868a03f19e445a (diff) | |
download | hdf5-6efb39a88e9a882d183b58c90dc0bab1bd3fbd88.zip hdf5-6efb39a88e9a882d183b58c90dc0bab1bd3fbd88.tar.gz hdf5-6efb39a88e9a882d183b58c90dc0bab1bd3fbd88.tar.bz2 |
[svn-r13168] Purpose:
bug fix.
Problem:
1. The last fix using "svn --version" did not work since the source code
is shared between different machines which have different svn versions.
Changed the code to inspect the .svn/entries content to guess what version
of svn uses. From that to decide which GETSVNENTRIES to use.
2. GETSVNENTRIES_14 had two errors:
2.a., % as 1,$ is actually not recognized by ed. Changed that to "1,$s/..."
but that got mixed up with $ being a shell meta-character. Changed to use
g command instead. (Could have use \ to escape $ but g is cleaner.)
2.b., Some directories have no files but sub-directories. The ed script
might end up with an empty file in some steps and ed does not like to
run g command with an empty file. Fixed it by adding a dummy blank line.
Platforms tested:
Osage and copper.
Diffstat (limited to 'bin/chkmanifest')
-rwxr-xr-x | bin/chkmanifest | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/bin/chkmanifest b/bin/chkmanifest index 81a911f..bcb9dc4 100755 --- a/bin/chkmanifest +++ b/bin/chkmanifest @@ -62,6 +62,9 @@ GETSVNENTRIES_14 () # 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. { SVNENTRY=/tmp/H5_SVNENTRY.$$ cp $1/entries $SVNENTRY @@ -69,7 +72,10 @@ chmod u+w $SVNENTRY # entries file is not writable. ed - $SVNENTRY <<EOF g/^file$/-s/^/%WANTED%/ v/%WANTED%/d -%s/%WANTED%// +a + +. +g/^%WANTED%/s/// w q EOF @@ -111,21 +117,22 @@ for file in `cat $MANIFEST`; do fi done -# According to svn version, figure out the right version of GETSVNENTRIES -# to use. -svnversion=`svn --version --quiet` - -case "$svnversion" in -1.4.*) - getsvnentries=GETSVNENTRIES_14 - ;; -1.3.*) - getsvnentries=GETSVNENTRIES_13 - ;; -*) #default to 1.3 +# 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 - ;; -esac +elif grep '^file$' $svn_entry_file > /dev/null 2>&1; then + getsvnentries=GETSVNENTRIES_14 +else + echo "Unknow svn entries format. Aborted" + exit 1 +fi for svn in `find . -type d -name .svn -print`; do path=`echo $svn |sed 's/\/.svn//'` |