通过CVS获取源码

翻译正在进行中。

 

那些活跃的开发者可以使用CVS来查看最新的源代码。如果你计划提供补丁和修复bug这是你的首选,因为它可以让你得到最新的更新并且作为你自己的。

如果你想编译发布一款产品,一般最好下载Mozilla源代码

开始

CVS"并发版本控制系统"。要想了解更多关于 CVS  通用性欢迎访问 ximbiot.com阅读教程

 

任何人都可以通过 CVS的源代码来Check out (也被称为"拉取"或"下载") ,但只有某些人可信任的人能Check in (进行更改,也被称为"提交")。这些人是模块所有者和他们的代表。阅读我们 hacking mozilla  的文档了解如何获得录入信任。同时你也不妨阅读有关使用 SSH 连接到 CVS

尽管完整的 CVS Checkout可行但并不推荐; mozilla cvs 服务器不应有压力应完全避免除非知道正在做什么和你真正需要

 

要求

要Check out源代码,您需要运行 CVS 1.11 或更高版本。1.12.13版本无法和CVS 服务器一起使用,反而导致挂起,虽然 1.12.9 已知工作正常。此外,您必须使用 GNU make 来Check out和建立 Mozilla。没有其他"make"是程序可以接受的。在 windows、 mac 和周期性的 GNU 系统 (如 GNU/Linux),使用"make"来运行 GNU make;对大多数非 GNU unix (像例如 Solaris, etc.),使用"gmake"。

CVS 客户端设置

"Cvsroot"(存储库标识字符串) 用于匿名访问 Mozilla CVS

:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
开始使用 CVS 前首先要登录运行以下命令:
$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
# type the password anonymous

如果使用 IDE使用以下服务器数据:

  • 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

文档标签和贡献者

向此页面作出贡献: miaoran2015, Pandaren, teoli, ziyunfei, phenix, Mgjbot, Klp99
最后编辑者: miaoran2015,