(no commit message)
[ikiwiki.git] / docs / developer / PatchMaking.mdwn
1 # Patches 
2
3
4
5
6 We recently switched to git as Version Control System (VCS) so the following information is out-of-date.  Look [here](TypicalGitUsage) for further instructions how to get the repository and how to submit patches! 
7 --------
8
9
10 [[!toc ]]
11
12 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.
13
14 Making patches when you only have a copy of the source
15
16
17
18 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. :-)
19
20
21
22    1. Copy your version of cat into /usr/src/bin/cat.local
23
24    2. Run cvsup to resync your source tree back to a clean state.
25
26    3. Then run diff -ru cat cat.local and submit a patch to the mailing list (with a short description on what you did) 
27
28      
29
30     root# cp -r /usr/src/bin/cat /usr/src/bin/cat.local
31
32     root# cd /usr/src/bin
33
34     root# diff -ru cat cat.local > usr.bin.cat.patch
35
36
37
38  
39
40 ## Making patches when you have a copy of the repository 
41
42   1. Get a copy of the CVS repository
43
44   2. Check out a copy of the source from that CVS repository
45
46   3. Edit the code
47
48   4. Generate a patch with cvs diff
49
50
51
52 ## cvsps 
53
54
55
56 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.
57
58 Get a copy of both the FreeBSD and DragonFly cvs repositories.
59
60
61
62 ## cvsup 
63
64 I use cvsup and the following two files to obtain a partial copy of the two projects (DragonFly and FreeBSD).
65
66      
67
68     % cat dfly-supfile
69
70     
71 *default host=cvsup.dragonflybsd.org
72
73     *default base=/usr/home/okumoto/Work/make
74
75     *default prefix=/usr/home/okumoto/Work/make/dfly-cvs
76
77     *default release=cvs
78
79     *default delete use-rel-suffix
80
81     *default compress
82
83
84
85
86      
87
88     % cat fbsd-supfile
89
90     
91 *default host=cvsup14.us.FreeBSD.org
92
93     *default host=cvsup4.us.FreeBSD.org
94
95     *default base=/usr/home/okumoto/Work/make
96
97     *default prefix=/usr/home/okumoto/Work/make/fbsd-cvs
98
99     *default release=cvs
100
101     *default delete use-rel-suffix
102
103
104
105
106 Execute the following commands
107
108      
109
110     % cd /usr/home/okumoto/Work/make
111
112     
113
114     % mkdir fbsd-cvs
115
116     % cvsup fbsd-supfile -c fbsd-sup -i src/usr.bin/make
117
118     
119
120     % mkdir dfly-cvs
121
122     % cvsup dfly-supfile -c dfly-sup -i src/usr.bin/make
123
124
125
126 This should result in two small cvs repositories that only contain source for usr.bin/make, and which will update quickly.
127
128 Create working directories by checking out the utility you want to work on.
129
130
131
132 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.
133
134
135
136      
137
138     % mkdir -p fbsd-cvs/src/usr.bin/CVSROOT            
139
140     % mkdir -p fbsd-src
141
142     % (cd fbsd-src; cvs -d ${PWD}/fbsd-cvs/src/usr.bin co make)   
143
144     
145
146     % mkdir -p dfly-cvs/src/usr.bin/CVSROOT 
147
148     % mkdir -p dfly-src
149
150     % (cd dfly-src; cvs -d ${PWD}/dfly-cvs/src/usr.bin co make)   
151
152
153
154 This should result in a check out of the most current version of make from each project.
155
156 Use cvsps to extract a change log from the cvs working directory
157
158
159
160 Using cvsps you can extract a patch history.
161
162      
163
164     % cd dfly-src/make
165
166     % cvsps | less
167
168
169
170
171
172 ## Patch History Example 
173
174 From change log history extract a patch.
175
176      
177
178     % cvsps -s 49-50 > patch-XXX
179
180
181
182 Submit patch :-)
183