Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2000 11:40:22 +0300
From:      Peter Pentchev <roam@orbitel.bg>
To:        freebsd-questions@freebsd.org
Cc:        Visigoth <visigoth@telemere.net>, Daniel Hauer <dh@enter.net>, freebsd-security@freebsd.org
Subject:   Re: How to apply patches?
Message-ID:  <20000825114022.B72778@ringwraith.office1.bg>
In-Reply-To: <6228.967191671@axl.fw.uunet.co.za>; from sheldonh@uunet.co.za on Fri, Aug 25, 2000 at 10:21:11AM %2B0200
References:  <Pine.BSF.4.21.0008241203430.6995-100000@mail.telemere.net> <6228.967191671@axl.fw.uunet.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 25, 2000 at 10:21:11AM +0200, Sheldon Hearn wrote:
> 
> [ Please exclude freebsd-security in follow-ups. ]
> 
> On Thu, 24 Aug 2000 12:07:59 EST, Visigoth wrote:
> 
> > 	You may want to look into customizing your /etc/cvsupfile a little
> > bit to get what you want.  CVSup is capable of only updateing certain
> > portions of your source ex.
> 
> Actually, if you want to protect local modications to the tree while
> still receiving updates to modified files, you really should start
> thinking about checking out your tree with CVS.
> 
> Ciao,
> Sheldon.

I've been doing just that for some time - cvsup'ing stock FreeBSD trees,
then applying local patches for my own mods.  The attached shell script
helps me both apply and reverse patches (reversing before the next cvsup).

It expects patches to be stored in 'collections' under a common subdir
(hardcoded, /usr/home/roam/bsd-patches).  Each 'collection' is a subdir
containing one or more *.patch files - all other files are ignored.

In my case, I create the patch diffs with a current directory of /usr,
so I can track both src/ and ports/.  The usual MO is as follows:

cd /usr

# The format is bsdpatch collection [patch-options]
# src/ patches live in /usr/home/roam/bsd-patches/src/*.patch
# ports/ patches -  in /usr/home/roam/bsd-patches/ports/*.patch

# Reverse first..
~roam/bsd-patches/bsdpatch -R		# no collection name, using 'src'
~roam/bsd-patches/bsdpatch ports -R	# explicitly specify ports patches

# Update the trees
cvsup ~/cvsup/stable-supfile
cvsup ~/cvsup/ports-supfile

# Apply the patches to the new sources
~roam/bsd-patches/bsdpatch
~roam/bsd-patches/bsdpatch ports

..and then I check for conflicts, and reroll my diffs as needed.

Actually the cvsup and bsdpatch invocations are more along the lines of:

cvsup -L 2 ~/cvsup/stable-supfile 2>&1 | tee ~/cvsup/c.stable.out
# examine c.stable.out to see what changed..

bsdpatch 2>&1 | tee bsdp.log
# examine bsdp.log to find conflicts
fgrep -i -e fail -e rej bsdp.log

Hope this helps :)

G'luck,
Peter

-- 
This sentence contains exactly threee erors.

#!/bin/sh
# $Id: bsdpatch,v 1.3 2000/08/25 08:34:36 roam Exp $

if [ -z "$1" ]; then
  echo Collection not specified, using src
  COLL=src
else
  COLL=$1
fi

shift

BSDPATCH=/usr/home/roam/bsd-patches
if [ ! -d "$BSDPATCH/$COLL" ]; then
  echo Not a directory: $BSDPATCH/$COLL
  exit 1
fi

BSDPATCH=$BSDPATCH/$COLL

for i in $BSDPATCH/*.patch; do
  patch -p0 $* < $i;
done


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000825114022.B72778>