lintpkgsrc comes from pkgtools/lintpkgsrc
[ikiwiki.git] / docs / howtos / HowToBuildingPatches.mdwn
1
2 [[!toc  levels=3]]
3
4 # Patches 
5
6 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 lists"](http://www.dragonflybsd.org/main/forums.cgi) (http://www.dragonflybsd.org/main/forums.cgi). When you submit a patch please include a description of what has been changed.
7 Making patches when you only have a copy of the source:
8
9 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. :-)
10
11    1. Copy your version of cat into /usr/src/bin/cat.local
12    2. Run cvsup to resync your source tree back to a clean state.
13    3. Then run diff -ru cat cat.local and submit a patch to the mailing list (with a short description on what you did) 
14
15     
16     root# cp -r /usr/src/bin/cat /usr/src/bin/cat.local
17     root# cd /usr/src/bin
18     root# diff -ru cat cat.local > usr.bin.cat.patch
19
20
21 # Making patches when you have a copy of the repository 
22
23 Step 1: Get a copy of the CVS repository
24 Step 2: Check out a copy of the source from that CVS repository
25 Step 3: Edit the code
26 Step 4: Generate a patch with cvs diff
27
28
29 # Using cvsps 
30
31 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.
32
33  **Get a copy of both the FreeBSD and DragonFly cvs repositories.** 
34
35 I use cvsup and the following two files to obtain a partial copy of the two projects (DragonFly and FreeBSD).
36
37     
38     % cat dfly-supfile
39     
40     
41 *default host=cvsup.dragonflybsd.org
42     *default base=/usr/home/okumoto/Work/make  
43     *default prefix=/usr/home/okumoto/Work/make/dfly-cvs
44     *default release=cvs
45     *default delete use-rel-suffix
46     *default compress
47
48     
49     cvs-src
50     
51     % cat fbsd-supfile
52     
53     #*default host=cvsup14.us.FreeBSD.org
54     
55 *default host=cvsup4.us.FreeBSD.org
56     *default base=/usr/home/okumoto/Work/make
57     *default prefix=/usr/home/okumoto/Work/make/fbsd-cvs
58     *default release=cvs
59     *default delete use-rel-suffix
60
61     
62     src-usrbin
63
64
65 Execute the following commands:
66
67     
68     % cd /usr/home/okumoto/Work/make
69     
70     % mkdir fbsd-cvs
71     % cvsup fbsd-supfile -c fbsd-sup -i src/usr.bin/make
72     
73     % mkdir dfly-cvs
74     % cvsup dfly-supfile -c dfly-sup -i src/usr.bin/make
75
76
77 This should result in two small cvs repositories that only contain source for usr.bin/make, and which will update quickly.
78
79 Create working directories by checking out the utility you want to work on.
80
81 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.
82
83     
84     % mkdir -p fbsd-cvs/src/usr.bin/CVSROOT            
85     % mkdir -p fbsd-src
86     % (cd fbsd-src; cvs -d ${PWD}/fbsd-cvs/src/usr.bin co make)   
87     
88     % mkdir -p dfly-cvs/src/usr.bin/CVSROOT 
89     % mkdir -p dfly-src
90     % (cd dfly-src; cvs -d ${PWD}/dfly-cvs/src/usr.bin co make)   
91
92
93 This should result in a check out of the most current version of make from each project.
94 Use cvsps to extract a change log from the cvs working directory
95
96 Using cvsps you can extract a patch history.
97
98     
99     % cd dfly-src/make
100     % cvsps | less
101
102
103
104 From change log history extract a patch.
105
106     
107     % cvsps -s 49-50 > patch-XXX
108
109
110 ["Patch Set Example"](howtos/PatchSetExample)
111  
112 Submit patch :-)