通过CVS获取源码

  • 版本网址缩略名: 通过CVS获取源码
  • 版本标题: 通过CVS获取源码
  • 版本 id: 247060
  • 创建于:
  • 创建者: phenix
  • 是否是当前版本?
  • 评论 49 words added

修订内容

Note: This document descibes how to get source code for older versions of the code, Gecko 1.9.0, Firefox 3 or earlier, and all versions of NSS and NSPR. Development for Gecko 1.9.1/Firefox 3.5 and beyond uses the Mercurial source code control system.

Those doing active development can check out the latest source using CVS. This is the preferred method if you plan to provide patches and fix bugs, as it lets you get up-to-the-minute changes and merge them with your own.

If you want to compile a product for release, it is generally better to Download Mozilla Source Code tarballs.

{{ :cn/Build_Documentation/TOC() }}

Getting Started

CVS means "Concurrent Versioning System". To learn more about CVS in general, visit ximbiot.com, or read the tutorial.

Anyone can check out (also known as "pull" or "download") the sources via CVS, but only certain people have the ability to check in (make changes, also known as "commit"). Those people are the module owners and their delegates. Read our document on hacking mozilla to find out how to get the ability to check in. You may also wish to read about using SSH to connect to CVS.

While a {{ Anch("Full CVS Checkout") }} is also possible, it is not recommended; it puts undue strain on the mozilla cvs server, and should really be avoided unless you know what you are doing, and need it.

Requirements

To check out the sources, you need to be running CVS 1.11 or later. Furthermore, you must use GNU make to check out and build Mozilla. No other "make" program is acceptable. On windows, mac and regular GNU systems (like GNU/Linux), use "make" to run GNU make; on most non-GNU unixes (like e.g. Solaris, etc.), use "gmake".

CVS Client Settings

The "cvsroot" (repository identification string) used for anonymous access to Mozilla CVS is

:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

To start using CVS you must first log in. Run the following command:

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
# type the password anonymous

If you are using an IDE, use the following server data:

  • host: "cvs-mirror.mozilla.org"
  • repository path: "/cvsroot"
  • user: "anonymous"
  • password: "anonymous"
  • connection type: pserver
  • port: default (2401)

Selecting a Project to Pull

Since several different applications are built from the same basic source code, you must choose which application to checkout on the command line using the MOZ_CO_PROJECT variable. This information has to be supplied when it comes to the checkout of the actual source code (see the appropriate checkout section below, according to the branch you want to checkout). The possible options include the following:

suite 
The traditional "Mozilla" SeaMonkey suite of browser, mail/news, composer, and other applications.
browser 
The standalone "Firefox" browser.
mail 
The standalone "Thunderbird" mail/news client.
composer 
The standalone HTML composer
calendar 
The standalone "Sunbird" calendar app.
xulrunner 
The next-generation XUL application launcher.
macbrowser 
The "Camino" native browser for Macintosh.
all 
Check out sources for all of the above projects

Multiple projects can be specified with commas: MOZ_CO_PROJECT=suite,browser,xulrunner.

Note that if you are using a custom .mozconfig file, you can also specify MOZ_CO_PROJECT there, instead of including it on the command line.

Checking Out a New Source Tree

Check Tinderbox

Before pulling a tree, you should always check the appropriate Tinderbox to make sure that the codebase is not broken. If there are red tinderboxes, it is usually advisable to wait until they are green before pulling a tree.

Branch HEAD

To check out a new source tree from scratch, get the client.mk file which contains makefile instructions which are used to pull the rest of the tree:

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk

Note: if you have already set up a .mozconfig file, you may also need to check out the following files:

Firefox 
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/browser/config/mozconfig
Thunderbird 
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/mail/config/mozconfig

Specific Branch

If you want to check out the source code of a specific CVS branch, use

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r BRANCH mozilla/client.mk

instead. To, for example, pull the Firefox 1.5 development branch, replace BRANCH above with MOZILLA_1_8_BRANCH. For available branch tags in Mozilla, see CVS Tags.

The information on pulling project specific .mozconfig files as listed in the previous section apply to other branches than HEAD as well of course.

Checkout

After having chosen the correct branch, run:

$ cd mozilla
$ make -f client.mk checkout MOZ_CO_PROJECT=option,option

As mentioned above, if you are using a custom .mozconfig file where you have already specified the MOZ_CO_PROJECT variable, you do not need to repeat it here on command line.

Updating a Source Tree

Branch HEAD

In order to update a source tree (being it branch HEAD or a specific branch) to latest branch HEAD, run:

$ cd mozilla
$ cvs up -dA client.mk

The -d option adds directories missing from the local tree, i.e. if new directories were introduced on the central repository but were not yet mirrored on the local copy. The -A option removes any "sticky branch" information, which leads to the effect that the tree is updated to HEAD. If you have modified any files on your local tree, but want them to be discarded, simply add the -C option. This overwrites any local chanages.

Specific Branch

To update a source tree which was pulled from a specific branch, use

$ cd mozilla
$ cvs up -dr BRANCH client.mk

instead. Replace BRANCH by the tag of the branch you want to update. Options -d and -C can be applied as well.

Checkout

After having specified the update, you can do the checkout:

$ make -f client.mk checkout MOZ_CO_PROJECT=option,option

As always, if you use a custom .mozconfig file where MOZ_CO_PROJECT is already defined, you do not need to repeat it on command line.

Creating a Diff File

In order to create a diff of a single local file against the current file in the repository, use:

$ cvs diff -u8p FILENAME

See Creating a patch for more information.

Converting a Downloaded Source Tree

Downloaded source trees from mozilla.org (source tarballs) are already set up with CVS information, like a normal checkout. You can update these trees like normal trees to the latest code, without special action. See previous section on how to update a source tree.

Full CVS Checkout

While a full checkout is possible, it should really be avoided, and is NOT needed to build any one mozilla client, and really, is not needed to build any combination of clients (considering the webtools/ directory is included). Unless you absolutely know what you are doing, and why you are doing it, this should be avoided at all costs, never-the-less instructions for "how" are included here for completeness

To checkout the entire mozilla source tree (~700MB) run this command (-P option added to not checkout empty directories):

cvs -d -P :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot checkout mozilla

interwiki link

 

{{ languages( { "en": "en/Mozilla_Source_Code_(CVS)", "es": "es/C\u00f3digo_fuente_de_Mozilla_(CVS)", "fr": "fr/Obtenir_le_code_source_de_Mozilla_via_CVS", "ja": "ja/Mozilla_Source_Code_(CVS)" } ) }}

修订版来源

<div class="breadcrumbs"><a href="/cn" title="cn">首页</a>&gt; <a href="/cn/%E7%BC%96%E8%AF%91%E6%89%8B%E5%86%8C" title="cn/编译手册">编译手册</a>&gt; 通过CVS获取源码</div>
<div class="note">Note: This document descibes how to get source code for older versions of the code, Gecko 1.9.0, Firefox 3 or earlier, and all versions of NSS and NSPR. Development for Gecko 1.9.1/Firefox 3.5 and beyond uses the <a class="internal" href="/En/Developer_Guide/Source_Code/Mercurial" title="En/Developer Guide/Source Code/Mercurial">Mercurial</a> source code control system.</div>
<p>Those doing active development can check out the latest source using CVS. This is the preferred method if you plan to provide patches and fix bugs, as it lets you get up-to-the-minute changes and merge them with your own.</p>
<p>If you want to compile a product for release, it is generally better to <a href="/cn/Download_Mozilla_Source_Code" title="cn/Download_Mozilla_Source_Code">Download Mozilla Source Code</a> tarballs.</p>
<p>{{ :cn/Build_Documentation/TOC() }}</p>
<h3 name="Getting_Started">Getting Started</h3>
<p>CVS means "Concurrent Versioning System". To learn more about CVS in general, visit <a class="external" href="http://ximbiot.com/cvs/manual/">ximbiot.com</a>, or read the <a class="external" href="http://ximbiot.com/cvs/cvshome/docs/blandy.html">tutorial</a>.</p>
<p>Anyone can check out (also known as "pull" or "download") the sources via CVS, but only certain people have the ability to check in (make changes, also known as "commit"). Those people are the <a class="external" href="http://www.mozilla.org/owners.html">module owners</a> and their delegates. Read our document on <a class="external" href="http://www.mozilla.org/hacking/">hacking mozilla</a> to find out how to get the ability to check in. You may also wish to read about <a class="external" href="http://www.mozilla.org/cvs-ssh-faq.html">using SSH to connect to CVS</a>.</p>
<p>While a {{ Anch("Full CVS Checkout") }} is also possible, it is not recommended; it puts undue strain on the mozilla cvs server, and should really be avoided unless you <strong>know</strong> what you are doing, and need it.</p>
<h4 name="Requirements">Requirements</h4>
<p>To check out the sources, you need to be running <a class="external" href="http://www.nongnu.org/cvs/">CVS</a> 1.11 or later. Furthermore, you must use <a class="external" href="http://www.gnu.org/software/make/">GNU make</a> to check out and build Mozilla. No other "make" program is acceptable. On windows, mac and regular GNU systems (like GNU/Linux), use "make" to run GNU make; on most non-GNU unixes (like e.g. Solaris, etc.), use "gmake".</p>
<h3 name="CVS_Client_Settings">CVS Client Settings</h3>
<p>The "cvsroot" (repository identification string) used for anonymous access to Mozilla CVS is</p>
<pre class="eval">:pserver:<a class=" link-mailto" href="mailto:anonymous@cvs-mirror.mozilla.org" rel="freelink">anonymous@cvs-mirror.mozilla.org</a>:/cvsroot
</pre>
<p>To start using CVS you must first log in. Run the following command:</p>
<pre class="eval">$ cvs -d :pserver:<a class=" link-mailto" href="mailto:anonymous@cvs-mirror.mozilla.org" rel="freelink">anonymous@cvs-mirror.mozilla.org</a>:/cvsroot login
# type the password <em>anonymous</em>
</pre>
<p>If you are using an IDE, use the following server data:</p>
<ul> <li><strong>host</strong>: "cvs-mirror.mozilla.org"</li> <li><strong>repository path</strong>: "/cvsroot"</li> <li><strong>user</strong>: "anonymous"</li> <li><strong>password</strong>: "anonymous"</li> <li><strong>connection type</strong>: pserver</li> <li><strong>port</strong>: default (2401)</li>
</ul>
<h3 name="Selecting_a_Project_to_Pull">Selecting a Project to Pull</h3>
<p>Since several different applications are built from the same basic source code, you must choose which application to checkout on the command line using the <code>MOZ_CO_PROJECT</code> variable. This information has to be supplied when it comes to the checkout of the actual source code (see the appropriate <a href="#Checkout">checkout</a> <a href="#Checkout_2">section</a> below, according to the branch you want to checkout). The possible options include the following:</p>
<dl> <dt>suite </dt> <dd>The traditional "Mozilla" SeaMonkey suite of browser, mail/news, composer, and other applications.</dd> <dt>browser </dt> <dd>The standalone "Firefox" browser.</dd> <dt>mail </dt> <dd>The standalone "Thunderbird" mail/news client.</dd> <dt>composer </dt> <dd>The standalone HTML composer</dd> <dt>calendar </dt> <dd>The standalone "Sunbird" calendar app.</dd> <dt>xulrunner </dt> <dd>The next-generation XUL application launcher.</dd> <dt>macbrowser </dt> <dd>The "Camino" native browser for Macintosh.</dd> <dt>all </dt> <dd>Check out sources for all of the above projects</dd>
</dl>
<p>Multiple projects can be specified with commas: <code>MOZ_CO_PROJECT=suite,browser,xulrunner</code>.</p>
<p><strong>Note</strong> that if you are using a custom <code><a href="/cn/%E9%85%8D%E7%BD%AE%E7%BC%96%E8%AF%91%E9%80%89%E9%A1%B9#Using_a_.mozconfig_Configuration_File" title="cn/配置编译选项#Using_a_.mozconfig_Configuration_File">.mozconfig</a></code> file, you can also specify <code>MOZ_CO_PROJECT</code> there, instead of including it on the command line.</p>
<h3 name="Checking_Out_a_New_Source_Tree">Checking Out a New Source Tree</h3>
<h4 name="Check_Tinderbox">Check Tinderbox</h4>
<p>Before pulling a tree, you should always check the appropriate <a href="/cn/Tinderbox" title="cn/Tinderbox">Tinderbox</a> to make sure that the codebase is not broken. If there are red tinderboxes, it is usually advisable to wait until they are green before pulling a tree.</p>
<h4 name="Branch_HEAD">Branch HEAD</h4>
<p>To check out a new source tree from scratch, get the <code>client.mk</code> file which contains makefile instructions which are used to pull the rest of the tree:</p>
<pre class="eval">$ cvs -d :pserver:<a class=" link-mailto" href="mailto:anonymous@cvs-mirror.mozilla.org" rel="freelink">anonymous@cvs-mirror.mozilla.org</a>:/cvsroot co mozilla/client.mk
</pre>
<p>Note: if you have already set up a <code><a href="/cn/%E9%85%8D%E7%BD%AE%E7%BC%96%E8%AF%91%E9%80%89%E9%A1%B9#Using_a_.mozconfig_Configuration_File" title="cn/配置编译选项#Using_a_.mozconfig_Configuration_File">.mozconfig</a></code> file, you may also need to check out the following files:</p>
<dl> <dt>Firefox </dt> <dd> <pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/browser/config/mozconfig</pre> </dd> <dt>Thunderbird </dt> <dd> <pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/mail/config/mozconfig</pre> </dd>
</dl>
<h4 name="Specific_Branch">Specific Branch</h4>
<p>If you want to check out the source code of a specific <a class="external" href="http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Branching_and_merging">CVS branch</a>, use</p>
<pre class="eval">$ cvs -d :pserver:<a class=" link-mailto" href="mailto:anonymous@cvs-mirror.mozilla.org" rel="freelink">anonymous@cvs-mirror.mozilla.org</a>:/cvsroot co -r BRANCH mozilla/client.mk
</pre>
<p>instead. To, for example, pull the Firefox 1.5 development branch, replace BRANCH above with MOZILLA_1_8_BRANCH. For available branch tags in Mozilla, see <a href="/cn/CVS_Tags" title="cn/CVS_Tags">CVS Tags</a>.</p>
<p>The information on pulling project specific <code>.mozconfig</code> files as listed in the <a href="#Branch_HEAD">previous section</a> apply to other branches than HEAD as well of course.</p>
<h4 name="Checkout">Checkout</h4>
<p>After having chosen the correct branch, run:</p>
<pre class="eval">$ cd mozilla
$ make -f client.mk checkout MOZ_CO_PROJECT=<em>option,option</em>
</pre>
<p>As mentioned above, if you are using a custom <code>.mozconfig</code> file where you have already specified the <code>MOZ_CO_PROJECT</code> variable, you do not need to repeat it here on command line.</p>
<h3 name="Updating_a_Source_Tree">Updating a Source Tree</h3>
<h4 name="Branch_HEAD_2">Branch HEAD</h4>
<p>In order to update a source tree (being it branch HEAD or a specific branch) to latest branch HEAD, run:</p>
<pre class="eval">$ cd mozilla
$ cvs up -dA client.mk
</pre>
<p>The -d option adds directories missing from the local tree, i.e. if new directories were introduced on the central repository but were not yet mirrored on the local copy. The -A option removes any "sticky branch" information, which leads to the effect that the tree is updated to HEAD. If you have modified any files on your local tree, but want them to be discarded, simply add the -C option. This overwrites any local chanages.</p>
<h4 name="Specific_Branch_2">Specific Branch</h4>
<p>To update a source tree which was pulled from a specific branch, use</p>
<pre class="eval">$ cd mozilla
$ cvs up -dr BRANCH client.mk
</pre>
<p>instead. Replace BRANCH by the tag of the branch you want to update. Options -d and -C can be applied as well.</p>
<h4 name="Checkout_2">Checkout</h4>
<p>After having specified the update, you can do the checkout:</p>
<pre class="eval">$ make -f client.mk checkout MOZ_CO_PROJECT=<em>option,option</em>
</pre>
<p>As always, if you use a custom <code>.mozconfig</code> file where <code>MOZ_CO_PROJECT</code> is already defined, you do not need to repeat it on command line.</p>
<h3 name="Creating_a_Diff_File">Creating a Diff File</h3>
<p>In order to create a diff of a single local file against the current file in the repository, use:</p>
<pre class="eval">$ cvs diff -u8p FILENAME
</pre>
<p>See <a href="/cn/Creating_a_patch" title="cn/Creating_a_patch">Creating a patch</a> for more information.</p>
<h3 name="Converting_a_Downloaded_Source_Tree">Converting a Downloaded Source Tree</h3>
<p>Downloaded source trees from mozilla.org (<a href="/cn/Download_Mozilla_Source_Code" title="cn/Download_Mozilla_Source_Code">source tarballs</a>) are already set up with CVS information, like a normal checkout. You can update these trees like normal trees to the latest code, without special action. See previous section on how to update a source tree.</p>
<h3 name="Full_CVS_Checkout">Full CVS Checkout</h3>
<div class="note">While a full checkout is possible, it should really be avoided, and is NOT needed to build any one mozilla client, and really, is not needed to build any combination of clients (considering the webtools/ directory is included). Unless you absolutely know what you are doing, and why you are doing it, this should be avoided at all costs, never-the-less instructions for "how" are included here for completeness</div>
<p>To checkout the entire mozilla source tree (~700MB) run this command (-P option added to not checkout empty directories):</p>
<pre class="eval">cvs -d -P :pserver:<a class=" link-mailto" href="mailto:anonymous@cvs-mirror.mozilla.org" rel="freelink">anonymous@cvs-mirror.mozilla.org</a>:/cvsroot checkout mozilla
</pre>
<p><span class="comment">interwiki link</span></p>
<p> </p>

<p>{{ languages( { "en": "en/Mozilla_Source_Code_(CVS)", "es": "es/C\u00f3digo_fuente_de_Mozilla_(CVS)", "fr": "fr/Obtenir_le_code_source_de_Mozilla_via_CVS", "ja": "ja/Mozilla_Source_Code_(CVS)" } ) }}</p>
恢复到这个版本