blob: b33fc148412c928a58c202ea0ac2efd45849b073 [file] [log] [blame]
John R. Sheetsd9e064f2000-12-13 21:52:37 +00001 <chapter id="patches">
2 <title>Submitting Patches</title>
3
John R. Sheetsd9e064f2000-12-13 21:52:37 +00004 <sect1 id="patch-format">
5 <title>Patch Format</title>
6
7 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +00008 Patches are submitted via email to the Wine patches mailing list,
9 <email>wine-patches@winehq.org</email>. Your patch should include:
John R. Sheetsd9e064f2000-12-13 21:52:37 +000010 </para>
11
12 <itemizedlist>
13 <listitem>
14 <para>
Tony Lambregtsf7128012003-03-07 20:34:01 +000015 A meaningful subject (very short description of patch)
Tony Lambregts18a79c82002-12-19 23:43:46 +000016 </para>
17 </listitem>
18 <listitem>
19 <para>
20 A long (paragraph) description of what was wrong and what is now
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000021 better. (recommended)
John R. Sheetsd9e064f2000-12-13 21:52:37 +000022 </para>
23 </listitem>
24 <listitem>
25 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000026 A change log entry (short description of what was changed).
John R. Sheetsd9e064f2000-12-13 21:52:37 +000027 </para>
28 </listitem>
29 <listitem>
30 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000031 The patch in <command>diff -u</command> format
John R. Sheetsd9e064f2000-12-13 21:52:37 +000032 </para>
33 </listitem>
34 </itemizedlist>
35
36 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000037
38 </para>
39
40 <para>
John R. Sheetsd9e064f2000-12-13 21:52:37 +000041 <command>cvs diff -u</command> works great for the common case
42 where a file is edited. However, if you add or remove a file
43 <command>cvs diff</command> will not report that correctly so
44 make sure you explicitly take care of this rare case.
45 </para>
46 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000047 For additions simply include them by appending the
Tony Lambregtsf7128012003-03-07 20:34:01 +000048 <command>diff -u /dev/null /my/new/file</command> output of them
Andreas Mohre15badb2001-10-21 15:18:15 +000049 to any <command>cvs diff -u</command> output you may have.
Francois Gouget848d50d2002-09-17 00:07:03 +000050 Alternatively, use <command>diff -Nu olddir/ newdir/</command>
Andreas Mohre15badb2001-10-21 15:18:15 +000051 in case of multiple new files to add.
John R. Sheetsd9e064f2000-12-13 21:52:37 +000052 </para>
53 <para>
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +000054 For removals, clearly list the files in the description of the patch.
John R. Sheetsd9e064f2000-12-13 21:52:37 +000055 </para>
Tony Lambregts18a79c82002-12-19 23:43:46 +000056 <para>
57 Since wine is constantly changing due to development it is strongly
Tom Wicklinec28575e2003-07-09 19:50:14 +000058 recommended that you use cvs for patches, if you cannot use cvs for
Tony Lambregts18a79c82002-12-19 23:43:46 +000059 some reason, you can submit patches against the latest tarball.
60 To do this make a copy of the files that you will be modifying and
61 <command>diff -u</command> against the old file. I.E.
62 </para>
63 <screen>
64diff -u file.old file.c > file.txt
65 </screen>
66 </sect1>
67
68 <sect1 id="Style-notes">
69 <title>Some notes about style</title>
70
71 <para>
72 There are a few conventions that about coding style that have been
73 adopted over the years of development. The rational for these
74 <quote>rules</quote> is explained for each one.
75 </para>
76 <itemizedlist>
77 <listitem>
78 <para>
Tom Wicklinec28575e2003-07-09 19:50:14 +000079 No HTML mail, since patches should be in-lined and HTML turns the
80 patch into garbage. Also it is considered bad etiquette as it
Tony Lambregtsf7128012003-03-07 20:34:01 +000081 uglifies the message, and is not viewable by many of the subscribers.
Tony Lambregts9902af22003-02-18 23:23:35 +000082 </para>
83 </listitem>
84 <listitem>
85 <para>
Tony Lambregts18a79c82002-12-19 23:43:46 +000086 Only one change set per patch. Patches should address only one
87 bug/problem at a time. If a lot of changes need to be made then it
Tom Wicklinec28575e2003-07-09 19:50:14 +000088 is preferred to break it into a series of patches. This makes it
Tony Lambregts18a79c82002-12-19 23:43:46 +000089 easier to find regressions.
90 </para>
91 </listitem>
92 <listitem>
93 <para>
Tony Lambregtsf7128012003-03-07 20:34:01 +000094 Tabs are not forbidden but discouraged. A tab is defined as
95 8 characters and the usual amount of indentation is 4
96 characters.
Tony Lambregts18a79c82002-12-19 23:43:46 +000097 </para>
98 </listitem>
99 <listitem>
100 <para>
101 C++ style comments are discouraged since some compilers choke on
102 them.
103 </para>
104 </listitem>
105 <listitem>
106 <para>
107 Commenting out a block of code is usually done by enclosing it in
108 <command>#if 0 ... #endif</command> Statements. For example.
109 </para>
110 <screen>
111/* note about reason for commenting block */
112#if 0
113code
114code /* comments */
115code
116#endif
117 </screen>
118 <para>
119 The reason for using this method is that it does not require that
120 you edit comments that may be inside the block of code.
121 </para>
122 </listitem>
123 <listitem>
124 <para>
Tom Wicklinec28575e2003-07-09 19:50:14 +0000125 Patches should be in-lined (if you can configure your email client to
126 not wrap lines), or attached as plain text attachments so they can
Tony Lambregts18a79c82002-12-19 23:43:46 +0000127 be read inline. This may mean some more work for you. However it
128 allows others to review your patch easily and decreases the chances
129 of it being overlooked or forgotten.
130 </para>
131 </listitem>
132 <listitem>
133 <para>
134 Code is usually limited to 80 columns. This helps prevent mailers
135 mangling patches by line wrap. Also it generally makes code easier
136 to read.
137 </para>
138 </listitem>
Tony Lambregtsc73cafa2004-10-05 04:12:09 +0000139 <listitem>
140 <para>
141 If the patch fixes a bug in Bugzilla please provide a link to the
142 bug in the comments of the patch. This will make it easier for the
143 maintainers of Bugzilla.
144 </para>
145 </listitem>
Tony Lambregts18a79c82002-12-19 23:43:46 +0000146 </itemizedlist>
147 <sect2 id="Inline-Attachments-with-OE">
148 <title>Inline attachments with Outlook Express</title>
149 <para>
Tom Wicklinec28575e2003-07-09 19:50:14 +0000150 Outlook Express is notorious for mangling attachments. Giving the
Francois Gougetc5f775a2003-06-18 03:30:39 +0000151 patch a <filename>.txt</filename> extension and attaching will solve
Tony Lambregts18a79c82002-12-19 23:43:46 +0000152 the problem for most mailers including Outlook. Also, there is a way
153 to enable Outlook Express send <filename>.diff</filename>
Francois Gougetc5f775a2003-06-18 03:30:39 +0000154 attachments.
Tony Lambregts18a79c82002-12-19 23:43:46 +0000155 </para>
156 <para>
157 You need following two things to make it work.
158 </para>
159 <orderedlist>
160 <listitem>
161 <para>
162 Make sure that <filename>.diff</filename> files have \r\n line
163 ends, because if OE detects that there is no \r\n line endings it
164 switches to quoted-printable format attachments.
165 </para>
166 </listitem>
167 <listitem>
168 <para>
169 Using regedit add key "Content Type" with value "text/plain"
170 to the .diff extension under HKEY_CLASSES_ROOT (same as for .txt
171 extension). This tells OE to use Content-Type: text/plain instead
172 of application/octet-stream.
173 </para>
174 </listitem>
175 </orderedlist>
176 <para>
177 Item #1 is important. After you hit "Send" button, go to "Outbox"
178 and using "Properties" verify the message source to make sure that
179 the mail has correct format. You might want to send several test
180 emails to yourself too.
181 </para>
182 </sect2>
Tony Lambregtsf7128012003-03-07 20:34:01 +0000183 <sect2 id="Alexandre-Bottom-Line">
184 <title>Alexandre's Bottom Line</title>
185 <para>
186 <quote>The basic rules are: no attachments, no mime crap, no
187 line wrapping, a single patch per mail. Basically if I can't
Dimitrie O. Paunace95ca2003-09-22 19:34:07 +0000188 do <command>"cat raw_mail | patch -p0"</command> it's in the
Tony Lambregtsf7128012003-03-07 20:34:01 +0000189 wrong format.</quote>
190 </para>
191 </sect2>
John R. Sheetsd9e064f2000-12-13 21:52:37 +0000192 </sect1>
193
194 <sect1 id="patch-quality">
195 <title>Quality Assurance</title>
196
197 <para>
198 (Or, "How do I get Alexandre to apply my patch quickly so I
199 can build on it and it will not go stale?")
200 </para>
201 <para>
202 Make sure your patch applies to the current CVS head
Tom Wicklinec28575e2003-07-09 19:50:14 +0000203 revisions. If a bunch of patches are committed to CVS that may
John R. Sheetsd9e064f2000-12-13 21:52:37 +0000204 affect whether your patch will apply cleanly then verify that
205 your patch does apply! <command>cvs update</command> is your
206 friend!
207 </para>
208 <para>
Tony Lambregtsf7128012003-03-07 20:34:01 +0000209 Save yourself some embarrassment and run your patched code
John R. Sheetsd9e064f2000-12-13 21:52:37 +0000210 against more than just your current test example. Experience
Hans Leidekker0de3c822004-09-27 20:32:13 +0000211 will tell you how much effort to apply here. If there are
212 any conformance tests for the code you're working on, run them
213 and make sure they still pass after your patch is applied. Running
214 tests can be done by running <command>make test</command>. You may
215 need to run <command>make testclean</command> to undo the results
216 of a previous test run. See the <quote>testing</quote> guide for
217 more details on Wine's conformance tests.
John R. Sheetsd9e064f2000-12-13 21:52:37 +0000218 </para>
219
220 </sect1>
221 </chapter>
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000222
223<!-- Keep this comment at the end of the file
224Local variables:
225mode: sgml
Dimitrie O. Paun255ecc52003-04-19 02:50:57 +0000226sgml-parent-document:("wine-devel.sgml" "set" "book" "part" "chapter" "")
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000227End:
228-->