Re: How can I patch multiple files with 1 patch file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



diff -Naur dir1 dir2 > patchfile
patch dir2 < patchfile

or, in one script which will create a patch, apply the patch, and diff the
patch to ensure it was ok.

# This is a script to generate a patch of linux kernel
# directory.  It also will test the patch by recreating the directory
# and running diff on it.

# You need to specify the dir base name.
# the script assumes two dirs like: dir.old and dir.new.
# the dir.old and the patch file should duplicate dir.new.

echo creating the patch file $1.patch
[root@mcdeb Linux405-Archive]# cat doit.sh
# This is a script to generate a patch of linux kernel
# directory.  It also will test the patch by recreating the directory
# and running diff on it.

# You need to specify the dir base name.
# the script assumes two dirs like: dir.old and dir.new.
# the dir.old and the patch file should duplicate dir.new.

echo creating the patch file $1.patch

diff -Nur $1.old $1.new > $1.patch;
cp -a $1.old test/$1;
cp $1.patch test;
cd test/$1;
echo "Now we will test patch the file. If it pops up some messages,"
echo "just hit enter and take the defaults."
echo "eg. when it says assume -R  you should answer no."
echo "When it says apply patch anyway, you should answer yes."
patch -p1 < ../$1.patch ;
echo "Now testing how well the applied patch worked."
echo "there should be no differences or only .orig files"
cd ../..
diff -r $1.new test/$1;

Catalin Marinas <c_marinas@yahoo.com>@nl.linux.org on 11/29/2001 10:25:32
AM

Sent by:  kernelnewbies-bounce@nl.linux.org


To:   Jonathan Khoo <jonath-k@is.aist-nara.ac.jp>
cc:   kernelnewbies@nl.linux.org
Subject:  Re: How can I patch multiple files with 1 patch file?



On Thu, 29 Nov 2001, Jonathan Khoo wrote:

> Is this possible?
> I modified quite a few files in the kernel and I want to create a single
> patch file that can be used to patch other kernels.
>
> Is the following the correct way to create a patch file?
> 1. diff -u a.txt b.txt > patch.txt
> 2. patch -p1 a.txt < patch.txt

It is, but only for patching a single file.

>From "man diff":

       diff [options] from-file to-file

       [...]

       If  both  from-file and to-file are directories, diff com­
       pares corresponding files in both directories,  in  alpha­
       betical order; this comparison is not recursive unless the
       -r or --recursive option is given.   diff  never  compares
       the  actual  contents of a directory as if it were a file.

You should also read /usr/src/linux/Documentation/SubmittingPatches

--
Catalin


_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux