libs-base/make-diff
mccallum 1cf7ea46af Make diffs of the Makefile-generated snapshot files, not the CVS repository.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1547 72102866-910b-0410-8b05-ffd578937521
1996-05-16 02:11:23 +00:00

63 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
# The directory in which to find the last snapshot; must be absolute path
dir=/home/mccallum/gnu/releases
# The email addresses of people to receive mail about the new diff
diff_recipients=drepper
# The name of this module
module=gstep-base
# A regular expression for the six-digit date string "yymmdd"
yrptn='[0-9][0-9][0-9][0-9][0-9][0-9]'
# The pattern for the file containing the diff
ptn="${module}-${yrptn}"
dptn="${ptn}-${yrptn}.diff"
# Get the current date
date=`date +%y%m%d`
# Find date of the last snapshot
lastsnap=`cd $dir; ls $ptn.tar.gz 2>/dev/null |
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
sort -nr | head -1`
# Find the date of the second-to-last snapshot
secondlastsnap=`cd $dir; ls $ptn.tar.gz 2>/dev/null |
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
sort -nr | head -2 | tail -1`
# Find the date of the last diff
lastdiff=`cd $dir; ls $dptn $dptn.gz 2>/dev/null |
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
sort -nr | head -1`
echo Making diff between $secondlastsnap and $lastsnap
# The name of the diff file
diff="${module}-${secondlastsnap}-${lastsnap}.diff"
if [ -f $dir/$diff ]; then
echo $dir/$diff already exists! Exiting.
exit -1
fi
echo Making $diff
# Untar the old snapshot
(cd /tmp ; tar -zvxf $dir/${module}-${secondlastsnap}.tar.gz)
# Untar the new snapshot
(cd /tmp ; tar -zvxf $dir/${module}-${lastsnap}.tar.gz)
# Make the diff
echo Diffing...
rm -f /tmp/$diff
(cd /tmp; diff -u -r ${module}-${secondlastsnap} ${module}-${lastsnap} > $diff)
# Remove the snapshot dirs
rm -rf /tmp/${module}-${secondlastsnap} /tmp/${module}-${lastsnap}
if [ -s /tmp/$diff ]; then
# Mail a message saying the new diff is available. (Commented out for now)
# mail -s $diff < $diff $diff_recipients
gzip -9 /tmp/$diff && mv -f /tmp/$diff.gz $dir
else
rm -f /tmp/$diff
fi