DragonFly BSD

PatchMaking

Patches

We recently switched to git as Version Control System (VCS) so the following information is out-of-date. Look here for further instructions how to get the repository and how to submit patches!

Submitting patches (or diffs) is the usual way of contributing code to DragonFly BSD. All submissions to the project should go to the submit mailing list (http://www.dragonflybsd.org/main/forums.cgi). When you submit a patch please include a description of what has been changed.

Making patches when you only have a copy of the source

Let's say you just installed DragonFly BSD and you notice a problem in /bin/cat. Since you have /usr/src sync'ed with the main CVS repository. You go into /usr/src/bin/cat and make your modifications. But now what? Well here is what you can do. But next time try the procdure in the next section. :-)

  1. Copy your version of cat into /usr/src/bin/cat.local

  2. Run cvsup to resync your source tree back to a clean state.

  3. Then run diff -ru cat cat.local and submit a patch to the mailing list (with a short description on what you did)

    root# cp -r /usr/src/bin/cat /usr/src/bin/cat.local

    root# cd /usr/src/bin

    root# diff -ru cat cat.local > usr.bin.cat.patch

Making patches when you have a copy of the repository

  1. Get a copy of the CVS repository

  2. Check out a copy of the source from that CVS repository

  3. Edit the code

  4. Generate a patch with cvs diff

cvsps

I use cvsps 1.3.3 to monitor and extract patchsets from the FreeBSD CVS repository. This utility can be found in /usr/pkgsrc/devel/cvsps.

Get a copy of both the FreeBSD and DragonFly cvs repositories.

cvsup

I use cvsup and the following two files to obtain a partial copy of the two projects (DragonFly and FreeBSD).

% cat dfly-supfile

*default host=cvsup.dragonflybsd.org

*default base=/usr/home/okumoto/Work/make

*default prefix=/usr/home/okumoto/Work/make/dfly-cvs

*default release=cvs

*default delete use-rel-suffix

*default compress






% cat fbsd-supfile

*default host=cvsup14.us.FreeBSD.org

*default host=cvsup4.us.FreeBSD.org

*default base=/usr/home/okumoto/Work/make

*default prefix=/usr/home/okumoto/Work/make/fbsd-cvs

*default release=cvs

*default delete use-rel-suffix

Execute the following commands

% cd /usr/home/okumoto/Work/make



% mkdir fbsd-cvs

% cvsup fbsd-supfile -c fbsd-sup -i src/usr.bin/make



% mkdir dfly-cvs

% cvsup dfly-supfile -c dfly-sup -i src/usr.bin/make

This should result in two small cvs repositories that only contain source for usr.bin/make, and which will update quickly.

Create working directories by checking out the utility you want to work on.

The cvs program wants to have a CVSROOT directory so we just create an empty directory. You can use the -R option to cvs, but that prevents you from making your own tags, or checking in stuff into your local repository copy.

% mkdir -p fbsd-cvs/src/usr.bin/CVSROOT            

% mkdir -p fbsd-src

% (cd fbsd-src; cvs -d ${PWD}/fbsd-cvs/src/usr.bin co make)   



% mkdir -p dfly-cvs/src/usr.bin/CVSROOT 

% mkdir -p dfly-src

% (cd dfly-src; cvs -d ${PWD}/dfly-cvs/src/usr.bin co make)   

This should result in a check out of the most current version of make from each project.

Use cvsps to extract a change log from the cvs working directory

Using cvsps you can extract a patch history.

% cd dfly-src/make

% cvsps | less

Patch History Example

From change log history extract a patch.

% cvsps -s 49-50 > patch-XXX

Submit patch :-)