diff options
| -rw-r--r-- | documentation/dev-manual/dev-manual-newbie.xml | 541 |
1 files changed, 511 insertions, 30 deletions
diff --git a/documentation/dev-manual/dev-manual-newbie.xml b/documentation/dev-manual/dev-manual-newbie.xml index 5ca2c25b52..68a2f4a211 100644 --- a/documentation/dev-manual/dev-manual-newbie.xml +++ b/documentation/dev-manual/dev-manual-newbie.xml | |||
| @@ -5,44 +5,516 @@ | |||
| 5 | 5 | ||
| 6 | <title>Working with Open Source Code</title> | 6 | <title>Working with Open Source Code</title> |
| 7 | 7 | ||
| 8 | <section id='newbie-intro'> | 8 | <para> |
| 9 | <title>Introduction</title> | 9 | This chapter presents information for users new or unfamiliar with working in an open source environment. |
| 10 | Working in this type of environment is different than working in a closed, proprietary environment. | ||
| 11 | The chapter also presents information specific to the Yocto Project environment. | ||
| 12 | It specifically addresses licensing issues, code repositories, the open-source distributed version control | ||
| 13 | system Git, and best practices within Yocto Project. | ||
| 14 | </para> | ||
| 15 | |||
| 16 | <note><para> | ||
| 17 | If you are a seasoned open source developer and are familiar with Git, you might just be interested | ||
| 18 | in the Yocto Project specific information in this chapter. | ||
| 19 | </para></note> | ||
| 20 | |||
| 21 | <section id='open-source-philosophy'> | ||
| 22 | <title>Open Source Philosophy</title> | ||
| 23 | |||
| 10 | <para> | 24 | <para> |
| 11 | The Yocto Project presents the kernel as a fully patched, history-clean Git | 25 | Open source philosophy is characterized by software development directed by peer production, |
| 12 | repository. | 26 | bartering, and collaboration through a concerned community of developers. |
| 13 | The Git tree represents the selected features, board support, | 27 | Contrast this to the more standard centralized development models used by commercial software |
| 14 | and configurations extensively tested by Yocto Project. | 28 | companies where a finite set of developers produce a product for sale using a defined set |
| 15 | The Yocto Project kernel allows the end user to leverage community | 29 | of procedures that ultimately result in an end-product whose architecture and source material |
| 16 | best practices to seamlessly manage the development, build and debug cycles. | 30 | are closed to the public. |
| 17 | </para> | 31 | </para> |
| 32 | |||
| 18 | <para> | 33 | <para> |
| 19 | This manual describes the Yocto Project kernel by providing information | 34 | Open source projects conceptually have differing concurrent agendas, approaches, and production. |
| 20 | on its history, organization, benefits, and use. | 35 | These facets of the development process can come from anyone in the public (community) that has a |
| 21 | The manual consists of two sections: | 36 | stake in the software project. |
| 22 | <itemizedlist> | 37 | The open source environment contains new copyright, licensing, domain, and consumer issues |
| 23 | <listitem><para>Concepts - Describes concepts behind the kernel. | 38 | that differ from the more traditional development environment. |
| 24 | You will understand how the kernel is organized and why it is organized in | 39 | In an open source environment the end-product, source material, and documentation are |
| 25 | the way it is. You will understand the benefits of the kernel's organization | 40 | all available to the public at no cost. |
| 26 | and the mechanisms used to work with the kernel and how to apply it in your | 41 | </para> |
| 27 | design process.</para></listitem> | 42 | |
| 28 | <listitem><para>Using the Kernel - Describes best practices and "how-to" information | 43 | <para> |
| 29 | that lets you put the kernel to practical use. Some examples are "How to Build a | 44 | A benchmark example of an open source project is the Linux Kernel, which was initially conceived |
| 30 | Project Specific Tree", "How to Examine Changes in a Branch", and "Saving Kernel | 45 | and created by Finnish computer science student Linus Torvalds in 1991. |
| 31 | Modifications."</para></listitem> | 46 | Conversely, a good example of a non-open source project is the Windows family of operating |
| 32 | </itemizedlist> | 47 | systems developed by Microsoft Corporation. |
| 48 | </para> | ||
| 49 | |||
| 50 | <para> | ||
| 51 | Wikipedia has a good historical description of the Open Source Philosophy | ||
| 52 | <ulink url='http://wn.wikipedia.org/wiki/Open_source'>here</ulink>. | ||
| 53 | </para> | ||
| 54 | |||
| 55 | <para> | ||
| 56 | You can also find helpful information on how to participate in the Linux Community | ||
| 57 | <ulink url='http://ldn.linuxfoundation.org/book/how-participate-linux-community'>here</ulink>. | ||
| 58 | </para> | ||
| 59 | </section> | ||
| 60 | |||
| 61 | <section id='yocto-project-repositories'> | ||
| 62 | <title>Yocto Project Repositories</title> | ||
| 63 | |||
| 64 | <para> | ||
| 65 | The Yocto Project team maintains complete source repositories that allow further development | ||
| 66 | of Yocto Project, its tools, Board Support Packages, and so forth. | ||
| 67 | As a developer who uses Yocto Project, however, you need only to be able to access your | ||
| 68 | kernel or application source code and any layers (modifications) on which you might be working. | ||
| 69 | </para> | ||
| 70 | |||
| 71 | <para> | ||
| 72 | For any supported release of Yocto Project you can go to the Yocto Project website’s | ||
| 73 | <ulink url='http://www.yoctoproject.org/download'>download page</ulink> and get a | ||
| 74 | <filename>.bz2</filename> tarball of the release. | ||
| 75 | You can also go to this site to download any supported BSP tarballs. | ||
| 76 | </para> | ||
| 77 | |||
| 78 | <para> | ||
| 79 | After obtaining the code, you can unpack the tarballs and have a working Git repository | ||
| 80 | from which you can develop. | ||
| 81 | Or, you can take steps to create local repositories of Yocto Project source code and metadata on | ||
| 82 | your development system. | ||
| 83 | See the information | ||
| 84 | <ulink url='https://wiki.yoctoproject.org/wiki/Transcript:_from_git_checkout_to_meta-intel_BSP'>here</ulink> | ||
| 85 | for information on how to set up these local Git repositories. | ||
| 86 | </para> | ||
| 87 | |||
| 88 | <note><para> | ||
| 89 | Should you be interested in locations of complete Yocto Project development code, there are | ||
| 90 | two areas where this code is maintained: | ||
| 91 | <itemizedlist> | ||
| 92 | <listitem><para><emphasis><ulink url='http://git.yoctoproject.org/cgit/cgit.cgi'>Source Repositories:</ulink></emphasis> | ||
| 93 | This area contains IDE Plugins, Matchbox, Poky, Poky Support, Tools, Yocto Linux Kernel, and Yocto | ||
| 94 | Metadata Layers.</para></listitem> | ||
| 95 | <listitem><para><emphasis><ulink url='http://autobuilder.yoctoproject.org/downloads/'>Index of /downloads:</ulink></emphasis> | ||
| 96 | This area contains an index of the Eclipse-plugin, miscellaneous support, poky, pseudo, and | ||
| 97 | all released versions of Yocto Project. | ||
| 98 | [WRITER NOTE: link will be http://downloads.yoctoproject.org.]</para></listitem> | ||
| 99 | </itemizedlist> | ||
| 100 | </para></note> | ||
| 101 | </section> | ||
| 102 | |||
| 103 | <section id='licensing'> | ||
| 104 | <title>Licensing</title> | ||
| 105 | |||
| 106 | <para> | ||
| 107 | Because open source projects are open to the public they have different licensing structures in place. | ||
| 108 | License evolution for both Open Source and Free Software has an interesting history. | ||
| 109 | If you are interested in the history you can find basic information here: | ||
| 110 | <itemizedlist> | ||
| 111 | <listitem><para><ulink url='http://en.wikipedia.org/wiki/Open-source_license'>Open source license history</ulink> | ||
| 112 | </para></listitem> | ||
| 113 | <listitem><para><ulink url='http://en.wikipedia.org/wiki/Free_software_license'>Free software license | ||
| 114 | history</ulink></para></listitem> | ||
| 115 | </itemizedlist> | ||
| 116 | </para> | ||
| 117 | |||
| 118 | <para> | ||
| 119 | In general, Yocto Project is broadly licensed under the Massachusetts Institute of Technology | ||
| 120 | (MIT) License. | ||
| 121 | MIT licensing permits the reuse of software within proprietary software as long as the | ||
| 122 | license is distributed with that software. | ||
| 123 | MIT is also compatible with the GNU General Public License (GPL). | ||
| 124 | Patches to the Yocto Project follow the up-stream licensing scheme. | ||
| 125 | </para> | ||
| 126 | |||
| 127 | <para> | ||
| 128 | You can find information on the MIT License <ulink url='http://en.wikipedia.org/wiki/MIT_License'>here</ulink>. | ||
| 129 | You can find information on the GNU GPL <ulink url='http://en.wikipedia.org/wiki/GPL'>here</ulink>. | ||
| 130 | </para> | ||
| 131 | |||
| 132 | <para> | ||
| 133 | When you build an image using Yocto Project the build process uses a known list of licenses to | ||
| 134 | ensure compliance. | ||
| 135 | Once the build completes the list of all licenses found and used during the build are | ||
| 136 | kept in the resulting build directory at | ||
| 137 | <filename><build_directory>/tmp/deploy/images/licenses</filename>. | ||
| 138 | If a module requires a license that is not in the base list then the build process | ||
| 139 | generates a warning during the build. | ||
| 140 | It is up to the developer to resolve potential licensing issues. | ||
| 141 | </para> | ||
| 142 | |||
| 143 | <para> | ||
| 144 | The base list of licenses used by the build process is a combination of the Software Package | ||
| 145 | Data Exchange (SPDX) list and the Open Source Initiative (OSI) projects. | ||
| 146 | <ulink url='http://spdx.org'>SPDX Group</ulink> is a working group of the Linux Foundation | ||
| 147 | that maintains a specification | ||
| 148 | for a standard format for communicating the components, licenses, and copyrights | ||
| 149 | associated with a software package. | ||
| 150 | <ulink url='http://opensource.org'>OSI</ulink> is a corporation dedicated to the Open Source | ||
| 151 | Definition and the effort for reviewing | ||
| 152 | and approving licenses that are OSD-conformant. | ||
| 153 | </para> | ||
| 154 | |||
| 155 | <para> | ||
| 156 | You can find a list of the combined SPDX and OSI licenses that the Yocto Project uses | ||
| 157 | <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/files/common-licenses'>here</ulink>. | ||
| 158 | The wiki page discusses the license infrastructure used by the Yocto Project. | ||
| 159 | </para> | ||
| 160 | </section> | ||
| 161 | |||
| 162 | <section id='git'> | ||
| 163 | <title>Git</title> | ||
| 164 | |||
| 165 | <para> | ||
| 166 | The Yocto Project uses Git, which is a free, open source distributed version control. | ||
| 167 | Git supports distributed development, non-linear development, can handle large projects, | ||
| 168 | cryptographic authentication of history, and toolkit design. | ||
| 169 | It is best that you know how to work with Git if you are going to use Yocto Project for development. | ||
| 170 | </para> | ||
| 171 | |||
| 172 | <para> | ||
| 173 | Git has an extensive set of commands that lets you manage and collaborate changes over the life | ||
| 174 | of a project. | ||
| 175 | Conveniently though, you can manage with a small set of basic operations and workflows | ||
| 176 | once you understand the basic philosophy behind Git. | ||
| 177 | You do not have to be an expert in Git to be functional. | ||
| 178 | A good place to look for instruction on a minimal set of Git commands is | ||
| 179 | <ulink url='http://git-scm.com/documentation'>here</ulink>. | ||
| 180 | If you need to download Git you can do so | ||
| 181 | <ulink url='http://git-scm.com/download'>here</ulink>. | ||
| 182 | </para> | ||
| 183 | |||
| 184 | <para> | ||
| 185 | Git works by using branching techniques that track content change (not files) | ||
| 186 | within a project (e.g. a new feature or updated documentation). | ||
| 187 | Creating a tree-like structure based on project divergence allows for excellent historical | ||
| 188 | information over the life of a project. | ||
| 189 | This methodology also allows for an environment in which you can do lots of | ||
| 190 | experimentation on your project as you develop changes or new features. | ||
| 191 | For example, you can create a “branch”, experiment with some feature, and then | ||
| 192 | if you like the feature you incorporate the branch into the tree. | ||
| 193 | If you don’t, you cut the branch off by deleting it. | ||
| 194 | </para> | ||
| 195 | |||
| 196 | <para> | ||
| 197 | If you don’t know much about Git it is strongly suggested that you educate | ||
| 198 | yourself by visiting the links previously mentioned. | ||
| 199 | </para> | ||
| 200 | |||
| 201 | <para> | ||
| 202 | The following list briefly describes some basic Git operations as a way to get started. | ||
| 203 | As with any set of commands, this list (in most cases) simply shows the base command and | ||
| 204 | omits the many arguments they support. | ||
| 205 | See the Git documentation for complete descriptions and strategies on how to use these commands: | ||
| 206 | <itemizedlist> | ||
| 207 | <listitem><para><emphasis>git init</emphasis> – Initializes an empty Git repository. | ||
| 208 | You cannot use Git commands unless you have a <filename>.git</filename> repository.</para></listitem> | ||
| 209 | <listitem><para><emphasis>git clone</emphasis> – Creates a clone of a repository. | ||
| 210 | During collaboration this command allows you to create a local repository that is on | ||
| 211 | equal footing with a fellow developer’s repository.</para></listitem> | ||
| 212 | <listitem><para><emphasis>git add</emphasis> – Adds updated file contents to the index that | ||
| 213 | Git uses to track changes. | ||
| 214 | All files that have changed must be added before they can be committed.</para></listitem> | ||
| 215 | <listitem><para><emphasis>git commit</emphasis> – Creates a “commit” that documents the changes you made. | ||
| 216 | Commits are used for historical purposes, for determining if a maintainer of a project | ||
| 217 | will allow the change, and for ultimately pushing the change from your local Git repository | ||
| 218 | into the project’s upstream (or master) repository.</para></listitem> | ||
| 219 | <listitem><para><emphasis>git status</emphasis> – Reports any modified files that possibly need | ||
| 220 | added and committed.</para></listitem> | ||
| 221 | <listitem><para><emphasis>git checkout <filename><branch-name></filename></emphasis> - Changes | ||
| 222 | your working branch. This command is analogous to “cd”.</para></listitem> | ||
| 223 | <listitem><para><emphasis><filename>git checkout –b <working-branch></filename></emphasis> - Creates | ||
| 224 | a working branch on your local machine where you can isolate work. | ||
| 225 | It is a good idea to use local branches when adding specific features or changes. | ||
| 226 | This way if you don’t like what you have done you can easily get rid of the work.</para></listitem> | ||
| 227 | <listitem><para><emphasis>git branch</emphasis> – Reports existing branches and tells you which | ||
| 228 | branch in which you are currently working.</para></listitem> | ||
| 229 | <listitem><para><emphasis>git pull</emphasis> – Retrieves information from an upstream Git | ||
| 230 | repository and places it in your local Git repository. | ||
| 231 | You use this command to make sure you are synchronized with the upstream repository | ||
| 232 | from which the project’s maintainer uses to pull changes into the master repository.</para></listitem> | ||
| 233 | <listitem><para><emphasis>git push</emphasis> – Sends all your local changes you have committed | ||
| 234 | to an upstream Git repository. | ||
| 235 | The maintainer of the project draws from these repositories when adding your changes to the | ||
| 236 | project’s master repository.</para></listitem> | ||
| 237 | <listitem><para><emphasis>git merge</emphasis> – Combines or adds changes from one local branch of | ||
| 238 | your repository with another branch. | ||
| 239 | When you create a local Git repository the default branch is named “master”. | ||
| 240 | A typical workflow is to create a temporary branch for isolated work, make and commit your | ||
| 241 | changes, switch to the master branch, merge the changes in the temporary branch with the | ||
| 242 | master branch, and then delete the temporary branch</para></listitem> | ||
| 243 | <listitem><para><emphasis>git cherry-pick</emphasis> – Choose and apply specific commits from | ||
| 244 | one branch into another branch. | ||
| 245 | There are times when you might not be able to merge all the changes in one branch with | ||
| 246 | another but need to pick out certain ones.</para></listitem> | ||
| 247 | <listitem><para><emphasis>gitk</emphasis> – Provides a GUI view of the branches and changes in | ||
| 248 | your local Git repository. | ||
| 249 | This command is a good way to see where things have diverged in your local repository.</para></listitem> | ||
| 250 | <listitem><para><emphasis>git log</emphasis> – Reports a history of your changes to the | ||
| 251 | repository.</para></listitem> | ||
| 252 | </itemizedlist> | ||
| 253 | </para> | ||
| 254 | </section> | ||
| 255 | |||
| 256 | <section id='workflows'> | ||
| 257 | <title>Workflows</title> | ||
| 258 | |||
| 259 | <para> | ||
| 260 | This section provides some overview on workflows using Git. | ||
| 261 | In particular, the information covers basic practices that describe roles and actions in a | ||
| 262 | collaborative development environment. | ||
| 263 | Again, if you are familiar with this type of development environment you might want to just skip the section. | ||
| 264 | </para> | ||
| 265 | |||
| 266 | <para> | ||
| 267 | Following are the definitions for some terms used in the Yocto Project. | ||
| 268 | [WRITER NOTE: I need to move this list of definitions somewhere useful.] | ||
| 269 | <itemizedlist> | ||
| 270 | <listitem><para><emphasis>Image</emphasis> - An image is a collection of recipes created with | ||
| 271 | Bitbake (baked). Images run on specific hardware and use cases.</para></listitem> | ||
| 272 | <listitem><para><emphasis>Recipe</emphasis> - A set of instructions for building packages. | ||
| 273 | A recipe describes where you get the source and which patches to apply. | ||
| 274 | Recipes describe dependencies for libraries or for other recipes and they | ||
| 275 | also contain configuration and compilation options. | ||
| 276 | Recipes also let you ‘install’ customizations. | ||
| 277 | Recipes contain the logical unit of execution, the software/images to build and | ||
| 278 | use the <filename>.bb</filename> file extension.</para></listitem> | ||
| 279 | <listitem><para><emphasis>BitBake</emphasis> - The task executor and scheduler used by Yocto Project | ||
| 280 | to build images. | ||
| 281 | For more information on BitBake, see the <ulink url='http://bitbake.berlios.de/manual/'> | ||
| 282 | BitBake documentation</ulink>.</para></listitem> | ||
| 283 | <listitem><para><emphasis>Package</emphasis> - A collection of ‘baked’ recipes. | ||
| 284 | You ‘bake’ something by running it through Bitbake.</para></listitem> | ||
| 285 | <listitem><para><emphasis>Layer</emphasis> - A logical collection of recipes representing the core, | ||
| 286 | a BSP, or an application stack.</para></listitem> | ||
| 287 | <listitem><para><emphasis>Metadata</emphasis> - Information for a build that is generally | ||
| 288 | architecture-independent. | ||
| 289 | This information includes Task definitions in recipes, classes, and configuration | ||
| 290 | information.</para></listitem> | ||
| 291 | <listitem><para><emphasis>Configuration File</emphasis>: Configuration information in the | ||
| 292 | <filename>.conf</filename> files provides global definition of variables. | ||
| 293 | The <filename>build/conf/local.conf</filename> configuration file defines local user-defined variables. | ||
| 294 | The <filename>distro/poky.conf</filename> configuration file defines Yocto ‘distro’ configuration | ||
| 295 | variables. | ||
| 296 | The <filename>machine/beagleboard.conf</filename> configuration file defines machine-specific variables. | ||
| 297 | Configuration files end with a <filename>.conf</filename> filename extension.</para></listitem> | ||
| 298 | <listitem><para><emphasis>Classes</emphasis> - Files that encapsulate and inherit logic. | ||
| 299 | Class files end with the <filename>.bbclass</filename> filename extension.</para></listitem> | ||
| 300 | <listitem><para><emphasis>Tasks</emphasis> - Arbitrary groups of software used to contain Recipes. | ||
| 301 | You simply use Tasks to hold recipes that when build usually accomplished a single task. | ||
| 302 | For example, a task could contain the recipes for a company’s proprietary or value-add software. | ||
| 303 | Or the task could contain the recipes that enable graphics. | ||
| 304 | A task is really just another recipe. | ||
| 305 | Because task files are recipes, they end with the <filename>.bb</filename> filename | ||
| 306 | extension.</para></listitem> | ||
| 307 | <listitem><para><emphasis>Common OE-Core</emphasis> - A core set of metadata originating | ||
| 308 | with OpenEmbedded (OE) that is shared between OE and the Yocto Project.</para></listitem> | ||
| 309 | </itemizedlist> | ||
| 310 | </para> | ||
| 311 | |||
| 312 | <para> | ||
| 313 | A master Git repository exists that contains the project. | ||
| 314 | Usually a key individual is responsible for this repository. | ||
| 315 | It is the “upstream” repository where the final builds of the project occur. | ||
| 316 | The maintainer is responsible for allowing changes in from other developers and for | ||
| 317 | organizing the branch structure of the repository to reflect release strategies and so forth. | ||
| 318 | </para> | ||
| 319 | |||
| 320 | <para> | ||
| 321 | The maintainer of the project also owns a contribution repository usually known as a “contrib” area. | ||
| 322 | The contrib area temporarily holds changes to the project that have been submitted or committed | ||
| 323 | by the development team. | ||
| 324 | The maintainer determines if the changes are qualified to be moved into the master repository. | ||
| 325 | </para> | ||
| 326 | |||
| 327 | <para> | ||
| 328 | Developers create and maintain cloned repositories of the upstream master repository. | ||
| 329 | These repositories are local to their development platforms and are used to develop changes. | ||
| 330 | When a developer is satisfied with a particular feature or change they “push” the changes | ||
| 331 | up to the contrib repository. | ||
| 332 | Developers are responsible for keeping their local repository up-to-date with the master | ||
| 333 | repository. | ||
| 334 | They are also responsible for straightening out any conflicts that might arise within files | ||
| 335 | that are being worked on simultaneously by more than one person. | ||
| 336 | All this work is done locally on the developer’s machine before anything is pushed upstream | ||
| 337 | and examined at the maintainer’s level. | ||
| 338 | </para> | ||
| 339 | |||
| 340 | <para> | ||
| 341 | A somewhat formal method exists by which developers commit changes and push them into the | ||
| 342 | contrib area and subsequently request that the maintainer include them into the master repository. | ||
| 343 | This process is called “submitting a patch” or “submitting a change.” | ||
| 33 | </para> | 344 | </para> |
| 345 | |||
| 34 | <para> | 346 | <para> |
| 35 | For more information on the kernel, see the following links: | 347 | To summarize the environment: we have a single point of entry for changes into the project’s |
| 348 | master repository, which is controlled by the project’s maintainer. | ||
| 349 | And, we have a set of developers who independently develop, test, and submit changes | ||
| 350 | upstream for the maintainer to examine. | ||
| 351 | The maintainer then chooses which changes are going to become permanently a part of the project. | ||
| 352 | </para> | ||
| 353 | |||
| 354 | <para> | ||
| 355 | [WRITER NOTE: Would like a figure here for Git workflow] | ||
| 356 | </para> | ||
| 357 | |||
| 358 | <para> | ||
| 359 | While each development environment is unique, there are some best practices or methods | ||
| 360 | that help development run smoothly. | ||
| 361 | The following list describes some of these practices. | ||
| 362 | For more detailed information about these strategies see | ||
| 363 | <ulink url='http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html'>Git Workflows</ulink>. | ||
| 364 | <itemizedlist> | ||
| 365 | <listitem><para><emphasis>Small Changes</emphasis> - It is best to keep your changes you commit | ||
| 366 | small as compared to bundling many disparate changes into a single commit. | ||
| 367 | This practice not only keeps things manageable but also allows the maintainer | ||
| 368 | to more easily include or refuse changes.</para></listitem> | ||
| 369 | <listitem><para><emphasis>Use Branches Liberally</emphasis> - It is very easy to create, use, and | ||
| 370 | delete local branches in your working Git repository. | ||
| 371 | You can name these branches anything you like. | ||
| 372 | It is helpful to give them names associated with the particular feature or change | ||
| 373 | on which you are working. | ||
| 374 | Once you are done with a feature or change you simply discard the branch.</para></listitem> | ||
| 375 | <listitem><para><emphasis>Merge Changes</emphasis> - The Git merge command allows you to take the | ||
| 376 | changes from one branch and fold them into another branch. | ||
| 377 | This process is especially helpful when more than a single developer might be working | ||
| 378 | on different parts of the same feature. | ||
| 379 | Merging changes also automatically identifies any collisions or “conflicts” | ||
| 380 | that might happen resulting from the same lines of code be altered by two different | ||
| 381 | developers.</para></listitem> | ||
| 382 | <listitem><para><emphasis>Manage Branches</emphasis> - Because branches are easy to use, you should | ||
| 383 | use a system where branches indicate varying levels of code readiness. | ||
| 384 | For example, you can have a “work” branch to develop in, a “test” branch where the code or | ||
| 385 | change is tested, a “stage” branch where changes are ready to be committed, and so forth. | ||
| 386 | As your project develops, you can merge code across the branches to reflect ever-increasing | ||
| 387 | stable states of the development.</para></listitem> | ||
| 388 | <listitem><para><emphasis>Use Push and Pull</emphasis> - The push-pull workflow is based on the | ||
| 389 | concept of developers “pushing” local commits upstream to the remote repository, which is | ||
| 390 | usually a contribution repository. | ||
| 391 | It is also based on the developers “pulling” known states of the project down into their | ||
| 392 | local development repositories. | ||
| 393 | This workflow easily allows you to pull changes submitted by other developers from the | ||
| 394 | upstream repository into your work area ensuring that you have the most recent software | ||
| 395 | on which to develop.</para></listitem> | ||
| 396 | <listitem><para><emphasis>Patch Workflow</emphasis> - This workflow allows you to notify the | ||
| 397 | maintainer through an email that you have a change (or patch) you would like considered | ||
| 398 | for the master repository. | ||
| 399 | To send this type of change you format the patch and then send the email using the Git commands | ||
| 400 | <filename>git format-patch</filename> and <filename>git send-email</filename>. | ||
| 401 | You can find information on how to submit later in this chapter.</para></listitem> | ||
| 402 | </itemizedlist> | ||
| 403 | </para> | ||
| 404 | </section> | ||
| 405 | |||
| 406 | <section id='tracking-bugs'> | ||
| 407 | <title>Tracking Bugs</title> | ||
| 408 | |||
| 409 | <para> | ||
| 410 | The Yocto Project uses Bugzilla to track bugs. | ||
| 411 | This bug-tracking application works well for group development because it tracks bugs and code | ||
| 412 | changes, can be used to communicate changes and problems with developers, can be used to | ||
| 413 | submit and review patches, and can be used to manage quality assurance. | ||
| 414 | You can find a good overview of Bugzilla <ulink url='http://www.bugzilla.org/about/'>here</ulink>. | ||
| 415 | </para> | ||
| 416 | |||
| 417 | <para> | ||
| 418 | Sometimes it is helpful to submit, investigate, or track a bug against the Yocto Project itself. | ||
| 419 | While normally this is a process relevant only to Yocto Project developers, you can find information | ||
| 420 | for Bugzilla configuration and bug tracking procedures specific to the Yocto Project | ||
| 421 | <ulink url='https://wiki.yoctoproject.org/wiki/Bugzilla_Configuration_and_Bug_Tracking'>here</ulink>. | ||
| 422 | </para> | ||
| 423 | |||
| 424 | <para> | ||
| 425 | The Yocto Project uses its own version of the Bugzilla application. | ||
| 426 | You can find the home page <ulink url='http://bugzilla.yoctoproject.org'>here</ulink>. | ||
| 427 | You need to use this implementation of Bugzilla when logging a defect against anything released | ||
| 428 | by the Yocto Project team. | ||
| 429 | </para> | ||
| 430 | |||
| 431 | <para> | ||
| 432 | Here are some things to remember when dealing with bugs against the Yocto Project: | ||
| 433 | <itemizedlist> | ||
| 434 | <listitem><para>The Yocto Project follows a naming bug-naming convention: | ||
| 435 | <filename>[YOCTO <number>]</filename>, where <filename><number></filename> is the | ||
| 436 | assigned defect ID used in Bugzilla. | ||
| 437 | So, for example, a valid way to refer to a defect when creating a commit comment | ||
| 438 | would be <filename>[YOCTO 1011]</filename>. | ||
| 439 | This convention becomes important if you are submitting patches against the Yocto Project | ||
| 440 | code itself (see the next section “How to Submit a Change”).</para></listitem> | ||
| 441 | <listitem><para>Defects for Yocto Project fall into one of four classifications: Yocto Projects, | ||
| 442 | Infrastructure, Poky, and Yocto Metadata Layers.</para></listitem> | ||
| 443 | </itemizedlist> | ||
| 444 | </para> | ||
| 445 | </section> | ||
| 446 | |||
| 447 | <section id='how-to-submit-a-change'> | ||
| 448 | <title>How to Submit a Change</title> | ||
| 449 | |||
| 450 | <para> | ||
| 451 | During the development process it is necessary to submit your changes to the maintainer | ||
| 452 | of the project. | ||
| 453 | Furthermore, in a collaborative environment it is necessary to have some sort of standard | ||
| 454 | or method through which you submit changes. | ||
| 455 | Otherwise, things would get quite chaotic. | ||
| 456 | </para> | ||
| 457 | |||
| 458 | <para> | ||
| 459 | Sometimes you might find it necessary to submit a change or patch to the Yocto Project. | ||
| 460 | If so, you must follow certain procedures. | ||
| 461 | In particular, the headers in patches and the commit messages must follow a certain standard. | ||
| 462 | The general process is the same as described earlier in this section. | ||
| 463 | For complete details on how to create proper commit messages and patch headers see | ||
| 464 | [WRITER NOTE: I need the link to Mark's wiki page here that describes the process.] | ||
| 465 | </para> | ||
| 466 | |||
| 467 | <para> | ||
| 468 | Following are general instructions for both pushing changes upstream and for submitting changes as patches. | ||
| 469 | </para> | ||
| 470 | |||
| 471 | <section id='pushing-a-change-upstream'> | ||
| 472 | <title>Pushing a Change Upstream</title> | ||
| 473 | |||
| 474 | <para> | ||
| 475 | The basic flow for pushing a change to an upstream contrib repository is as follows: | ||
| 36 | <itemizedlist> | 476 | <itemizedlist> |
| 37 | <listitem><para><ulink url='http://ldn.linuxfoundation.org/book/1-a-guide-kernel-development-process'></ulink></para></listitem> | 477 | <listitem><para>Make your changes in your local repository.</para></listitem> |
| 38 | <listitem><para><ulink url='http://userweb.kernel.org/~akpm/stuff/tpp.txt'></ulink></para></listitem> | 478 | <listitem><para>Stage your commit (or change) by using the <filename>git add</filename> |
| 39 | <listitem><para><ulink url='http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/HOWTO;hb=HEAD'></ulink></para></listitem> | 479 | command.</para></listitem> |
| 480 | <listitem><para>Commit the change by using the <filename>git commit</filename> | ||
| 481 | command and push it to an upstream contrib repository. | ||
| 482 | Be sure to provide a commit message that follows the project’s commit standards.</para></listitem> | ||
| 483 | <listitem><para>Notify the maintainer that you have pushed a change.</para></listitem> | ||
| 40 | </itemizedlist> | 484 | </itemizedlist> |
| 41 | <para> | 485 | You can find detailed information on how to push a change upstream |
| 42 | You can find more information on Yocto Project by visiting the website at | 486 | <ulink url='http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#Developing-With-git'> |
| 43 | <ulink url='http://www.yoctoproject.org'></ulink>. | 487 | here</ulink>. |
| 44 | </para> | 488 | </para> |
| 45 | </para> | 489 | </section> |
| 490 | |||
| 491 | <section id='submitting-a-patch'> | ||
| 492 | <title>Submitting a Patch</title> | ||
| 493 | |||
| 494 | <para> | ||
| 495 | If you have a just a few changes you can commit them and then submit them as an email to the maintainer. | ||
| 496 | Here is the general procedure: | ||
| 497 | <itemizedlist> | ||
| 498 | <listitem><para>Make your changes in your local repository.</para></listitem> | ||
| 499 | <listitem><para>Stage your commit (or change) by using the <filename>git add</filename> | ||
| 500 | command.</para></listitem> | ||
| 501 | <listitem><para>Commit the change by using the <filename>git commit</filename> command. | ||
| 502 | Be sure to provide a commit message that follows the project’s commit standards.</para></listitem> | ||
| 503 | <listitem><para>Format the commit by using the <filename>git-format-patch</filename> | ||
| 504 | command. | ||
| 505 | This step produces a numbered series of files in the current directory – one for | ||
| 506 | each commit.</para></listitem> | ||
| 507 | <listitem><para>Import the files into your mail client by using the | ||
| 508 | <filename>git-send-email</filename> command.</para></listitem> | ||
| 509 | <listitem><para>Send the email by hand to the maintainer.</para></listitem> | ||
| 510 | </itemizedlist> | ||
| 511 | Be aware that there could be protocols and standards that you need to follow for your particular | ||
| 512 | project. | ||
| 513 | You can find detailed information on the general process | ||
| 514 | <ulink url='http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#sharing-development'> | ||
| 515 | here</ulink>. | ||
| 516 | </para> | ||
| 517 | </section> | ||
| 46 | </section> | 518 | </section> |
| 47 | 519 | ||
| 48 | 520 | ||
| @@ -51,6 +523,15 @@ | |||
| 51 | 523 | ||
| 52 | 524 | ||
| 53 | 525 | ||
| 526 | |||
| 527 | |||
| 528 | |||
| 529 | |||
| 530 | |||
| 531 | |||
| 532 | |||
| 533 | |||
| 534 | |||
| 54 | </chapter> | 535 | </chapter> |
| 55 | <!-- | 536 | <!-- |
| 56 | vim: expandtab tw=80 ts=4 | 537 | vim: expandtab tw=80 ts=4 |
