[svn-r11861] Purpose:

Bug fix.

Description:
release created temporary files in .. directory.  If the -d directory
is the same as the parent directory, it would fail when it tried to
copy the temporary files to the destination directory.

Solution:
Changed release to create a temporary directory and create all temporary
files in that temporary directory.

Platforms tested:
Handtested in heping.
This commit is contained in:
Albert Cheng 2006-01-04 12:38:30 -05:00
parent e8804cada8
commit a88b4d5acd

View File

@ -108,6 +108,7 @@ verbose=yes
check=yes
today=`date +%Y%m%d`
pmode='no'
tmpdir="../#release_tmp.$$" # tmp work directory
# Restore previous Version information
RESTORE_VERSION()
@ -155,6 +156,15 @@ if [ "X$methods" = "X" ]; then
methods="tar md5"
fi
# Create the temporay work directory.
if mkdir $tmpdir; then
echo "temporary work directory for release. "\
"Can be deleted after release completes." > $tmpdir/READEME
else
echo "Failed to mkdir tmpdir($tmpdir)"
exit 1
fi
# setup restoration in case of abort.
trap RESTORE_VERSION 0
@ -176,7 +186,6 @@ if [ ! -d $DEST ]; then
exit 1
fi
# Check the validity of the MANIFEST file.
bin/chkmanifest || fail=yes
if [ "X$fail" = "Xyes" ]; then
@ -188,13 +197,12 @@ if [ "X$fail" = "Xyes" ]; then
fi
# Create a manifest that contains only files for distribution.
MANIFEST=/tmp/H5_MANIFEST.$$
MANIFEST=$tmpdir/H5_MANIFEST
grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
# Prepare the source tree for a release.
test -h ../$HDF5_VERS && rm ../$HDF5_VERS
ln -s `pwd` ../$HDF5_VERS || exit 1
mv Makefile ../Makefile.x 2>/dev/null #might fail
ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1
mv Makefile $tmpdir/Makefile.x 2>/dev/null #might fail
cp -p Makefile.dist Makefile
# Update README.txt and release_docs/RELEASE.txt with release information.
@ -209,7 +217,7 @@ done
# Create the tar file
test "$verbose" && echo " Running tar..." 1>&2
( \
cd ..; \
cd $tmpdir; \
tar cf $HDF5_VERS.tar $HDF5_VERS/Makefile \
`sed 's/^\.\//hdf5-'$VERS'\//' $MANIFEST` || exit 1 \
)
@ -218,32 +226,35 @@ test "$verbose" && echo " Running tar..." 1>&2
for comp in $methods; do
case $comp in
tar)
cp -p ../$HDF5_VERS.tar $DEST/$HDF5_VERS.tar;;
cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar
;;
compress)
test "$verbose" && echo " Running compress..." 1>&2
compress -c <../$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.Z;;
compress -c <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.Z
;;
gzip)
test "$verbose" && echo " Running gzip..." 1>&2
gzip -9 <../$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz;;
gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz
;;
bzip2)
test "$verbose" && echo " Running bzip2..." 1>&2
bzip2 -9 <../$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2;;
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
;;
md5)
test "$verbose" && echo " Creating checksum..." 1>&2
( cd .. && md5sum $HDF5_VERS.tar >$HDF5_VERS.tar.md5 )
cp -p ../$HDF5_VERS.tar.md5 $DEST/$HDF5_VERS.tar.md5;;
(cd $tmpdir; md5sum $HDF5_VERS.tar ) > $DEST/$HDF5_VERS.tar.md5
;;
esac
done
# Copy the RELEASE.txt to the release area.
cp release_docs/RELEASE.txt $DEST/$HDF5_VERS-RELEASE.txt
# Restore previous Makefile if existed.
test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile
# Remove temporary things
test -f ../Makefile.x && mv ../Makefile.x Makefile
rm -f $MANIFEST
rm -f ../$HDF5_VERS
rm -f ../$HDF5_VERS.tar
rm -f ../$HDF5_VERS.tar.md5
rm -rf $tmpdir
# Restore OLD version information, then no need for trap.
if [ X$pmode = Xyes ]; then