From 9fd5ef959459db4108756c8ee89856584cfd08d8 Mon Sep 17 00:00:00 2001 From: mccallum Date: Mon, 2 Sep 1996 16:32:39 +0000 Subject: [PATCH] New file. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1684 72102866-910b-0410-8b05-ffd578937521 --- make-snap-diff | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 make-snap-diff diff --git a/make-snap-diff b/make-snap-diff new file mode 100755 index 000000000..de8c56085 --- /dev/null +++ b/make-snap-diff @@ -0,0 +1,63 @@ +#!/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=gnustep-dev@prep.ai.mit.edu + +# 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