curl/docs/CONTRIBUTE

234 строки
9.2 KiB
Plaintext
Исходник Обычный вид История

2004-08-13 15:53:33 +04:00
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
| (__| |_| | _ <| |___
2000-05-22 21:35:35 +04:00
\___|\___/|_| \_\_____|
When Contributing Source Code
2000-05-22 21:35:35 +04:00
This document is intended to offer guidelines that can be useful to keep in
mind when you decide to contribute to the project. This concerns new features
as well as corrections to existing flaws or bugs.
2000-08-01 02:42:34 +04:00
1. Learning cURL
1.1 Join the Community
1.2 License
1.3 What To Read
2. cURL Coding Standards
2.1 Naming
2.2 Indenting
2.3 Commenting
2.4 Line Lengths
2.5 General Style
2.6 Non-clobbering All Over
2.7 Platform Dependent Code
2.8 Write Separate Patches
2.9 Patch Against Recent Sources
2.10 Document
2.11 Test Cases
3. Pushing Out Your Changes
3.1 Write Access to CVS Repository
3.2 How To Make a Patch
3.3 How to get your changes into the main sources
==============================================================================
1. Learning cURL
1.1 Join the Community
2001-08-29 19:02:46 +04:00
Skip over to http://curl.haxx.se/mail/ and join the appropriate mailing
list(s). Read up on details before you post questions. Read this file before
2002-10-08 11:11:34 +04:00
you start sending patches! We prefer patches and discussions being held on
the mailing list(s), not sent to individuals.
2001-08-29 19:02:46 +04:00
Before posting to one of the curl mailing lists, please read up on the mailing
list etiquette: http://curl.haxx.se/mail/etiquette.html
We also hang out on IRC in #curl on irc.freenode.net
1.2. License
2000-08-01 02:42:34 +04:00
When contributing with code, you agree to put your changes and new code under
the same license curl and libcurl is already using unless stated and agreed
otherwise.
2000-08-01 02:42:34 +04:00
If you add a larger piece of code, you can opt to make that file or set of
2001-04-22 19:44:33 +04:00
files to use a different license as long as they don't enforce any changes to
the rest of the package and they make sense. Such "separate parts" can not be
GPL licensed (as we don't want copyleft to affect users of libcurl) but they
must use "GPL compatible" licenses (as we want to allow users to use libcurl
properly in GPL licensed environments).
When changing existing source code, you do not alter the copyright of the
original file(s). The copyright will still be owned by the original
creator(s) or those who have been assigned copyright by the original
author(s).
By submitting a patch to the curl project, you are assumed to have the right
to the code and to be allowed by your employer or whatever to hand over that
patch/code to us. We will credit you for your changes as far as possible, to
give credit but also to keep a trace back to who made what changes. Please
always provide us with your full real name when contributing!
2000-05-22 21:35:35 +04:00
1.3 What To Read
2001-08-29 19:02:46 +04:00
Source code, the man pages, the INTERNALS document, TODO, KNOWN_BUGS, the
most recent CHANGES. Just lurking on the libcurl mailing list is gonna give
you a lot of insights on what's going on right now. Asking there is a good
idea too.
2001-08-29 19:02:46 +04:00
2. cURL Coding Standards
2.1 Naming
2000-05-22 21:35:35 +04:00
Try using a non-confusing naming scheme for your new functions and variable
2000-08-01 02:42:34 +04:00
names. It doesn't necessarily have to mean that you should use the same as in
other places of the code, just that the names should be logical,
2001-03-12 12:43:43 +03:00
understandable and be named according to what they're used for. File-local
2002-10-08 11:11:34 +04:00
functions should be made static. We like lower case names.
2002-11-28 17:07:14 +03:00
See the INTERNALS document on how we name non-exported library-global
symbols.
2000-05-22 21:35:35 +04:00
2.2 Indenting
2000-05-22 21:35:35 +04:00
Please try using the same indenting levels and bracing method as all the
other code already does. It makes the source code a lot easier to follow if
2001-03-12 12:43:43 +03:00
all of it is written using the same style. We don't ask you to like it, we
2002-10-08 11:11:34 +04:00
just ask you to follow the tradition! ;-) This mainly means: 2-level indents,
using spaces only (no tabs) and having the opening brace ({) on the same line
as the if() or while().
2000-05-22 21:35:35 +04:00
Also note that we use if() and while() with no space before the parenthesis.
2.3 Commenting
2000-05-22 21:35:35 +04:00
2002-11-28 17:07:14 +03:00
Comment your source code extensively using C comments (/* comment */), DO NOT
2002-10-08 11:11:34 +04:00
use C++ comments (// this style). Commented code is quality code and enables
2003-08-18 19:27:26 +04:00
future modifications much more. Uncommented code risk having to be completely
replaced when someone wants to extend things, since other persons' source
code can get quite hard to read.
2000-05-22 21:35:35 +04:00
2.4 Line Lengths
We try to keep source lines shorter than 80 columns.
2.5 General Style
2000-05-22 21:35:35 +04:00
Keep your functions small. If they're small you avoid a lot of mistakes and
2002-11-28 17:07:14 +03:00
you don't accidentally mix up variables etc.
2000-05-22 21:35:35 +04:00
2.6 Non-clobbering All Over
2000-05-22 21:35:35 +04:00
2000-08-01 02:42:34 +04:00
When you write new functionality or fix bugs, it is important that you don't
fiddle all over the source files and functions. Remember that it is likely
that other people have done changes in the same source files as you have and
possibly even in the same functions. If you bring completely new
2000-05-22 21:35:35 +04:00
functionality, try writing it in a new source file. If you fix bugs, try to
fix one bug at a time and send them as separate patches.
2.7 Platform Dependent Code
2002-10-08 11:11:34 +04:00
Use #ifdef HAVE_FEATURE to do conditional code. We avoid checking for
2002-11-28 17:07:14 +03:00
particular operating systems or hardware in the #ifdef lines. The
HAVE_FEATURE shall be generated by the configure script for unix-like systems
and they are hard-coded in the config-[system].h files for the others.
2002-10-08 11:11:34 +04:00
2.8 Write Separate Patches
2000-05-22 21:35:35 +04:00
It is annoying when you get a huge patch from someone that is said to fix 511
odd problems, but discussions and opinions don't agree with 510 of them - or
509 of them were already fixed in a different way. Then the patcher needs to
extract the single interesting patch from somewhere within the huge pile of
source, and that gives a lot of extra work. Preferably, all fixes that
correct different problems should be in their own patch with an attached
description exactly what they correct so that all patches can be selectively
applied by the maintainer or other interested parties.
2.9 Patch Against Recent Sources
Please try to get the latest available sources to make your patches
2001-03-12 12:43:43 +03:00
against. It makes the life of the developers so much easier. The very best is
if you get the most up-to-date sources from the CVS repository, but the
latest release archive is quite OK as well!
2.10 Document
2000-05-22 21:35:35 +04:00
2000-08-01 02:42:34 +04:00
Writing docs is dead boring and one of the big problems with many open source
projects. Someone's gotta do it. It makes it a lot easier if you submit a
small description of your fix or your new features with every contribution so
that it can be swiftly added to the package documentation.
2000-05-22 21:35:35 +04:00
2002-10-08 11:11:34 +04:00
The documentation is always made in man pages (nroff formatted) or plain
ASCII files. All HTML files on the web site and in the release archives are
generated from the nroff/ASCII versions.
2.11 Test Cases
2001-03-12 12:43:43 +03:00
Since the introduction of the test suite, we can quickly verify that the main
features are working as they're supposed to. To maintain this situation and
improve it, all new features and functions that are added need to be tested
in the test suite. Every feature that is added should get at least one valid
test case that verifies that it works as documented. If every submitter also
2003-08-18 19:27:26 +04:00
posts a few test cases, it won't end up as a heavy burden on a single person!
2002-11-28 17:07:14 +03:00
3. Pushing Out Your Changes
3.1 Write Access to CVS Repository
If you are a frequent contributor, or have another good reason, you can of
course get write access to the CVS repository and then you'll be able to
check-in all your changes straight into the CVS tree instead of sending all
changes by mail as patches. Just ask if this is what you'd want. You will be
required to have posted a few quality patches first, before you can be
granted write access.
3.2 How To Make a Patch
2002-11-28 17:07:14 +03:00
Keep a copy of the unmodified curl sources. Make your changes in a separate
source tree. When you think you have something that you want to offer the
curl community, use GNU diff to generate patches.
If you have modified a single file, try something like:
2004-08-13 15:53:33 +04:00
diff -u unmodified-file.c my-changed-one.c > my-fixes.diff
2002-11-28 17:07:14 +03:00
If you have modified several files, possibly in different directories, you
can use diff recursively:
2004-08-13 15:53:33 +04:00
diff -ur curl-original-dir curl-modified-sources-dir > my-fixes.diff
2002-11-28 17:07:14 +03:00
2003-03-26 14:48:03 +03:00
The GNU diff and GNU patch tools exist for virtually all platforms, including
2004-08-13 15:53:33 +04:00
all kinds of Unixes and Windows:
2003-03-26 14:48:03 +03:00
For unix-like operating systems:
http://www.gnu.org/software/patch/patch.html
http://www.gnu.org/directory/diffutils.html
2003-03-26 14:48:03 +03:00
For Windows:
http://gnuwin32.sourceforge.net/packages/patch.htm
http://gnuwin32.sourceforge.net/packages/diffutils.htm
3.3 How to get your changes into the main sources
1. Submit your patch to the curl-library mailing list
2. Make the patch against as recent sources as possible.
3. Make sure your patch adheres to the source indent and coding style of
already existing source code. Failing to do so just adds more work for me.
4. Respond to replies on the list about the patch and answer questions and/or
fix nits/flaws. This is very important. I will take lack of replies as a
sign that you're not very anxious to get your patch accepted and I tend to
simply drop such patches from my TODO list.
5. If you've followed the above mentioned paragraphs and your patch still
hasn't been incorporated after some weeks, consider resubmitting it to the
list.