[openocd.git] / HACKING
1 // This file is part of the Doxygen Developer Manual
2 /** @page patchguide Patch Guidelines
4 \attention You can't send patches to the mailing list anymore at all. Nowadays
5 you are expected to send patches to the OpenOCD Gerrit GIT server for a
6 review.
8 \attention If you already have a Gerrit account and want to try a
9 different sign in method, please first sign in as usually, press your
10 name in the upper-right corner, go to @a Settings, select @a
11 Identities pane, press <em>Link Another Identity</em> button. In case
12 you already have duplicated accounts, ask administrators for manual
13 merging.
15 \attention If you're behind a corporate wall with http only access to the
16 world, you can still use these instructions!
18 @section gerrit Submitting patches to the OpenOCD Gerrit server
20 OpenOCD is to some extent a "self service" open source project, so to
21 contribute, you must follow the standard procedures to have the best
22 possible chance to get your changes accepted.
24 The procedure to create a patch is essentially:
26 - make the changes
27 - create a commit
28 - send the changes to the Gerrit server for review
29 - correct the patch and re-send it according to review feedback
31 Your patch (or commit) should be a "good patch": focus it on a single
32 issue, and make it easily reviewable. Don't make
33 it so large that it's hard to review; split large
34 patches into smaller ones (this will also help
35 to track down bugs later). All patches should
36 be "clean", which includes preserving the existing
37 coding style and updating documentation as needed. When adding a new
38 command, the corresponding documentation should be added to
39 @c doc/openocd.texi in the same commit. OpenOCD runs on both Little
40 Endian and Big Endian hosts so the code can't count on specific byte
41 ordering (in other words, must be endian-clean).
43 There are several additional methods of improving the quality of your
44 patch:
46 - Runtime testing with Valgrind Memcheck
48 This helps to spot memory leaks, undefined behaviour due to
49 uninitialized data or wrong indexing, memory corruption, etc.
51 - Clang Static Analyzer
53 Using this tool uncovers many different kinds of bugs in C code,
54 with problematic execution paths fully explained. It is a part of
55 standard Clang installation.
57 To generate a report, run this in the OpenOCD source directory:
58 @code
59 mkdir build-scanbuild; cd build-scanbuild
60 scan-build ../configure
61 scan-build make CFLAGS="-std=gnu99 -I. -I../../jimtcl"
62 @endcode
64 - Runtime testing with sanitizers
66 Both GCC and LLVM/Clang include advanced instrumentation options to
67 detect undefined behaviour and many kinds of memory
68 errors. Available with @c -fsanitize=* command arguments.
70 Example usage:
71 @code
72 mkdir build-sanitizers; cd build-sanitizers
73 ../configure CC=clang CFLAGS="-fno-omit-frame-pointer \
74 -fsanitize=address -fsanitize=undefined -ggdb3"
75 make
76 export ASAN_OPTIONS=detect_stack_use_after_return=1
77 src/openocd -s ../tcl -f /path/to/openocd.cfg
78 @endcode
80 Please consider performing these additonal checks where appropriate
81 (especially Clang Static Analyzer for big portions of new code) and
82 mention the results (e.g. "Valgrind-clean, no new Clang analyzer
83 warnings") in the commit message.
85 Say in the commit message if it's a bugfix (describe the bug) or a new
86 feature. Don't expect patches to merge immediately
87 for the next release. Be ready to rework patches
88 in response to feedback.
90 Add yourself to the GPL copyright for non-trivial changes.
92 @section stepbystep Step by step procedure
94 -# Create a Gerrit account at: http://openocd.zylin.com
95 - On subsequent sign ins, use the full URL prefaced with 'http://'
96 For example: http://user_identifier.open_id_provider.com
97 -# Add a username to your profile.
98 After creating the Gerrit account and signing in, you will need to
99 add a username to your profile. To do this, go to 'Settings', and
100 add a username of your choice.
101 Your username will be required in step 3 and substituted wherever
102 the string 'USERNAME' is found.
103 -# Create an SSH public key following the directions on github:
104 https://help.github.com/articles/generating-ssh-keys . You can skip step 3
105 (adding key to Github account) and 4 (testing) - these are useful only if
106 you actually use Github or want to test whether the new key works fine.
107 -# Add this new SSH key to your Gerrit account:
108 go to 'Settings' > 'SSH Public Keys', paste the contents of
109 ~/.ssh/id_rsa.pub into the text field (if it's not visible click on
110 'Add Key ...' button) and confirm by clicking 'Add' button.
111 -# Clone the git repository, rather than just download the source:
112 @code
113 git clone git://git.code.sf.net/p/openocd/code openocd
114 @endcode
115 or if you have problems with the "git:" protocol, use
116 the slower http protocol:
117 @code
118 git clone http://git.code.sf.net/p/openocd/code openocd
119 @endcode
120 -# Set up Gerrit with your local repository. All this does it
121 to instruct git locally how to send off the changes.
122 -# Add a new remote to git using Gerrit username:
123 @code
124 git remote add review ssh://USERNAME@openocd.zylin.com:29418/openocd.git
125 git config remote.review.push HEAD:refs/for/master
126 @endcode
127 Or with http only:
128 @code
129 git remote add review http://USERNAME@openocd.zylin.com/p/openocd.git
130 git config remote.review.push HEAD:refs/for/master
131 @endcode
132 The http password is configured from your gerrit settings - http://openocd.zylin.com/#/settings/http-password.
133 \note If you want to simplify http access you can also add your http password to the url as follows:
134 @code
135 git remote add review http://USERNAME:PASSWORD@openocd.zylin.com/p/openocd.git
136 @endcode
137 -# You will need to install this hook, we will look into a better solution:
138 @code
139 scp -p -P 29418 USERNAME@openocd.zylin.com:hooks/commit-msg .git/hooks/
140 @endcode
141 Or with http only:
142 @code
143 wget http://openocd.zylin.com/tools/hooks/commit-msg
144 mv commit-msg .git/hooks
145 chmod +x .git/hooks/commit-msg
146 @endcode
147 \note A script exists to simplify the two items above. execute:
148 @code
149 tools/initial.sh <username>
150 @endcode
151 With @<username@> being your Gerrit username.
152 -# Set up git with your name and email:
153 @code
154 git config --global user.name "John Smith"
155 git config --global user.email "john@smith.org"
156 @endcode
157 -# Work on your patches. Split the work into
158 multiple small patches that can be reviewed and
159 applied seperately and safely to the OpenOCD
160 repository.
161 @code
162 while(!done) {
163 work - edit files using your favorite editor.
164 run "git commit -s -a" to commit all changes.
165 run tools/checkpatch.sh to verify your patch style is ok.
166 }
167 @endcode
168 \note use "git add ." before commit to add new files.
170 Comment template, notice the short first line w/topic. The topic field
171 should identify the main part or subsystem the patch touches. Check
172 git log for examples.
173 @code
174 topic: Short comment
175 <blank line>
176 Longer comments over several lines, explaining (where applicable) the
177 reason for the patch and the general idea the solution is based on,
178 any major design decisions, etc...
179 <blank line>
180 Signed-off-by: ...
181 @endcode
182 -# Next you need to make sure that your patches
183 are on top of the latest stuff on the server and
184 that there are no conflicts:
185 @code
186 git pull --rebase origin master
187 @endcode
188 -# Send the patches to the Gerrit server for review:
189 @code
190 git push review
191 @endcode
192 -# Forgot something, want to add more? Just make the changes and do:
193 @code
194 git commit --amend
195 git push review
196 @endcode
198 Further reading: http://www.coreboot.org/Git
200 @section timeline When can I expect my contribution to be committed?
202 The code review is intended to take as long as a week or two to allow
203 maintainers and contributors who work on OpenOCD only in their spare
204 time opportunity to perform a review and raise objections.
206 With Gerrit much of the urgency of getting things committed has been
207 removed as the work in progress is safely stored in Gerrit and
208 available if someone needs to build on your work before it is
209 submitted to the official repository.
211 Another factor that contributes to the desire for longer cool-off
212 times (the time a patch lies around without any further changes or
213 comments), it means that the chances of quality regression on the
214 master branch will be much reduced.
216 If a contributor pushes a patch, it is considered good form if another
217 contributor actually approves and submits that patch.
219 It should be noted that a negative review in Gerrit ("-1" or "-2") may (but does
220 not have to) be disregarded if all conditions listed below are met:
222 - the concerns raised in the review have been addressed (or explained),
223 - reviewer does not re-examine the change in a month,
224 - reviewer does not answer e-mails for another month.
226 @section browsing Browsing Patches
227 All OpenOCD patches can be reviewed <a href="http://openocd.zylin.com/">here</a>.
229 @section reviewing Reviewing Patches
230 From the main <a href="http://openocd.zylin.com/#/q/status:open,n,z">Review
231 page</a> select the patch you want to review and click on that patch. On the
232 appearing page select the download method (top right). Apply the
233 patch. After building and testing you can leave a note with the "Reply"
234 button and mark the patch with -1, 0 and +1.
235 */
236 /** @file
237 This file contains the @ref patchguide page.
238 */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)