From xemacs-m  Fri Aug  8 18:21:44 1997
Received: from news.smart.net (jmiller@max1p86.smart.net [206.97.127.86])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id SAA10340
	for <xemacs-beta@xemacs.org>; Fri, 8 Aug 1997 18:21:38 -0500 (CDT)
Received: (from jmiller@localhost)
          by news.smart.net (8.8.4/8.8.4)
	  id TAA10633; Fri, 8 Aug 1997 19:23:33 -0400
Date: Fri, 8 Aug 1997 19:23:33 -0400
Message-Id: <199708082323.TAA10633@news.smart.net>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="WEEQm/EDGu"
Content-Transfer-Encoding: 7bit
From: Jeff Miller <jmiller@smart.net>
To: xemacs-beta@xemacs.org
Subject: patching script
X-Mailer: VM 6.33 under 20.3 "Berlin" XEmacs  Lucid (beta15)
Reply-to: jmiller@smart.net
X-Face: &vGrMZ?Q&W5~yiCR_#hat=$tgJrK`J=2$se?0Nu9I3G|I<2-\:82zx>kz=l8(yw)G1i&0"D
 <nv_e$^;,ftG6@Hn"did"G5i=X_-Z3Y


--WEEQm/EDGu
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Does this look useful?

I usually just download the patches to upgrade from beta to beta.  It's
not too bad applying one patch, but I sometimes I get things pretty
mangled.  So I delete my current xemacs dir and untar the last tar file I
downloaded and apply X number of patches to get to the current release.
Often a tedious process. 

Since this is basically the same process I go through with the linux
kernel source, I wondered if the patch-kernel script that comes with that
could be hacked to work with XEmacs.  Well, it can! :-)

So, give this a whirl. 

usage is:

patch-xemacs [sourcedir] [patchdir]
  
caveats: patches & extras files are expected to be gzipped.  
         I don't have an extensive collection of patches to test with, but 
         it seems to work as exepected. 



--WEEQm/EDGu
Content-Type: text/plain
Content-Disposition: inline;
	filename="patch-xemacs"
Content-Transfer-Encoding: 7bit

#! /bin/sh
# Script to apply xemacs patches.
#   usage: patch-kernel [ sourcedir [ patchdir ] ]
#     The source directory defaults to the current directory, and the patch
#     directory defaults to the current directory.
#
# It determines the current xemacs version from version.sh
# It then looks for patches for the next sublevel in the patch directory.
# This is applied using "patch -p1 -s" from within the xemacs directory.
# A check is then made for "*.rej" files to see if the patch was
# successful.  If it is, then all of the "*.orig" files are removed.
#
#       Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.
# Modified for use with XEmacs - Jeff Miller <jmiller@smart.net> 8 August 1997.
# This was originally patch-kernel, which comes with the linux kernel source.

# Set directories from arguments, or use defaults.
sourcedir=${1-.}
patchdir=${2-..}

# set current VERSION, PATCHLEVEL, SUBLEVEL
source  $sourcedir/version.sh

if [    -z "$emacs_major_version" \
     -o -z "$emacs_minor_version" \
     -o -z "$emacs_beta_version" ]
then
    echo "unable to determine current XEmacs version" >&2
    exit 1
fi

version=$emacs_major_version.$emacs_minor_version-b$emacs_beta_version
echo "Current XEmacs version is $version"

while :
do
    version=$emacs_major_version.$emacs_minor_version-b$emacs_beta_version    
    emacs_beta_version=`expr $emacs_beta_version + 1`
    jump=xemacs-$version-$emacs_major_version.$emacs_minor_version-b$emacs_beta_version
    patch=$jump.patch.gz 
    extras=$jump.extras.tar.gz  

    if [ ! -r $patchdir/$patch ]
    then
        break
    fi

    echo -n "Applying $patch... "
    if gunzip -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedir
    then
	echo "done."
    else
        echo "failed.  Clean up yourself."
        break
    fi
    if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
    then
        echo "Aborting.  Reject files found."
        break
    fi
   
    # Remove backup files
    find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;

    if [ ! -r $patchdir/$extras ]
    then
      break
    fi
    echo -n "Adding $extras... "
    if gunzip -dc $patchdir/$extras | tar -x -C $sourcedir
    then
	echo "done."
    else
        echo "failed.  Clean up yourself."
        break
    fi
done

--WEEQm/EDGu--

