Development Guidelines: Difference between revisions

From coreboot
Jump to navigation Jump to search
(More descriptions of how to contribute.)
Line 3: Line 3:
= Development Environment =
= Development Environment =
* Required toolchains etc.
* Required toolchains etc.
* flashrom requires pciutils-dev.


= Coding Guidelines =
= Coding Guidelines =
Line 11: Line 12:
== Documentation ==
== Documentation ==
* General guidelines and tips
* General guidelines and tips
* Doxygen
* Doxygen-generated API- and code documentation is available at http://qa.linuxbios.org/docs/.
 
== Testing ==
== Testing ==


Line 22: Line 24:


= How to contribute =
= How to contribute =
== Creating Patches ==
* Always use a checkout of the latest svn version of the code.
* Make sure all new and modified files contain the [[Development Guidelines#Common_License_Header|proper license headers]] (see below).
* Create your patches by executing the following command in the top-level LinuxBIOSv2 directory:
svn diff > ~/some_descriptive_name.patch
* Open the patch in a text-editor and double-check that your changes are correct, and that the patch only contains what you think it contains.
== Reviews ==
* Send your patch to the [[Mailinglist]] for review.
** Start the email with a detailed description of what the patch does and why. This text will usually end up in the commit logs so don't clutter it with useless stuff which should not go into the commit message.
** Add a single line containing your "[[Development Guidelines#Sign-off_Procedure|sign-off]]" after the description of the patch.
*** Example: ''Signed-off-by: John Doe <john@example.com>''
** Add a single line which only contains "---". Everything which comes after that line will not be included in the commit message.
* The developers on the mailing list will review and/or test your patch and send comments or suggestions. Please post updated patches to the mailing list again.
* If the patch looks ok to one or more developers, they will reply to your mail with an Acked-by: line.
** Example: ''Acked-by: John Doe <john@example.com>''
* Every non-trivial patch must get at least one Acked-by: to allow it to be commited.
== Svn Commits ==
== Svn Commits ==
== Reviews ==
 
* Send patches to the [[Mailinglist]] for review before committing.
* Include the description from the email containing the patch.
* Include all Signed-off-by: and Acked-by: lines.
* Reference or close bugs which are fixed by the commit, or are related to it. See [[Development Guidelines#How_to_close_Trac_issues_automatically_via_email|below]].
 
== Bug-Tracker ==
== Bug-Tracker ==



Revision as of 16:09, 29 October 2006

This is work in progress!

Development Environment

  • Required toolchains etc.
  • flashrom requires pciutils-dev.

Coding Guidelines

General Guidelines

Comments

Coding Style

  • Indentation etc.

Documentation

Testing

Every commit will be processed by the autobuild and autotest system available at http://qa.linuxbios.org/. In addition please run autobuild yourself before submitting patches.

autobuild

autotest

How to contribute

Creating Patches

  • Always use a checkout of the latest svn version of the code.
  • Make sure all new and modified files contain the proper license headers (see below).
  • Create your patches by executing the following command in the top-level LinuxBIOSv2 directory:
svn diff > ~/some_descriptive_name.patch
  • Open the patch in a text-editor and double-check that your changes are correct, and that the patch only contains what you think it contains.

Reviews

  • Send your patch to the Mailinglist for review.
    • Start the email with a detailed description of what the patch does and why. This text will usually end up in the commit logs so don't clutter it with useless stuff which should not go into the commit message.
    • Add a single line containing your "sign-off" after the description of the patch.
      • Example: Signed-off-by: John Doe <john@example.com>
    • Add a single line which only contains "---". Everything which comes after that line will not be included in the commit message.
  • The developers on the mailing list will review and/or test your patch and send comments or suggestions. Please post updated patches to the mailing list again.
  • If the patch looks ok to one or more developers, they will reply to your mail with an Acked-by: line.
    • Example: Acked-by: John Doe <john@example.com>
  • Every non-trivial patch must get at least one Acked-by: to allow it to be commited.

Svn Commits

  • Include the description from the email containing the patch.
  • Include all Signed-off-by: and Acked-by: lines.
  • Reference or close bugs which are fixed by the commit, or are related to it. See below.

Bug-Tracker

How to close Trac issues automatically via email

It searches commit messages for text in the form of:

  • command #1
  • command #1, #2
  • command #1 & #2
  • command #1 and #2

You can have more then one command in a message. The following commands are supported. There is more then one spelling for each command, to make this as user-friendly as possible.

  • closes, fixes
  The specified issue numbers are closed with the contents of this
  commit message being added to it.
  • references, refs, addresses, re
  The specified issue numbers are left in their current status, but
  the contents of this commit message are added to their notes.

A fairly complicated example of what you can do is with a commit message of:

   Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.

This will close #10 and #12, and add a note to #12.

License Issues

  • Contributed code must be GPL'd (preferrably GPLv2 or any later version), or at least have a GPL-compatible license.

Common License Header

Please quote the full license text as shown below. It should contain:

  • The year(s) when the code was written or modified and a copyright note of you (or your company, if you are contributing as part of your employment, and thus the copyright belongs to your company). Also, please provide an email address so that you can be contacted if questions arise.
    • Example: Copyright (C) 2006 John Doe <john@example.com>
    • Example: Copyright (C) 2004-2006 Company, Inc.
  • An extra line which lists the author of the code, if the copyright holder is not the author (e.g. if you work for a company and the company owns the copyright).
    • Example: Copyright (C) 2004-2006 Company, Inc.
    • Example: Written by Janet Doe <janet@example.com> for Company, Inc.
  • The full GPL header as shown below.

Complete example for *.c and *.h files:

/*
 * This file is part of the LinuxBIOS project.
 *
 * Copyright (C) 2003-2005 John Doe <john@example.com>
 * Copyright (C) 2005 Jane Doe <jane@example.com>
 * Copyright (C) 2006 Company, Inc.
 * 
 * Written by Janet Doe <janet@example.com> for Company, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

Complete example for config files, Python files, shell scripts etc.:

##
## This file is part of the LinuxBIOS project.
##
## Copyright (C) 2003-2005 John Doe <john@example.com>
## Copyright (C) 2005 Jane Doe <jane@example.com>
## Copyright (C) 2006 Company, Inc.
##
## Written by Janet Doe <janet@example.com> for Company, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
##

Sign-off Procedure

Verbatim copy from the Linux kernel (we might modify this a bit):

To improve tracking of who did what, especially with patches that can
percolate to their final resting place in the kernel through several
layers of maintainers, we've introduced a "sign-off" procedure on
patches that are being emailed around.
The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as a open-source patch. The rules are pretty simple: if you can certify the below:
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
then you just add a line saying
Signed-off-by: Random J Developer <random@developer.example.org>
Some people also put extra tags at the end. They'll just be ignored for now, but you can do this to mark internal company procedures or just point out some special detail about the sign-off.