Archive:Getting Started/Sources/Snapshots (zh CN): Difference between revisions

From KDE TechBase
No edit summary
No edit summary
Line 18: Line 18:
== 获取镜像 ==
== 获取镜像 ==


First go to [http://download.kde.org/ The KDE Mirror Redirector] and choose the best FTP server for your location.  Usually this will be a server in your country/state.  Click on the link for the FTP server and navigate to the {{path|snapshots}} directory.  In this directory will be a large list of KDE modules which are archived.
首先,到[http://download.kde.org/ KDE 镜像地址]选择对你所在的地域来说最快的 FTP 服务器。通常都是位于你自己的国家/州。点击你所选择的 FTP 服务器的链接并进入{{path|snapshots}}文件夹。在此文件夹是的大量 KDE 模块存档列表。


You want to download the module with the name in the following format: '''kdemodule-svn.tar.bz2'''.  Go ahead and save this archive to your hard disk somewhere.  You'll need to be able to reach this location from the command line later.
你想要下载的模块是以下面样式命名的:'''kdemodule-svn.tar.bz2'''。保存这个存档到你本地的磁盘上。稍后,你可以从命令行到达此位置。


{{note|It is important to get the module with the '''-svn''' in the file name.  There are other types of snapshots also in the same directory for each module.  But only modules with '''-svn''' contain the necessary information to allow for completing a checkout.}}
{{note|获取模块文件名字中带有 '''-svn''' 字样的文件很重要。同一个目录下每个模块还有一些其他类型得快照。但是只有带有 '''-svn''' 字样的模块才包含允许完成同步的必要信息。}}


== The Recipe ==
== 具体方法 ==


Now for the checkout, go ahead and open a terminal shell and perform the following steps:
现在开始同步的具体操作,先打开一个终端执行以下步骤:


  cs # [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|cs is not a typo]]
  cs # [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|cs 不是一个错误]]#译者注:cs不是错误,是先前提到的 .bashrc 中定义的函数
  tar xvjf /path/to/kdemodule-svn.tar.bz2
  tar xvjf /path/to/kdemodule-svn.tar.bz2  
  cd kdemodule
  cd kdemodule
  svn revert -R . # This step restores the missing files.
  svn revert -R . # 这一步重新存储丢失的文件。
  svn up          # This step updates the source to the latest code, and is optional.
  svn up          # 这一步是更新源程序到最新的代码,是可选操作。


== Extra Tidbits ==
== 额外补充 ==


That's itYou've got a valid KDE module checkout now.  Some things to keep in mind:
就是它了你已经完成了一次有效的 KDE 模块同步。但是,还请记住以下事项:
 
* Each module snapshot contains a special README.svn-nightly file containing information on how to use the snapshot.  You've already performed the svn revert and update steps.
* The modules are already setup to update from the KDE anonymous Subversion repository (svn://anonsvn.kde.org/).  If this is not correct for you (i.e. you're a developer), then you can use the svn switch command to fix the checkout as described in the README.svn-nightly file.
** Switch to the module source directory (cs <moduleName>)
** If you use Subversion over SSH, run '''svn switch --relocate svn://anonsvn.kde.org svn+ssh://<user>@svn.kde.org'''
** If you use Subversion over HTTPS, run '''svn switch --relocate svn://anonsvn.kde.org <nowiki>https://<user>@svn.kde.org</nowiki>'''
** (The way this works is that <tt>svn switch --relocate</tt> rewrites the Subversion metadata in the module, replacing the first substring (svn://anonsvn.kde.org) in the repository URL with the second substring (svn+ssh: or https:).  This is done locally without any contact to the repository required.
* If you want to keep the module up to date in the future, just run svn up as you would for any other Subversion checkout.  You do not have to continue downloading snapshots just to update the module, and to do so would be inefficient and slow.


* 每一个模块都包含一个特殊的 README.svn-nightly 文件,里面包含有怎样使用快照的方法。 你已经完成了 svn 的还原和更新步骤。
* 各个模块都已经建立了从 KDE 匿名 Subversion 仓库进行的更新(svn://anonsvn.kde.org/)。如果这不适合你,  (也就是说你是位开发者),你可以按照 README.svn-nightly 文件所说的使用 svn switch 命令来修改你的同步操作。
** 转移到模块源文件目录(cs <模块名>)
** 如果你是通过 SSH 来使用 Subversion,运行 '''svn switch --relocate svn://anonsvn.kde.org svn+ssh://<user>@svn.kde.org'''
** 如果你是通过 HTTPS 来使用 Subversion,运行 '''svn switch --relocate svn://anonsvn.kde.org <nowiki>https://<user>@svn.kde.org</nowiki>'''
** (这个方法中起作用的是 <tt>svn switch --relocate</tt>,它改写 Subversion 中模块的元数据,在仓库 URL 中用字符子串(svn+ssh: or https:)替换字符子串(svn://anonsvn.kde.org)。这些在本地就可以直接完成而无须连接仓库。
* 如果你想一直保持模块处于最新版本,你只需要同其他 Subversion 同步一样运行 svn up 就可以了。你不需要一直下载快照来更新你的模块,这样做既慢还没有效率。
[[Category:Build KDE]]
[[Category:Build KDE]]

Revision as of 15:08, 8 July 2008


Getting Started/Sources/Snapshots

使用每日快照中的源代码
Tutorial Series   开始入门
Previous   None
What's Next   [[../../Build/KDE4|构建 KDE4]]
Further Reading   [[../../Sources/Anonymous_SVN|匿名使用 SVN 快速指南]]
[[../../Increased_Productivity_in_KDE4_with_Scripts|在 KDE4 使用脚本来提高效率]]
CMake 简介

如果要同步一个 KDE 模块的源代码,有一个方法可以让原先同步比较慢的过程变快很多,因为 KDE 源代码仓库会自动生成快照,并以方便归档的形式存储在 KDE FTP 服务器上。本页就是描述如何使用模块快照来进行同步。

记住:这些快照都是real Subversion checkouts,包括所有 Subversion 元数据。事实上,此过程是同步一个模块最快的方法,这也要归因于大量的 FTP 镜像。

Note
此过程只有当你所需要的模块是每夜快照生成的(大多数都是这样的)并且是trunk版本,才能正常工作。


获取镜像

首先,到KDE 镜像地址选择对你所在的地域来说最快的 FTP 服务器。通常都是位于你自己的国家/州。点击你所选择的 FTP 服务器的链接并进入snapshots文件夹。在此文件夹是的大量 KDE 模块存档列表。

你想要下载的模块是以下面样式命名的:kdemodule-svn.tar.bz2。保存这个存档到你本地的磁盘上。稍后,你可以从命令行到达此位置。

Note
获取模块文件名字中带有 -svn 字样的文件很重要。同一个目录下每个模块还有一些其他类型得快照。但是只有带有 -svn 字样的模块才包含允许完成同步的必要信息。


具体方法

现在开始同步的具体操作,先打开一个终端执行以下步骤:

cs # cs 不是一个错误#译者注:cs不是错误,是先前提到的 .bashrc 中定义的函数
tar xvjf /path/to/kdemodule-svn.tar.bz2 
cd kdemodule
svn revert -R . # 这一步重新存储丢失的文件。
svn up          # 这一步是更新源程序到最新的代码,是可选操作。

额外补充

就是它了! 你已经完成了一次有效的 KDE 模块同步。但是,还请记住以下事项:

  • 每一个模块都包含一个特殊的 README.svn-nightly 文件,里面包含有怎样使用快照的方法。 你已经完成了 svn 的还原和更新步骤。
  • 各个模块都已经建立了从 KDE 匿名 Subversion 仓库进行的更新(svn://anonsvn.kde.org/)。如果这不适合你, (也就是说你是位开发者),你可以按照 README.svn-nightly 文件所说的使用 svn switch 命令来修改你的同步操作。
  • 如果你想一直保持模块处于最新版本,你只需要同其他 Subversion 同步一样运行 svn up 就可以了。你不需要一直下载快照来更新你的模块,这样做既慢还没有效率。