[lkml]   [1996]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: patch(1)ing (was Re: Problem with 2.0.20)
On Sun, 15 Sep 1996, Adam D. Bradley wrote:

> BTW, are we both missing something here? Is there a command-line opt (or
> another version) of patch that creates new files in the right places?

What I always do is just go into the directory I'm patching and use `patch
-p1`. That way it doesn't care at all what the directory prefix is for
either the original or patched trees. Works all the time (unless whoever
made the patch used some weird method to create the patch...)

For instance, my script to extract a guaranteed clean version of the
latest kernel tree from my archive of linux-2.0.tar.gz and patch-2.0.*.gz:

echo -n Cleaning...
rm -rf `/bin/ls -l linux | awk '{print $11}'` linux
echo -n Extracting...
tar -xzf linux-2.0.tar.gz
cd linux
echo -n Patching
for n in ../patch-2.0.?.gz ../patch-2.0.??.gz;do
LATEST=`echo $n | sed 's/\.\.\/patch-\(2\.0\.[0-9]*\)\.gz/\1/'`
zcat $n | patch -p1 -s
echo -n .
echo -n Wiping .orig files...
find . -name '*.orig' -exec rm {} \;
cd ..
echo Latest version is $LATEST
mv linux linux-$LATEST
ln -s linux-$LATEST linux

Note that this does no error checking. This is because all the linux
patches are perfect (know a guy who patched all they way from 1.3.1[0-9]
to somewhere in pre-2.0 without a problem) ;-)


__ Erik Walthinsen - Programmer, webmaster, 3D artist, etc. / /\
/ \ / / \
| | M E G A Work: (503)578-5314 / / /\ \
_\ /_ Home: (503)281-4281 / / /\ \ \
/ /_/__\ \ \
SSA: (for now) /________\ \ \

 \ /
  Last update: 2005-03-22 13:38    [W:0.065 / U:2.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site