How to make a patch (in response to Lars Volker)

Andreas Ericsson ae at op5.se
Wed Apr 28 13:00:56 CEST 2004


To create a patch;
Get the latest source-code from the CVS (instruction on sourceforge. 
Click 'cvs access' or something like that).
Delete all the CVS directories and .cvsignore files from it
--
cp -a nagios nagios.orig
rm -rf `find -type d -name CVS`
rm -rf `find -type f -name .cvsignore`
--

Edit the files in nagios, so that you have an untouched copy in 
nagios.orig, which is identical to the one you're working on.
When you're done making changes it's time to create the patch.
cd to the 'nagios' directory (the root of the sources where you've made 
modifications), and run the following command;
diff -urN ../nagios.orig/ . > ../nagios.diff
-urN means, basically
Output in unified diff format (for use with patch), scan recursively for 
changes, and treat new files in new directory as empty files in old 
directory (they will be created when applying the patch). Make sure you 
specify YOUR directory as the second one, or patch will try to look for 
../nagios.orig when being fed the .diff-file.

If the modified source doesn't build OK, you'll have to recreate it from 
scratch and make sure it does.

So, in summary;
cd ~
cvs -d:pserver:anonymous at cvs.nagios.sourceforge.net:/cvsroot/nagios \
	login
cvs -z3 -d:pserver:anonymous at cvs.nagios.sourceforge.net:/cvsroot/nagios\
	co nagios
rm -rf `find nagios -type d -name CVS`
rm -rf `find nagios -type f -name .cvsignore`
cp -a nagios nagios.orig
cd nagios
<make changes>
cd ~/nagios
diff -urN ../nagios.orig . > ../nagios.diff
<send ~/nagios.diff to nagios-devel at lists.sourceforge.net, with 
explanations of what it does, and why that's good>

CVS can do some of this for you, but can sometimes include somewhat 
unpredictable results. If you're feeling dary, you can do the checkout 
steps above, make your changes and then do cvs diff -urN from the 
nagios-directory. Make sure you do 'cvs update' first in that case, or 
your fresh patch might break some new code that has just been committed 
to the repository.


Lars Volker wrote:
> Hi,
> 
> wouldn't it be nice if nagios respectively the status.cgi would be able 
> to recognize, if two host- or servicenames are domain names, which means 
> dot-separated (like blabla.foo.bar.org.uk) and then sort the list in an 
> domain-aware kind of way?
> 
> Example:
> current behaviour:
> a.x.org
> a.y.org
> b.x.org
> b.y.org
> 
> desired behaviour
> a.x.org
> b.x.org
> a.y.org
> b.y.org
> 
> I've written a few lines of code, implementing that feature, but i 
> edited the source directly and have never worked with patching stuff. So 
> if someone would like to explain, i'll provide a patch. Anyways the code 
> is just about 9 lines long, simple hack only, but working. There also 
> should be some kind of switch to toggle the behaviour.
> 
> Thanks
> Lars
> 

-- 
Mvh
Andreas Ericsson
OP5 AB
+46 (0)733 709032
andreas.ericsson at op5.se


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click




More information about the Developers mailing list