From Fedora Project Wiki
m (internal link cleaning)
 
(61 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= 什么是 Eclipse Fedora Packager? =
+
{{autolang}}
 +
= 什么是 Fedora Packager for Eclipse? =
  
Eclipse Fedora Packager 是一个 Eclipse 插件。它帮助习惯于使用 IDE (比如 Eclipse IDE)的 Fedora 打包者们在 Eclipse 中完成 Fedora 打包 RPM 的工作,而无须纠结于命令行中(大多数情况 :-))。
+
Fedora Packager for Eclipse 是一个自从 F14 开始为 Fedora 用户设计的 Eclipse 插件。它帮助 Fedora 打包者们在 Eclipse 中完成 Fedora 打包 RPM 的工作,而无须纠结于命令行中(大多数情况)。 可以将 Fedora Packager for Eclipse 认为是 <code>fedpkg</code> 的图形化界面,尽管实际上在后台''并未使用''它。
  
'''Eclipse Fedora Packager 包含的部分功能为:'''
+
首先,安装 Fedora Packager for Eclipse:
 +
<pre>
 +
$ pkcon install eclipse-fedorapackager
 +
</pre>
 +
'''Fedora Packager for Eclipse 包含的部分功能为:'''
 +
* 方便的克隆 Fedora Git 项目
 +
* RPM .spec 文件编辑器,包含语法高亮、自动补全 Requires/BuildRequires 模板的包名、<code>%changelog</code>支持 (快捷键 <Ctrl>+<Alt>+C)等。
 +
* 下载源代码包以及上传新源代码包
 +
* 准备本地构建(仅执行 spec 文件中的 %prep 部分)
 +
* 按照当前 .spec 文件生成 SRPM 包
 +
* 执行本地构建
 +
* 推送至 Koji(Fedora 构建系统)
 +
* Mock 构建
 +
* 推送 Bodhi 更新
 +
* 创建一个本地 Fedora RPM 项目来简化新 Fedora 打包者的入门过程
 +
* Eclipse Git 支持(通过 EGit, 请参考 [http://wiki.eclipse.org/EGit/User_Guide EGit 文档])
 +
 
 +
= 升级至 Fedora Packager for Eclipse 0.2.0=
 +
 
 +
旧版本的 Fedora Packager for Eclipse (0.1.12 及更早) 并未像 Fedora Packager for Eclipse 0.2 一样严格过滤上下文菜单内容的可见性。为了保证上下文菜单中正确的过滤,0.2.0 及更新版本在从 Fedora Git 导入项目时设定了一些固有状态。 这将会影响使用 Fedora Packager for Eclipse 0.1.12 及更早版本导入的项目上下文菜单不显示。注意我们的更新的版本包含了一个用于升级这些项目的小工具。需要的步骤如下:
 +
 
 +
: 1. 打开 Fedora Packaging 视图  '''Window''' => '''Open Perspective''' => '''Other'''.
 +
 
 +
[[Image:OpenFedoraPackagingPerspective.png]]
 +
 
 +
: 2. 点击转换工具图标 (如下图所示)
 +
 
 +
[[Image:ConversionToolIcon.png| Conversion Tool Icon as Shown in the Fedora Packaging Perspective]]
 +
 
 +
: 3. 在您的工作空间中选择需要升级的项目
 +
 
 +
[[Image:SelectProjectsToConvert.png]]
 +
 
 +
: 4. 点击 '''OK''' 然后此时您选择的项目应该已经升级完毕了。
 +
 
 +
在以上步骤之后,Fedora Packager for Eclipse 的上下文菜单应该可以正常显示了。
 +
 
 +
如果您已经是维护者并且知道怎样为 Fedora 打包软件包的话,请 [[#使用 Fedora Packager for Eclipse | 跳转到"使用 Fedora Packager for Eclipse" 章节]]。
 +
 
 +
= 以维护者的身份创建新的 Fedora 软件包 =
 +
 
 +
如果您之前从未给 Fedora 打包过软件,该指南将指引您直到完成首次软件包的提交。
 +
[[Image:FedoraPackageProcess.png|fedora package process]]
 +
 
 +
== 以新贡献者的身份创建帐号 ==
 +
如果您是新的软件包维护者:
 +
=== 在 Fedora 账户系统中创建账户 ===
 +
* 第一步是在 [https://admin.fedoraproject.org/accounts Fedora 账户系统 (FAS)] 中创建账户。
 +
* 点击 '''新账户''' 并填写空白处。
 +
* 在创建账户之后,请确定签署了 CLA (如果您点击右上角的 '''我的帐户''' 链接的话,您应该看到 <code>CLA: CLA Done</code>)。
 +
* 您同时需要上传一个<code>RSA SSH 公钥</code>。您需要匹配的私钥来通过 SSH 访问 Fedora 远程主机。
 +
** 这里有[http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-keygen 创建 SSSH 密钥creating SSH key] 的信息。
 +
 
 +
=== 创建 Bugzilla 账户===
 +
在 [https://bugzilla.redhat.com/createaccount.cgi 红帽 bugzilla] 创建账户。
 +
* 对于所有的 Fedora 打包工作,您在 bugzilla 账户中使用的电子邮件地址应该和在 ''Fedora 账户系统'' 中的一致。
 +
* 为了让您的工作和错误追踪更加简便,有一个适用于 Eclipse 的任务管理插件叫 '''Mylyn'''。您可以根据这里的指导[[Eclipse_How_to_Maintain_Fedora_Package_User_Guide/mylyn_bugzilla|将您的 bugizlla 账户和您 Eclipse Mylyn 插件整合起来]]。
 +
 
 +
=== 初始设定 ===
 +
 
 +
对于新打包者或者在未包含所需 FAS 证书的机器上只需要执行一次。如果确认已经完成过此设置并且正常的话,可以跳过此步骤。下面的步骤解释如何为 [https://admin.fedoraproject.org/accounts/ FAS 账户] 设定这些证书。<br/>
 +
 
 +
* 首先,安装 <code>fedora-packager</code> RPM 包:
 +
 
 +
<pre>  pkcon install fedora-packager </pre>
 +
 
 +
然后运行以下命令并根据提示操作:
 +
 
 +
<pre> fedora-packager-setup </pre>
 +
 
 +
如果您已经是维护者并且知道怎样为 Fedora 创建新软件包,请 [[#使用 Fedora Packager for Eclipse| 跳过下个章节]]。
 +
 
 +
== 制作软件包 ==
 +
=== 打包指南 ===
 +
* 如果您不知道如何创建一个 RPM 软件包的话,请参考[[A_Short_RPM_Tutorial|简明 RPM 教程]] 或者更高级及包含更多细节的[[How_to_create_an_RPM_package|如何创建一个软件包]]。
 +
* 确定是一个新软件包。检查[https://admin.fedoraproject.org/pkgdb/acls/list/ 已有软件包列表]。
 +
* 确定软件包是合适的。阅读[[Packaging:Guidelines|打包指南]] 和 [[Packaging:NamingGuidelines|打包命名指南]]。
 +
* 阅读其他一些软件包的提交来更过的了解打包,并熟悉流程和需求。其中一个方式是加入[https://admin.fedoraproject.org/mailman/listinfo/package-review package-review@lists.fedoraproject.org] 邮件列表。
  
* 方便的 Git 克隆和分支切换
+
=== 创建一个 RPM 软件包: ===
* 包含语法高亮、自动补全、更新日志完善的 RPM Spec 文件编辑器(快捷键 <Ctrl>+<Alt>+C)
+
要开始使用 Eclipse 创建一个 RPM 软件包,完成[[#创建本地 _Fedora_RPM_项目|创建 本地Fedora 打包项目用户指南]]中的步骤。
* 下载代码包以及上传新代码包
+
注意您可以使用时那面三种方式之一生成您的项目:
* 准备本地编译(仅执行 spec 文件中的 %prep 部分)
+
: 1. [[#4.a._开始一个空白项目|开始一个空白项目]] 使用 .spec 文件模版或许现有的 .spec 文件
* 按照当前 Spec 文件生成 SRPM
+
: 2. 通过导入已有 SRPM 文件[[#4.b._通过导入 SRPM 文件使用已有 .spec 文件和代码|提取 .spec 文件和资源]]到项目中。
* 执行本地编译
+
: 3. 在 <code>feature.xml</code> 或 <code>pom.xml</code> 中[[#4.c._使用 RPM Stubby 创建项目|使用 RPM Stubby]]。
* 推送至 Koji(Fedora 编译系统)
+
在您创建项目后,您可以通过[[#本地菜单|本地上下文菜单]]来执行可用的 rpm 构建命令进行打包和创建 SRPM 文件。
* Mock 编译
+
在下一步中您需要提交您的 .spec 文件和你的 SRPM 文件去审核。
* 推送 Bodhi 更新
+
 
* Eclipse Git 支持(通过 EGit, 请参考 EGit 文档)
+
== 提交审核 ==
 +
=== 使用 Fedora 邮件列表介绍介绍自己 ===
  
Eclipse Fedora Packager 自 F14 对于所有 Fedora 用户可用。想要尝试?使用如下命令来安装:
+
当一个新的软件包维护者加入 Fedora 项目时,我们要求他/她[[Staying_close_to_upstream_projects|和上游项目保持紧密联系]]。可以通过在[https://admin.fedoraproject.org/mailman/listinfo/devel devel@lists.fedoraproject.org]邮件列表介绍自己的方式告知开发者您正在打包某软件。<br/>
 +
要注册列表,请访问 devel 列表注册页面。
 +
* 这样子的主要目的是通过了解软件包维护者来开始构建信任的过程,并增加您审核请求被及时处理的可能性。
 +
* 这所有的目的是在于打破匿名性从而在项目中培养真实世界的社区。您并不需要透露任何个人秘密。目标只是在您和其他项目成员中构建一定水平上的信任。
 +
: ''Subject:'' Self Introduction 自我介绍
 +
: ''Body:'' 添加任何您认为合适的信息,包括过往经历,以及指向您提交审核请求的连接和一个简短的自我介绍。如果愿意的话也可以附上您的 GPG 公钥信息。
 +
* 这里有一些您[[Join_the_package_collection_maintainers#Join_the_important_Mailing_Lists|可能愿意加入的邮件列表]]信息。以及一份  [[Category:Packaging_SIGs|Fedora 打包特别兴趣小组]]列表。
  
<pre>
+
=== 上传软件包 ===
$ pkcon install eclipse-fedorapackager
+
将您的 SRPM 和 .spec 文件上传到互联网某处,任意一个可以通过 URL 访问的地址即可。
 +
* 如果您需要主机空间,请在提交的 Ticket 中注明,之后会有人联系您并处理的。
 +
* 如果您已经有一个 Fedora 账户,那么您可以使用位于 <code><user-name>.fedorapeople.org</code> 的空间。
 +
样例:
 +
<pre>  scp path/to/file.spec path/to/rpm-file.src.rpm <user-name>.fedorapeople.org:public_html </pre>
 +
<code>file.spec</code> 和 <code>rpm-file.src.rpm</code> 将可以使用以下 URL 访问:
 +
<pre>  http://<user-name>.fedorapeople.org/file.spec
 +
  http://<user-name>.fedorapeople.org/rpm-file.src.rpm
 
</pre>
 
</pre>
  
= 使用 Eclipse Fedorapackager =
+
=== 创建审核请求 ===
 +
在提交您的请求之前,请确保没有之前没有为同一个软件包提交的请求。<br/>
 +
在 [https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review bugzilla] 中填写表格。
 +
:1. 确认您将软件包名(除去版本和发布号)填入 ''Review Summary'' 区域,以及描述软件包是什么的简述。
 +
:2. 将您的软件包说明(通常,这跟您在 spec <code>%description</code> 中的内容是一致的。)填入''Review Description'' 区域。
 +
:3. 获取成员许可:如果这是您首个软件包,或者是上传更新版本软件包的新维护者,请说明您需要一个许可人(您需要许可才能提交和构建您的软件包)。要获得许可,请输入在 ''Blocks'' 区域输入 '''FE-NEEDSPONSOR'''。
 +
:: 许可并不是自动的,他或许需要您更多的参与来展现自己的确熟悉了打包指南。
 +
:: 获得许可的关键是使得一个具有许可等级的现有成员相信您已经理解并遵循了项目指南和流程。
 +
:: 更多内容请查阅这篇[[How_to_get_sponsored_into_the_packager_group|如何获得许可]]用户指南。
 +
 
 +
[[Image:BugzillaForm.png|Bugzilla Form]]
 +
 
 +
:4. 包含指向您 SRPM 和 .spec 文件的 URL。
  
从 Fedora 14 开始, Fedora 使用 Git 版本控制系统来跟踪需要打包的文件。参阅 [https://fedoraproject.org/wiki/Dist_Git_Project dist-git 文档] 来深入了解 dist-git 的信息。幸运的是,dist-git 如何工作对于使用 Eclipse Fedora Packager plug-in 并不重要。和以往的 CVS 相比,Git 只是采取了略有不同的途径去完成打包工作。
+
[[Image:BugzillaReview.png|Bugzilla Review]]
  
== 初始设定 ==
+
=== Bugzilla 反馈 ===
 +
* 您应该可以通过邮件得到通知提醒。修复审核者指出的任何障碍性问题。
  
这一步对于使用未设定 FAS 证书的新打包者只需要完成一次。如果确认已经完成过此设置并且正常的话,可以跳过此步骤。下面的步骤解释如何为[https://admin.fedoraproject.org/accounts/ FAS account] 设定这些证书。
+
== 准备分发 ==
 +
如果您的软件包审核通过了,请遵循如下步骤。
 +
=== 请求一个新软件包 SCM ===
 +
一旦软件包通过审核者批准,那么就可以请求一个 Git 模块和分支,包含位于[[Package_SCM_admin_requests|源代码管理(SCM) 请求]]上的信息。
 +
* 需要包管理员批准的请求可以通过在 Bugzilla 标签上标注 fedora-cvs 实现。在 Bugzilla 报告中变更 fedora-cvs 标注为 '''"?"''' 表明需要管理员的关注。
 +
* 表明您需要包含软件包的分支名字。
  
首先,安装 <code>fedora-packager</code> RPM 包:
+
[[Image:PackageSCMRequest.png|Package SCM Request]]
  
<pre>
+
=== Fedora Packager 导入向导  ===
$ pkcon install fedora-packager
+
一旦 Fedora Git 仓库为您创建完成,就可以导入到  Eclipse 中。
</pre>
+
 
 +
*  使用 '''File''' > '''Import''' > '''Git''' > '''Projects from Fedora Git''' (或者使用键盘快捷键 <code>CTRL+ALT+F I</code>) 并在提示窗口输入软件包名。这将克隆您所需的 Git 仓库。 参考位于 [[Using_Fedora_GIT|使用 Fedora Git]] 的用户指南来获得更多信息。
 +
* 为方便起见,''Git Repositories view'' 会在克隆过程完成后打开。 <br/><br/>
 +
 
 +
[[Image:ImportFedoraGit.png|Fedora Git Import]]<br/><br/>
 +
 
 +
* 这就是 Fedora Git 导入对话框的样子。下一步,指定需要为您准备的软件包名。<br/><br/>
 +
 
 +
[[Image:SelectPackageNameGit.png|Select Package Name]]<br/><br/>
 +
 
 +
* 因为您将要克隆的是新的空白 Git 仓库,所以您在软件包目录只会看到 '''sources''' 文件。
 +
 
 +
== 更新 SCM ==
 +
=== 导入并提交软件包内容 ===
 +
当你导出空白 Git 模块完成后,您需要导入并提交您的软件包内容到主分支。
 +
: 1. 右键点击您 Eclipse 本地 RPM 项目的  SOURCES 文件夹并选择 '''Copy'''。
 +
: 2. 右键点击您从 Fedora Git 克隆来的项目并选择 '''Paste'''。
 +
: 3. 要上传上游的源代码文件到后备缓冲区,右键点击它们,选择 '''Fedora Packager''' > '''Upload this File''' > '''Add to Existing Sources'''。这将添加文件到构建软件包所需文件的列表中。 使用 '''Fedora Packager''' > '''Upload this File''' > '''Replace Sources''' 来替换当前的 '''SOURCES''' 内容并添加一行选中文件的 MD5 校验和。更多关于后备缓冲区的信息可以在 [[Package_Source_Control#Lookaside_Cache|这个文档]]找到。
 +
{{admon/caution|注意!| 不要添加上游源代码 (tar 包、zip 文件等) 到 Fedora Git 仓库。请转而使用后备缓冲区!}}
 +
: 4. 对在 SPECS 文件夹的 .spec 文件重复步骤<b>1-2</b>。
 +
: 5. 要提交软件包内容到 Git 仓库,右键点击要提交的 '''SOURCE''' 文件和 '''.spec''' 文件 (或者选择 Fedora Git 项目并在提交对话框出现时选择需要的 ''unstaged'' 文件),选择 '''Team''' > '''Commit...'''。
 +
* 当您初次提交时使用如下信息: "<code>Initial import (#nnnnnn)</code>" (nnnnnn 代表您在 Bugzilla 中的软件包审核号)。
 +
{{admon/caution|注意!| Fedora Packager for Eclipse won't let you to upload your .spec file or any other patches except your sources (tar balls, zip files, etc.) to the Fedora Git repository!}}
 +
 
 +
=== 构建软件包 ===
 +
* 现在您可以使用 Fedora Packager 的功能来[[#本地构建软件包| 在本地构建您的软件包]]。
 +
 
 +
=== 关闭 Bugzilla Ticket ===
 +
* 如果您的软件包构建成功了,那么请将其按照'''NEXTRELEASE''' 关闭。
 +
 
 +
=== 更新您的软件包 ===
 +
一旦您完成本地构建软件包,您可以遵循以下步骤来更新您的软件包:
 +
: [[#公开本地提交的更改(Git 推送)  | 公开本地提交的更改]]
 +
: [[#推送到 Koji 构建  | 推送到 Koji 构建]]
 +
: [[#推送 Bohi 更新 | 推送 Bohi 更新]] (可选)
 +
* 要确保您的构建会被包含到所有的发布版本中,请一定要阅读[[#Fedora 打包工作  |这些步骤]]。
 +
继续阅读[[#使用 Fedora Packager for Eclipse | 用户指南中的其他步骤]]来了解 Fedora Packager 插件提供的其他全部功能。
 +
 
 +
=== 启用上游发布监视 ===
 +
Fedora 具有可以监控您打包软件的上游发布的基础设施。
 +
* 参考[[Upstream_Release_Monitoring|上游发布监控]]了解详情。
 +
* 阅读[[Package_update_HOWTO|如何更新软件包]]来掌握如何处理软件包更新。
 +
 
 +
= 使用 Fedora Packager for Eclipse =
 +
'''Before continuing with this part, make sure you have read our''' '''[[#Initial Setup|initial setup]] instructions'''. Moreover, please make sure your [[#Configure SSH in Eclipse|FAS SSH keys are properly configured]] in Eclipse.
 +
 
 +
Most of the features of Fedora Packager for Eclipse are accessible via its context menu or keyboard short-cuts. The richest context menu is available if you [[#Importing a Fedora Git Project |imported a Fedora Git package]]. A subset of this functionality is also available for [[#Creating a Local Fedora RPM Project|Fedora RPM projects]]. The former is intended for Fedora package maintainers and the latter is useful for creating a new Fedora package, which is not yet part of the Fedora distribution.
 +
 
 +
 
 +
'''Context Menu'''
 +
 
 +
The Fedora Packager context menu should be available if you:
 +
 
 +
: 1. Right-click on a project which got imported via the [[#Importing a Fedora Git Project| Import from Fedora Git]] wizard or a smaller subset for projects created with the [[#Creating a Local Fedora RPM Project| Fedora RPM Project]] wizard.
 +
: 2. Right-click on a .spec file which is contained in a Fedora Packager project (e.g. in the Project Explorer).
 +
: 3. Right-click '''in''' the .spec file itself, while editing it.
 +
[[Image:ContextMenuFedoraPackager.png|Fedora Packager for Eclipse Context Menu]]
 +
 
 +
 
 +
'''Available Keyboard Short-Cuts'''
 +
 
 +
As of Fedora Packager 0.2 available Fedora Packager for Eclipse actions have corresponding keyboard short-cuts. All available short-cuts are shown if you press <code>CTRL+ALT+F</code>. Note that keyboard short-cuts work on the package which is associated with the currently open .spec file (with the exception of importing a new Fedora Git package, <code>CTRL+ALT+F I</code>.
 +
 
 +
[[Image:KeyboardShortcutsFedoraPackager.png|Fedora Packager for Eclipse Keyboard Short-Cuts]]
 +
 
 +
 
 +
'''Fedora Packager for Eclipse Actions'''
 +
 
 +
The following table describes all Fedora Packager for Eclipse commands in more detail.
 +
 
 +
{|
 +
! Context Menu Item !! Command Name (as shown when <code>CTRL+ALT+F</code> was pressed) !! Keyboard Short-Cut !! Description
 +
|-
 +
|style="width: 300px;"| Push Build to Koji ||style="width: 150px;"| Koji Build ||style="width: 90px;"| <code>CTRL+ALT+F K</code> || Pushes a regular build to Koji. Checks if there are unpushed changes in the local Git repository prior pushing the build. The build will create an SRPM based on what has been committed and pushed to the Fedora Git repository as well as based on the sources which have been uploaded to the lookaside cache. The target is determined based on the current branch (e.g. master, f15, etc). Once a build has been pushed and was successful, the package will get tagged and will become automatically available in the next Fedora release.
 +
|-
 +
| Perform Scratch Build || Koji Scratch Build || <code>CTRL+ALT+F X</code> || Pushes a scratch build to Koji. Very similar to the above. Checks if there are unpushed changes in the local Git repository prior pushing the build. Scratch builds won't get tagged, though.
 +
|-
 +
| Perform Scratch Build Using Local SRPM || Koji SRPM Scratch Build || <code>CTRL+ALT+F U</code> || Pushes a scratch build to Koji. Koji will use the provides SRPM for the build (i.e. it won't use anything from the Fedora Git repository or lookaside cache. As with all scratch builds, it won't get tagged.
 +
|-
 +
| Create New Bodhi Update || Bodhi Update || <code>CTRL+ALT+F B</code> || Pushes builds which are available in Koji as an update. Updates will usually get pushed to testing and will move to the stable repository. This action checks if there are unpushed changes on the current branch and may prompt for the SSH passphrase as well as for your Eclipse secure storage master password should you have requested Eclipse to store your Bodhi password on a previous update push. It will validate your FAS credentials prior presenting you with the update dialog. The list of builds will get populated with the binary RPMs which the current .spec file produces (again, the Fedora release is based on the currently checked out branch). Additional builds to get pushed as a single update may be added manually.
 +
|-
 +
| Upload This File => Add to existing sources || N/A || N/A || Uploads the currently selected file (the file on which the right-click occurred) to the lookaside cache. Appends an entry to the sources file. Only archive files should get uploaded to the lookaside cache. No text files are permitted such as .spec, .xml, .patch, etc. Add, commit and push them to the Fedora Git repository instead.
 +
|-
 +
| Upload This File => Replace existing sources || N/A || N/A || Uploads the currently selected file (the file on which the right-click occurred) to the lookaside cache. Replaces any existent content in the sources file (i.e. the uploaded file will be the only entry). Only archive files should get uploaded to the lookaside cache. No text files are permitted such as .spec, .xml, .patch, etc. Add, commit and push them to the Fedora Git repository instead.
 +
|-
 +
| Download Sources || Download || <code>CTRL+ALT+F D</code> || Downloads all files as listed in the sources file from the lookaside cache. Does not download files again if already existent in the relevant folder, unless its MD5 checksum mismatches with what's in the sources file.
 +
|-
 +
| Prepare Sources for Build || Prep Sources || <code>CTRL+ALT+F P</code> || Execute the %prep section in the .spec file. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a [[#Creating a Local Fedora RPM Project|Fedora RPM project]], since downloading from the lookaside cache is not applicable in this case.
 +
|-
 +
| Create SRPM || SRPM Build || <code>CTRL+ALT+F S</code> || Create an SRPM based on the current snapshot of the .spec file and the current Git branch one is on. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a [[#Creating a Local Fedora RPM Project|Fedora RPM project]], since downloading from the lookaside cache is not applicable in this case.
 +
|-
 +
| Build for Local Architecture || Local Build || <code>CTRL+ALT+F L</code> || Build binary RPMs based on the current snapshot of the .spec file and the current Git branch one is on. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a [[#Creating a Local Fedora RPM Project|Fedora RPM project]], since downloading from the lookaside cache is not applicable in this case.
 +
|-
 +
| Rebuild Local SRPM in Mock || Mock Build || <code>CTRL+ALT+F R</code> || Rebuild the SRPM which has to be specified by the user in a mock chroot based on the current Git branch one is on.
 +
|-
 +
| Build From Uploaded Sources in Mock || SCM Mock Build || <code>CTRL+ALT+F M</code> || Rebuild the package in a mock chroot based on the current Git branch one is on. This will only use sources as they are available in the pushed Fedora Git repository and the lookaside cache. This won't work if the machine is offline.
 +
|-
 +
|Import SRPM To Repository || SRPM Import || <code>CTRL+ALT+F O</code> || Takes an SRPM specified by the user, extracts its contents into the current branch, replaces the existing sources in the lookaside cache with the extracted source files, and stages any changes made to the Git repository.
 +
|}
 +
 
 +
 
 +
As mentioned earlier, as of Fedora Packager for Eclipse 0.2 there are two options for creating Fedora packaging projects:
 +
 
 +
: 1. Importing an existing Fedora Git project. This should be used for package maintenance.
 +
: 2. Create a new Fedora RPM project for a package not yet in Fedora
 +
 
 +
First, we'll describe how Fedora Packager for Eclipse can be used for creating a new Fedora package. This is handy if you decided to become a new package maintainer (never packaged something for Fedora before) and would like to submit a package for review. It is also useful for existing package maintainers who would like to introduce a new Fedora package. If you'd like to become a new package maintainer, the Fedora RPM Project option of Fedora Packager for Eclipse 0.2, will help you walking you through the process and will make some parts of it easier for you. For existing packager this will help expediting SRPM creation and submitting it for review.
 +
 
 +
== 创建本地 Fedora RPM 项目 ==
 +
 
 +
{{admon/warning|注意| This option should only be used if the software you'd like to package is '''not yet part of the Fedora distribution'''. If it is already part of Fedora, follow instructions [[#Importing a Fedora Git Project| here]].}}
 +
 
 +
: 1. 选择 '''New''' > '''Fedora''' > '''Fedora RPM Project''' 然后点击 '''Next''' 。
 +
: 2. 在 '''Project name''' 中输入您想要的软件包名字,然后点击 '''Next''' 。
 +
 
 +
[[Image:LocalNewProject.png|New Project]]
 +
 
 +
: 3. 选择符合您情况的选项:
 +
:: If you are an '''Existing maintainer''', select this option and click '''Next'''.
 +
:: If you are a ''New maintainer''', make sure you follow all the mentioned steps to complete your account setting. Once you are finished you can type in your '''FAS Account ID''' and click '''Next'''.
 +
 
 +
[[Image:LocalNewMaintainers.png|New Maintainers]]
 +
 
 +
:4. You can start the project in three different ways:
 +
 
 +
=====4.a. 开始一个空白项目=====
 +
: If you want to upload an existing .spec file, un-check the '''Generate a .spec file from template''' option and click '''Browse''' to upload your file.
 +
: Select your .spec file and click '''Finish'''.
 +
 
 +
[[Image:LocalPlainSpecProject.png|Plain Spec Project]]
 +
 
 +
: If you this project does not have any .spec file yet, leave the '''Generate a .spec file from template''' checked and Click '''Next'''.
 +
: Apply any necessary changes and click '''Finish'''.
 +
: Your project content and your generated specfile should look like this:
 +
 
 +
[[Image:LocalPlainPopulated.png|Plain Populated Project]]<br/><br/>
 +
 
 +
:5. At the end of creating the project, you will be asked to open the project in the '''Fedora Packager Perspective'''.
 +
Your project will be a local Git repository which has been initialized with the Specfile. The new repository will be automatically opened in the '''Git Repository View''' as part of the Fedora Packager Perspective.
 +
 
 +
=====4.b. 通过导入 SRPM 文件使用已有 .spec 文件和代码=====
 +
: If you have already an SRPM, you can upload it to your workspace and the Specfile and sources will be extracted from SRPM.
 +
 
 +
[[Image:LocalSrpmProject.png|Srpm Project]]
 +
 
 +
: Select your SRPM file and click '''Finish'''.
 +
: Your project content and your generated specfile should look like this:
 +
 
 +
[[Image:LocalSrpmPopulate.png|Srpm Populated Project]]<br/><br/>
 +
 
 +
=====4.c. 使用 RPM Stubby 创建项目=====
 +
: If you have an Eclipse-feature or Maven-Pom, you can select first option to start your project using [http://www.eclipse.org/linuxtools/projectPages/rpmstubby/ RPM Stubby]. From the drop down list:
 +
:: Select '''ECLIPSE_FEATURE''' to upload an existing ''feature.xml'' file to your project.
 +
:: Or select '''MAVEN_POM''' to upload an existing ''pom.xml'' file to your project.
 +
[[Image:LocalStubbyProject.png|Stubby Project]]
 +
 
 +
: Select your file and click '''Finish'''.
 +
: Your project content and your generated Specfile should look like this:
  
Then run the following command and simply follow the instructions provided:  
+
[[Image:LocalStubbyPopulate.png|Stubby populate]]<br/><br/>
  
<pre>
+
=====本地菜单=====
$ fedora-packager-setup
+
Now, you can use Fedora Packager's '''[[#Using_Fedora_Packager_for_Eclipse|context menu]]''' From the main Context Menu. Few commands as is shown in this screen-shot are available to the local project to enable you to [[#Building_the_Package_Locally | locally build your package]]:
</pre>
 
  
Once this is done Eclipse Fedorapackager is ready for use. Fire up Eclipse. Let's get started. Yay!
+
[[Image:LocalContextMenu.png|Local Context Menu]]<br/><br/>
  
== Importing a Fedora Git Project ==
+
== 导入一个 Fedora Git 项目  ==
  
Getting started is easy. Go to "File" => "Import" => "Git" => "Projects from Fedora Git". This will clone the desired Git repository and create necessary local branches. For convenience, the "Git Repositories" view will also open once the clone process has finished.
+
开始很简单的,使用 "File" => "Import" => "Git" => "Projects from Fedora Git"。这将克隆所指定的 Git 仓库并且创建需要的本地分支。方便期间,"Git Repositories" 视图将会在克隆进程结束后开启。
  
 
[[Image:ImportFedoraGit.png]]
 
[[Image:ImportFedoraGit.png]]
  
Here's how the Fedora Git import dialog looks like. Next, specify the package name that will then be prepared for you.
+
该图显示 Fedora Git 导入对话框的样子。下一步,指定准备打包的包名称。
  
 
[[Image:SelectPackageNameGit.png|Image:SelectPackageNameGit.png]]
 
[[Image:SelectPackageNameGit.png|Image:SelectPackageNameGit.png]]
  
Once the new project has been created something akin to the following is seen. Note the branches in the Git Repository view and "[eclipse-fedorapackager master]" right beside the project name. In this case, ''eclipse-fedorapackager'' refers to the Git repository name and ''master'' to the currently checked out branch.
+
下图显示的是新项目创建完成的样子。注意在 Git 仓库视图中的分支和项目右侧的 "[eclipse-fedorapackager master]" 标示。在这里,''eclipse-fedorapackager'' 代表 Git 仓库名,''master'' 代表当前导出的分支。
  
 
[[Image:GitProjectBranchesView.png]]
 
[[Image:GitProjectBranchesView.png]]
  
== Fedora Packaging Work ==
+
== Fedora 打包工作 ==
  
After a Fedora Git project has been created, all files required for packaging the desired release can be found in the created Eclipse project directly. For example, files for release Fedora 13 correspond to files present in the Eclipse project one switched to branch '''f13/master'''. Files in branch '''master''' correspond to '''Fedora rawhide''', the current development release of Fedora. The following is a brief description of things to consider doing while packaging up some software. Working in a different sequence works, but keep in mind that before trying a Koji build '''push your locally committed changes to the public repository'''.
+
Fedora Git 项目创建完成后,为目标发行版打包所需的所有文件都可以直接在刚刚创建的 Eclipse 项目中找到。例如,为 Fedora 13 打包所需的文件都放置在分支 '''f13/master''' 中。分支 '''master''' 对应当前的 Fedora 开发版本 '''Fedora rawhide'''。下面将简要描述下打包软件所需要注意的一系列事宜。如果不按照这个顺序去做也是可以的,但是记住一定要在尝试 Koji 构建前'''推送本地修改到公共仓库'''
  
=== Uploading Source Files Required for a Package ===
+
=== 上传需要打包的的源代码文件 ===
  
In order to upload new sources in Eclipse Fedora Packager, first download upstream sources and place the downloaded sources in the same folder as the Eclipse project. If this is done outside of Eclipse, don't forget to refresh the project afterwards (F5) so that the file actually shows up. A slick way to download sources is to use RPM editor functionality directly. See its [http://wiki.eclipse.org/Linux_Tools_Project/SpecfileEditor/User_Guide documentation] for more information on this. Once the new source file is available in the project, it can be uploaded to the lookaside cache by right-clicking on the file=> "Fedora Packager" => Upload This File => Replace/Add File. This either adds the file to the sources required to build the package or replaces the current content of the <code>sources</code> file to contain a single line with the MD5 sum of the file selected.
+
要在 Eclipse Fedora Packager 中上传新的源代码,首先下载上有的源代码并将下载好的的源代码和 Eclipse 项目放在同一个文件夹下。 如果这个步骤是在 Eclipse 之外完成的,别忘记刷新项目(F5)让文件被识别出来。另一个下载源代码的方式是直接使用 RPM 编辑器。查阅他的[http://wiki.eclipse.org/Linux_Tools_Project/SpecfileEditor/User_Guide 文档]获取更这方面的多信息。 一旦新的源代码文件在项目中就绪,就可以上传到临时缓冲区中:右键点击文件 => "Fedora Packager" => Upload This File => Replace/Add File。这样既可以添加新文件到构建软件包,亦可以替换 <code>sources</code> 中的当前内容,并包含一个当前选中文件的 MD5 校验和。
  
A valid certificate is required to upload to the lookaside cache. If it has expired, a new one can be created by issuing the following command on a terminal:
+
上传到临时缓冲区需要一个有效的证书。若是过期了,可以通过在终端执行以下命令生成一个新的:
  
 
<pre>
 
<pre>
Line 72: Line 338:
 
</pre>
 
</pre>
  
=== Downloading Source Files Required for a Package ===
+
=== 下载打包所需的源代码文件 ===
  
To download the required source files for an existing package in order to build it, right-click on the spec-file => "Fedora Packager" => Download Sources. This downloads all sources listed in the file <code>sources</code>.
+
要为已有的软件包下载构建所需要的源代码,右键点击 spec 文件 => "Fedora Packager" => Download Sources。这将下载所有列举在 <code>sources</code> 部分的源代码。
  
=== Using the Spec-File Editor ===
+
=== 使用 Spec 文件编辑器 ===
  
Eclipse Fedora Packager uses the RPM Editor and ChangeLog plug-in from the Eclipse Linux Tools project (http://www.eclipse.org/linuxtools). For instance, a new ChangeLog entry can easily be created in the spec-file by using the <CTRL>+<ALT>+C keyboard shortcut (though a good idea is to set appropriate “ChangeLog” preferences first). Using <CTRL>+<SPACE> auto-completes locally installed packages. Also, rpmlint can be run by right-clicking on the spec-file => “Run Rpmlint”. For more information have a look at the spec-file editor screencast: http://www.eclipse.org/downloads/download.php?file=/technology/linuxtools/videos/specfile-demo.ogg or at the "Specfile Editor User Guide": Help => Help Contents => Specfile Editor User Guide.
+
Eclipse Fedora Packager 使用来自 [http://www.eclipse.org/linuxtools Eclipse Linux Tools 项目] 的 RPM Editor 和 ChangeLog 插件。举例来说,一条新的更新日志可以通过快捷键 <CTRL>+<ALT>+C 轻松的插入到 spec 文件中(当然首先应该定下合理的“更新日志”要求)。使用 <CTRL>+<SPACE> 自动补全本地安装的软件包。同时,可以使用右键点击 spec文件 => “Run Rpmlint”的方式运行 rpmline。更多的内容请察看 spec 文件编辑器视频录像:http://www.eclipse.org/downloads/download.php?file=/technology/linuxtools/videos/specfile-demo.ogg 或者 "Specfile Editor User Guide"Help => Help Contents => Specfile Editor User Guide.
  
=== Committing Changes to the Local Git Repository ===
+
=== 提交更改到本地 Git 仓库 ===
  
After the spec-file, patches etc. have been added/changed, commit those changes to the repository. This is done by:
+
在添加/更改 spec 文件、补丁之后,需要将这些变化提交到仓库去。这样操作:
  
# Selecting the files to commit (alternatively select the Fedora Git project and select desired ''unstaged'' files when the commit dialog is shown)
+
# 选择需要提交的文件(或者选择 Fedora Git Project 然后在提交对话框出现时选择需要提交的 ''unstaged'' 文件)。
# Right-click, "Team" => "Commit..."
+
# 右键,选择 "Team" => "Commit..."
  
 
[[Image:GitCommit.png]]
 
[[Image:GitCommit.png]]
  
=== Switching Branches (Git Checkout) ===
+
=== 切换分支(Git 导出) ===
  
Switching branches is as easy as double-clicking on the desired local branch to be worked on. The currently checked out branch is indicated to the left of the project name. Make sure to commit, revert, or stash changes before switching to a different branch. Refer to the [http://www.kernel.org/pub/software/scm/git/docs/ Git] and [http://wiki.eclipse.org/EGit/User_Guide EGit] documentation for more information on this.
+
双击需要的本地分支就可以切换分支。当前导出的分支在右侧项目名称上有标示。在切换分支前确定已经提交、还原或者隐藏了更改。参考 [http://www.kernel.org/pub/software/scm/git/docs/ Git] [http://wiki.eclipse.org/EGit/User_Guide EGit] 文档来了解更多这方面内容。
  
=== Prepare Sources for a Local Build ===
+
=== 本地构建软件包 ===
 +
==== 为本地构建准备源代码 ====
  
Eclipse Fedora Packager will download and prepare sources by right-clicking on the spec-file => “Fedora Packager” => “Prepare Sources for Build”.
+
通过右键点击 spec 文件 => “Fedora Packager” => “Prepare Sources for Build”,Eclipse Fedora Packager 将会为本地构建下载并准备源代码。
  
 
[[Image:PrepareSourcesForBuild.png]]
 
[[Image:PrepareSourcesForBuild.png]]
  
=== Build RPM for a Local Architecture ===
+
==== 为本地架构构建 RPM ====
  
This is a great way to test if the spec-file actually builds at all. Once the RPM has been successfully built locally, it is recommended further testing be carried out on the spec-file by completing a build in a chroot'ed environment using {{{mock}}}. Both ways are supported by Eclipse Fedora Packager.
+
这是测试 spec 文件是否能成功构建的好方法。一旦本地构建成功 RPM,推荐使用 {{{mock}}} 在 chroot 环境中测试构建。这两种方式 Eclipse Fedora Packager 都支持。
  
The RPM can be built locally by selecting the spec-file => right-click => “Fedora Packager” => “Build for Local Architecture”. Output of the RPM build will appear on the Eclipse console.
+
要进行本地构建 RPM 操作,右键点击 spec 文件 => “Fedora Packager” => “Build for Local Architecture”。RPM 构建的结果将在 Eclipse 控制台显示。
  
Using mock-builds is a great way to test the “Requires/BuildRequires” of a spec-file. Select the spec-file => right-click => “Fedora Packager” => “Local Build Using Mock”. Be aware that this may take a long time (>20 minutes) and requires the mock package to be installed. Use Eclipse's “Run in Background” functionality for convenience.
+
使用 mock-builds 是一个测试 spec 文件 “Requires/BuildRequires” 部分的好方法。右键点击 spec 文件 => “Fedora Packager” => “Local Build Using Mock”. 注意这将需要更长的时间(一般超过20分钟)并且需要安装 mock 软件包。方便期间,可以使用 Eclipse “Run in Background” 功能。
  
=== Make Locally Committed Changes Public (Git Push) ===
+
=== 公开本地提交的更改(Git 推送) ===
  
The changes are ready to be pushed (or published) publicly when the locally committed changes are satisfying. Remember, Git allows history to be rewritten before changes are made public. See the [http://www.kernel.org/pub/software/scm/git/docs/ Git] and [http://wiki.eclipse.org/EGit/User_Guide EGit] documentation for more information. To bring the local repository in sync with ''origin'':
+
如果对于本地提交的变化满意的话,就可以准备将这些变化公开(发布)。 Remember, Git allows history to be rewritten before changes are made public. 参考  [http://www.kernel.org/pub/software/scm/git/docs/ Git] [http://wiki.eclipse.org/EGit/User_Guide EGit] 文档获得更多信息。要让本地仓库和 ''origin'' 同步:
  
# Select the Fedora Git project
+
# 选择 Fedora Git project
# Right-click, "Team" => "Push..."
+
# 右击, "Team" => "Push..."
# Select the Git repository to be pushed to (usually this is kept unchanged)
+
# 选择要推送的 Git 仓库(通常这将保持不变)
# Select the Git references to be pushed
+
# 选择要推送的 Git 引用
# Carry out the push operation
+
# 执行推送操作
  
The Git push dialog.
+
Git 推送对话框。
  
 
[[Image:GitPushDialog.png|Git push dialog]]
 
[[Image:GitPushDialog.png|Git push dialog]]
  
Select the Git references to push. In this example, branches ''master'' and ''f14/master'' will get pushed. Keep in mind that source and destination references are the same for Eclipse Fedora Packager. Clicking the “Add all branches spec” button is a convenience that pushes all commits to all local branches.
+
选择要推送的 Git 引用。在本例中,将推送分支 ''master'' ''f14/master''。 记住对于 Eclipse Fedora Packager 来说来源地和目的地的 Git 引用是一样的。点击“Add all branches spec” 按钮将会把所有本地分支的修改全部推送。
  
 
[[Image:SelectGitReferencesToPush.png|Select Git References]]
 
[[Image:SelectGitReferencesToPush.png|Select Git References]]
  
=== Pushing a Build to Koji ===
+
=== 推送到 Koji 构建 ===
  
Once satisfied with a spec-file, upload the sources of the package, commit the changes to the local repository, and then push the local changes to the remote repository. When this is done, push a build to Koji by right-clicking the spec-file => “Fedora Packager” => “Push to Koji”.
+
如果对于 spec 文件感到满意,那么可以上传打包所需软代码、提交更改到本地仓库、推送本地更改到远程仓库。当这些都完成了之后,可以将其推送到 Koji 构建系统进行构建:右键点击 spec 文件 => “Fedora Packager” => “Push to Koji”.
  
 
[[Image:EclipseFedoraPackagerPushBuildToKoji.png]]
 
[[Image:EclipseFedoraPackagerPushBuildToKoji.png]]
  
Eclipse will pop up a message with the Koji URL to track your build. This is an example of how the message may look:
+
Eclipse 将弹出一个包含 Koji URL 窗口以便跟踪构建状态。这是一个该消息外观的例子:
  
 
[[Image:KojiBuildPopupMessage.png]]
 
[[Image:KojiBuildPopupMessage.png]]
  
This should be enough information to track the builds.
+
这里面应该已经包含了足够跟踪构建状态的信息。
 +
 
 +
=== 推送 Bohi 更新 ===
 +
 
 +
在成功构建 RPM 之后,使用 Eclipse Fedora Packager 来推送该软件包的更新。要实现此目的,右键点击 spec => "Fedora Packager" => "Bodhi Update"。使用 Eclipse Fedora Packager 创建一个 Bodhi 更新的需要的信息和使用 Bodhi 网页界面的一致。一旦正确的建立的更新,将可以在 Bodhi 更新页面上察看到更新记录。同时也可以追踪更新状态。
 +
 
 +
== Configure SSH in Eclipse ==
 +
 
 +
Before you get started with importing packages from Fedora Git, you should have your FAS SSH keys set up in Eclipse. You should do this because if Fedora Packager for Eclipse finds a <code>~/.fedora.cert</code> file, it will use an SSH based clone URL with your FAS username extracted from this certificate. Note that you'll have the option of cloning anonymously anyway.
 +
 
 +
Unfortunately, Eclipse can't use your ssh-agent. Our believe is that this is because Eclipse has to run on several platforms (not just Eclipse). Since UNIX sockets are platform dependent, this may be be reason why Eclipse can't use it.
 +
 
 +
'''Eclipse SSH Preferences'''
 +
 
 +
Press <code>CTRL+3</code>, type "SSH2" and hit return. This should bring you to the following page:
 +
 
 +
[[Image:EclipseSSHPreferences.png| Eclipse SSH2 Preference page]]
  
=== Pushing a Bohi Update ===
+
Make sure that your FAS SSH key is listed there and you can successfully unlock your key.
  
After successfully building the RPMs, use Eclipse Fedora Packager to push an update for those packages. To do so, select the spec-file => right click => "Fedora Packager" => "Bodhi Update". When creating a Bodhi update using Eclipse Fedora Packager, similar information is required as needed by the Bodhi Web interface. Once an update has successfully been created, the pushed update will be visible on the Bodhi updates website. The status of updates can also be tracked there.
+
= 反馈/错误汇报 =
  
= Feedback/Reporting Bugs =
+
如果发现了一个 Eclipse Fedora Packager 的 Bug, 请汇报至 https://fedorahosted.org/eclipse-fedorapackager/report/1 (需要 FAS 用户名)。或者,尝试在 RedHat Bugzilla 上的[https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&component=eclipse-fedorapackager&product=Fedora&classification=Fedora 这个搜索]来获得所有已知 Bug 的信息。谢谢!
  
If a bug is found in the Eclipse Fedora Packager, please feel free to open a ticket at https://fedorahosted.org/eclipse-fedorapackager/report/1 (a FAS username is required to create tickets). Alternatively, try [https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&component=eclipse-fedorapackager&product=Fedora&classification=Fedora this query] on RedHat Bugzilla in order to find already existing bugs. Thanks!
+
翻译:--[[User:Lovenemesis|Lovenemesis]] 14:16, 3 January 2012 (UTC)
  
[[Category:zh]]
+
[[Category:Zh]]
[[Category:翻译]]
+
[[Category:Zh/OS]]
 +
[[Category:Zh/Translation]]

Latest revision as of 20:47, 19 September 2016

什么是 Fedora Packager for Eclipse?

Fedora Packager for Eclipse 是一个自从 F14 开始为 Fedora 用户设计的 Eclipse 插件。它帮助 Fedora 打包者们在 Eclipse 中完成 Fedora 打包 RPM 的工作,而无须纠结于命令行中(大多数情况)。 可以将 Fedora Packager for Eclipse 认为是 fedpkg 的图形化界面,尽管实际上在后台并未使用它。

首先,安装 Fedora Packager for Eclipse:

$ pkcon install eclipse-fedorapackager

Fedora Packager for Eclipse 包含的部分功能为:

  • 方便的克隆 Fedora Git 项目
  • RPM .spec 文件编辑器,包含语法高亮、自动补全 Requires/BuildRequires 模板的包名、%changelog支持 (快捷键 <Ctrl>+<Alt>+C)等。
  • 下载源代码包以及上传新源代码包
  • 准备本地构建(仅执行 spec 文件中的 %prep 部分)
  • 按照当前 .spec 文件生成 SRPM 包
  • 执行本地构建
  • 推送至 Koji(Fedora 构建系统)
  • Mock 构建
  • 推送 Bodhi 更新
  • 创建一个本地 Fedora RPM 项目来简化新 Fedora 打包者的入门过程
  • Eclipse Git 支持(通过 EGit, 请参考 EGit 文档

升级至 Fedora Packager for Eclipse 0.2.0

旧版本的 Fedora Packager for Eclipse (0.1.12 及更早) 并未像 Fedora Packager for Eclipse 0.2 一样严格过滤上下文菜单内容的可见性。为了保证上下文菜单中正确的过滤,0.2.0 及更新版本在从 Fedora Git 导入项目时设定了一些固有状态。 这将会影响使用 Fedora Packager for Eclipse 0.1.12 及更早版本导入的项目上下文菜单不显示。注意我们的更新的版本包含了一个用于升级这些项目的小工具。需要的步骤如下:

1. 打开 Fedora Packaging 视图 Window => Open Perspective => Other.

OpenFedoraPackagingPerspective.png

2. 点击转换工具图标 (如下图所示)

Conversion Tool Icon as Shown in the Fedora Packaging Perspective

3. 在您的工作空间中选择需要升级的项目

SelectProjectsToConvert.png

4. 点击 OK 然后此时您选择的项目应该已经升级完毕了。

在以上步骤之后,Fedora Packager for Eclipse 的上下文菜单应该可以正常显示了。

如果您已经是维护者并且知道怎样为 Fedora 打包软件包的话,请 跳转到"使用 Fedora Packager for Eclipse" 章节

以维护者的身份创建新的 Fedora 软件包

如果您之前从未给 Fedora 打包过软件,该指南将指引您直到完成首次软件包的提交。 fedora package process

以新贡献者的身份创建帐号

如果您是新的软件包维护者:

在 Fedora 账户系统中创建账户

  • 第一步是在 Fedora 账户系统 (FAS) 中创建账户。
  • 点击 新账户 并填写空白处。
  • 在创建账户之后,请确定签署了 CLA (如果您点击右上角的 我的帐户 链接的话,您应该看到 CLA: CLA Done)。
  • 您同时需要上传一个RSA SSH 公钥。您需要匹配的私钥来通过 SSH 访问 Fedora 远程主机。

创建 Bugzilla 账户

红帽 bugzilla 创建账户。

  • 对于所有的 Fedora 打包工作,您在 bugzilla 账户中使用的电子邮件地址应该和在 Fedora 账户系统 中的一致。
  • 为了让您的工作和错误追踪更加简便,有一个适用于 Eclipse 的任务管理插件叫 Mylyn。您可以根据这里的指导将您的 bugizlla 账户和您 Eclipse Mylyn 插件整合起来

初始设定

对于新打包者或者在未包含所需 FAS 证书的机器上只需要执行一次。如果确认已经完成过此设置并且正常的话,可以跳过此步骤。下面的步骤解释如何为 FAS 账户 设定这些证书。

  • 首先,安装 fedora-packager RPM 包:
  pkcon install fedora-packager 

然后运行以下命令并根据提示操作:

 fedora-packager-setup 

如果您已经是维护者并且知道怎样为 Fedora 创建新软件包,请 跳过下个章节

制作软件包

打包指南

创建一个 RPM 软件包:

要开始使用 Eclipse 创建一个 RPM 软件包,完成创建 本地Fedora 打包项目用户指南中的步骤。 注意您可以使用时那面三种方式之一生成您的项目:

1. 开始一个空白项目 使用 .spec 文件模版或许现有的 .spec 文件
2. 通过导入已有 SRPM 文件提取 .spec 文件和资源到项目中。
3. 在 feature.xmlpom.xml使用 RPM Stubby

在您创建项目后,您可以通过本地上下文菜单来执行可用的 rpm 构建命令进行打包和创建 SRPM 文件。 在下一步中您需要提交您的 .spec 文件和你的 SRPM 文件去审核。

提交审核

使用 Fedora 邮件列表介绍介绍自己

当一个新的软件包维护者加入 Fedora 项目时,我们要求他/她和上游项目保持紧密联系。可以通过在devel@lists.fedoraproject.org邮件列表介绍自己的方式告知开发者您正在打包某软件。
要注册列表,请访问 devel 列表注册页面。

  • 这样子的主要目的是通过了解软件包维护者来开始构建信任的过程,并增加您审核请求被及时处理的可能性。
  • 这所有的目的是在于打破匿名性从而在项目中培养真实世界的社区。您并不需要透露任何个人秘密。目标只是在您和其他项目成员中构建一定水平上的信任。
Subject: Self Introduction 自我介绍
Body: 添加任何您认为合适的信息,包括过往经历,以及指向您提交审核请求的连接和一个简短的自我介绍。如果愿意的话也可以附上您的 GPG 公钥信息。

上传软件包

将您的 SRPM 和 .spec 文件上传到互联网某处,任意一个可以通过 URL 访问的地址即可。

  • 如果您需要主机空间,请在提交的 Ticket 中注明,之后会有人联系您并处理的。
  • 如果您已经有一个 Fedora 账户,那么您可以使用位于 <user-name>.fedorapeople.org 的空间。

样例:

   scp path/to/file.spec path/to/rpm-file.src.rpm <user-name>.fedorapeople.org:public_html 

file.specrpm-file.src.rpm 将可以使用以下 URL 访问:

   http://<user-name>.fedorapeople.org/file.spec
   http://<user-name>.fedorapeople.org/rpm-file.src.rpm

创建审核请求

在提交您的请求之前,请确保没有之前没有为同一个软件包提交的请求。
bugzilla 中填写表格。

1. 确认您将软件包名(除去版本和发布号)填入 Review Summary 区域,以及描述软件包是什么的简述。
2. 将您的软件包说明(通常,这跟您在 spec %description 中的内容是一致的。)填入Review Description 区域。
3. 获取成员许可:如果这是您首个软件包,或者是上传更新版本软件包的新维护者,请说明您需要一个许可人(您需要许可才能提交和构建您的软件包)。要获得许可,请输入在 Blocks 区域输入 FE-NEEDSPONSOR
许可并不是自动的,他或许需要您更多的参与来展现自己的确熟悉了打包指南。
获得许可的关键是使得一个具有许可等级的现有成员相信您已经理解并遵循了项目指南和流程。
更多内容请查阅这篇如何获得许可用户指南。

Bugzilla Form

4. 包含指向您 SRPM 和 .spec 文件的 URL。

Bugzilla Review

Bugzilla 反馈

  • 您应该可以通过邮件得到通知提醒。修复审核者指出的任何障碍性问题。

准备分发

如果您的软件包审核通过了,请遵循如下步骤。

请求一个新软件包 SCM

一旦软件包通过审核者批准,那么就可以请求一个 Git 模块和分支,包含位于源代码管理(SCM) 请求上的信息。

  • 需要包管理员批准的请求可以通过在 Bugzilla 标签上标注 fedora-cvs 实现。在 Bugzilla 报告中变更 fedora-cvs 标注为 "?" 表明需要管理员的关注。
  • 表明您需要包含软件包的分支名字。

Package SCM Request

Fedora Packager 导入向导

一旦 Fedora Git 仓库为您创建完成,就可以导入到 Eclipse 中。

  • 使用 File > Import > Git > Projects from Fedora Git (或者使用键盘快捷键 CTRL+ALT+F I) 并在提示窗口输入软件包名。这将克隆您所需的 Git 仓库。 参考位于 使用 Fedora Git 的用户指南来获得更多信息。
  • 为方便起见,Git Repositories view 会在克隆过程完成后打开。

Fedora Git Import

  • 这就是 Fedora Git 导入对话框的样子。下一步,指定需要为您准备的软件包名。

Select Package Name

  • 因为您将要克隆的是新的空白 Git 仓库,所以您在软件包目录只会看到 sources 文件。

更新 SCM

导入并提交软件包内容

当你导出空白 Git 模块完成后,您需要导入并提交您的软件包内容到主分支。

1. 右键点击您 Eclipse 本地 RPM 项目的 SOURCES 文件夹并选择 Copy
2. 右键点击您从 Fedora Git 克隆来的项目并选择 Paste
3. 要上传上游的源代码文件到后备缓冲区,右键点击它们,选择 Fedora Packager > Upload this File > Add to Existing Sources。这将添加文件到构建软件包所需文件的列表中。 使用 Fedora Packager > Upload this File > Replace Sources 来替换当前的 SOURCES 内容并添加一行选中文件的 MD5 校验和。更多关于后备缓冲区的信息可以在 这个文档找到。
Stop (medium size).png
注意!
不要添加上游源代码 (tar 包、zip 文件等) 到 Fedora Git 仓库。请转而使用后备缓冲区!
4. 对在 SPECS 文件夹的 .spec 文件重复步骤1-2
5. 要提交软件包内容到 Git 仓库,右键点击要提交的 SOURCE 文件和 .spec 文件 (或者选择 Fedora Git 项目并在提交对话框出现时选择需要的 unstaged 文件),选择 Team > Commit...
  • 当您初次提交时使用如下信息: "Initial import (#nnnnnn)" (nnnnnn 代表您在 Bugzilla 中的软件包审核号)。
Stop (medium size).png
注意!
Fedora Packager for Eclipse won't let you to upload your .spec file or any other patches except your sources (tar balls, zip files, etc.) to the Fedora Git repository!

构建软件包

关闭 Bugzilla Ticket

  • 如果您的软件包构建成功了,那么请将其按照NEXTRELEASE 关闭。

更新您的软件包

一旦您完成本地构建软件包,您可以遵循以下步骤来更新您的软件包:

公开本地提交的更改
推送到 Koji 构建
推送 Bohi 更新 (可选)
  • 要确保您的构建会被包含到所有的发布版本中,请一定要阅读这些步骤

继续阅读 用户指南中的其他步骤来了解 Fedora Packager 插件提供的其他全部功能。

启用上游发布监视

Fedora 具有可以监控您打包软件的上游发布的基础设施。

使用 Fedora Packager for Eclipse

Before continuing with this part, make sure you have read our initial setup instructions. Moreover, please make sure your FAS SSH keys are properly configured in Eclipse.

Most of the features of Fedora Packager for Eclipse are accessible via its context menu or keyboard short-cuts. The richest context menu is available if you imported a Fedora Git package. A subset of this functionality is also available for Fedora RPM projects. The former is intended for Fedora package maintainers and the latter is useful for creating a new Fedora package, which is not yet part of the Fedora distribution.


Context Menu

The Fedora Packager context menu should be available if you:

1. Right-click on a project which got imported via the Import from Fedora Git wizard or a smaller subset for projects created with the Fedora RPM Project wizard.
2. Right-click on a .spec file which is contained in a Fedora Packager project (e.g. in the Project Explorer).
3. Right-click in the .spec file itself, while editing it.

Fedora Packager for Eclipse Context Menu


Available Keyboard Short-Cuts

As of Fedora Packager 0.2 available Fedora Packager for Eclipse actions have corresponding keyboard short-cuts. All available short-cuts are shown if you press CTRL+ALT+F. Note that keyboard short-cuts work on the package which is associated with the currently open .spec file (with the exception of importing a new Fedora Git package, CTRL+ALT+F I.

Fedora Packager for Eclipse Keyboard Short-Cuts


Fedora Packager for Eclipse Actions

The following table describes all Fedora Packager for Eclipse commands in more detail.

Context Menu Item Command Name (as shown when CTRL+ALT+F was pressed) Keyboard Short-Cut Description
Push Build to Koji Koji Build CTRL+ALT+F K Pushes a regular build to Koji. Checks if there are unpushed changes in the local Git repository prior pushing the build. The build will create an SRPM based on what has been committed and pushed to the Fedora Git repository as well as based on the sources which have been uploaded to the lookaside cache. The target is determined based on the current branch (e.g. master, f15, etc). Once a build has been pushed and was successful, the package will get tagged and will become automatically available in the next Fedora release.
Perform Scratch Build Koji Scratch Build CTRL+ALT+F X Pushes a scratch build to Koji. Very similar to the above. Checks if there are unpushed changes in the local Git repository prior pushing the build. Scratch builds won't get tagged, though.
Perform Scratch Build Using Local SRPM Koji SRPM Scratch Build CTRL+ALT+F U Pushes a scratch build to Koji. Koji will use the provides SRPM for the build (i.e. it won't use anything from the Fedora Git repository or lookaside cache. As with all scratch builds, it won't get tagged.
Create New Bodhi Update Bodhi Update CTRL+ALT+F B Pushes builds which are available in Koji as an update. Updates will usually get pushed to testing and will move to the stable repository. This action checks if there are unpushed changes on the current branch and may prompt for the SSH passphrase as well as for your Eclipse secure storage master password should you have requested Eclipse to store your Bodhi password on a previous update push. It will validate your FAS credentials prior presenting you with the update dialog. The list of builds will get populated with the binary RPMs which the current .spec file produces (again, the Fedora release is based on the currently checked out branch). Additional builds to get pushed as a single update may be added manually.
Upload This File => Add to existing sources N/A N/A Uploads the currently selected file (the file on which the right-click occurred) to the lookaside cache. Appends an entry to the sources file. Only archive files should get uploaded to the lookaside cache. No text files are permitted such as .spec, .xml, .patch, etc. Add, commit and push them to the Fedora Git repository instead.
Upload This File => Replace existing sources N/A N/A Uploads the currently selected file (the file on which the right-click occurred) to the lookaside cache. Replaces any existent content in the sources file (i.e. the uploaded file will be the only entry). Only archive files should get uploaded to the lookaside cache. No text files are permitted such as .spec, .xml, .patch, etc. Add, commit and push them to the Fedora Git repository instead.
Download Sources Download CTRL+ALT+F D Downloads all files as listed in the sources file from the lookaside cache. Does not download files again if already existent in the relevant folder, unless its MD5 checksum mismatches with what's in the sources file.
Prepare Sources for Build Prep Sources CTRL+ALT+F P Execute the %prep section in the .spec file. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a Fedora RPM project, since downloading from the lookaside cache is not applicable in this case.
Create SRPM SRPM Build CTRL+ALT+F S Create an SRPM based on the current snapshot of the .spec file and the current Git branch one is on. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a Fedora RPM project, since downloading from the lookaside cache is not applicable in this case.
Build for Local Architecture Local Build CTRL+ALT+F L Build binary RPMs based on the current snapshot of the .spec file and the current Git branch one is on. This will download sources from the lookaside cache if sources are not yet in the containing folder. Note that this behaviour is slightly different for a Fedora RPM project, since downloading from the lookaside cache is not applicable in this case.
Rebuild Local SRPM in Mock Mock Build CTRL+ALT+F R Rebuild the SRPM which has to be specified by the user in a mock chroot based on the current Git branch one is on.
Build From Uploaded Sources in Mock SCM Mock Build CTRL+ALT+F M Rebuild the package in a mock chroot based on the current Git branch one is on. This will only use sources as they are available in the pushed Fedora Git repository and the lookaside cache. This won't work if the machine is offline.
Import SRPM To Repository SRPM Import CTRL+ALT+F O Takes an SRPM specified by the user, extracts its contents into the current branch, replaces the existing sources in the lookaside cache with the extracted source files, and stages any changes made to the Git repository.


As mentioned earlier, as of Fedora Packager for Eclipse 0.2 there are two options for creating Fedora packaging projects:

1. Importing an existing Fedora Git project. This should be used for package maintenance.
2. Create a new Fedora RPM project for a package not yet in Fedora

First, we'll describe how Fedora Packager for Eclipse can be used for creating a new Fedora package. This is handy if you decided to become a new package maintainer (never packaged something for Fedora before) and would like to submit a package for review. It is also useful for existing package maintainers who would like to introduce a new Fedora package. If you'd like to become a new package maintainer, the Fedora RPM Project option of Fedora Packager for Eclipse 0.2, will help you walking you through the process and will make some parts of it easier for you. For existing packager this will help expediting SRPM creation and submitting it for review.

创建本地 Fedora RPM 项目

Warning.png
注意
This option should only be used if the software you'd like to package is not yet part of the Fedora distribution. If it is already part of Fedora, follow instructions here.
1. 选择 New > Fedora > Fedora RPM Project 然后点击 Next
2. 在 Project name 中输入您想要的软件包名字,然后点击 Next

New Project

3. 选择符合您情况的选项:
If you are an Existing maintainer, select this option and click Next.
If you are a New maintainer', make sure you follow all the mentioned steps to complete your account setting. Once you are finished you can type in your FAS Account ID and click Next.

New Maintainers

4. You can start the project in three different ways:
4.a. 开始一个空白项目
If you want to upload an existing .spec file, un-check the Generate a .spec file from template option and click Browse to upload your file.
Select your .spec file and click Finish.

Plain Spec Project

If you this project does not have any .spec file yet, leave the Generate a .spec file from template checked and Click Next.
Apply any necessary changes and click Finish.
Your project content and your generated specfile should look like this:

Plain Populated Project

5. At the end of creating the project, you will be asked to open the project in the Fedora Packager Perspective.

Your project will be a local Git repository which has been initialized with the Specfile. The new repository will be automatically opened in the Git Repository View as part of the Fedora Packager Perspective.

4.b. 通过导入 SRPM 文件使用已有 .spec 文件和代码
If you have already an SRPM, you can upload it to your workspace and the Specfile and sources will be extracted from SRPM.

Srpm Project

Select your SRPM file and click Finish.
Your project content and your generated specfile should look like this:

Srpm Populated Project

4.c. 使用 RPM Stubby 创建项目
If you have an Eclipse-feature or Maven-Pom, you can select first option to start your project using RPM Stubby. From the drop down list:
Select ECLIPSE_FEATURE to upload an existing feature.xml file to your project.
Or select MAVEN_POM to upload an existing pom.xml file to your project.

Stubby Project

Select your file and click Finish.
Your project content and your generated Specfile should look like this:

Stubby populate

本地菜单

Now, you can use Fedora Packager's context menu From the main Context Menu. Few commands as is shown in this screen-shot are available to the local project to enable you to locally build your package:

Local Context Menu

导入一个 Fedora Git 项目

开始很简单的,使用 "File" => "Import" => "Git" => "Projects from Fedora Git"。这将克隆所指定的 Git 仓库并且创建需要的本地分支。方便期间,"Git Repositories" 视图将会在克隆进程结束后开启。

ImportFedoraGit.png

该图显示 Fedora Git 导入对话框的样子。下一步,指定准备打包的包名称。

Image:SelectPackageNameGit.png

下图显示的是新项目创建完成的样子。注意在 Git 仓库视图中的分支和项目右侧的 "[eclipse-fedorapackager master]" 标示。在这里,eclipse-fedorapackager 代表 Git 仓库名,master 代表当前导出的分支。

GitProjectBranchesView.png

Fedora 打包工作

在 Fedora Git 项目创建完成后,为目标发行版打包所需的所有文件都可以直接在刚刚创建的 Eclipse 项目中找到。例如,为 Fedora 13 打包所需的文件都放置在分支 f13/master 中。分支 master 对应当前的 Fedora 开发版本 Fedora rawhide。下面将简要描述下打包软件所需要注意的一系列事宜。如果不按照这个顺序去做也是可以的,但是记住一定要在尝试 Koji 构建前推送本地修改到公共仓库

上传需要打包的的源代码文件

要在 Eclipse Fedora Packager 中上传新的源代码,首先下载上有的源代码并将下载好的的源代码和 Eclipse 项目放在同一个文件夹下。 如果这个步骤是在 Eclipse 之外完成的,别忘记刷新项目(F5)让文件被识别出来。另一个下载源代码的方式是直接使用 RPM 编辑器。查阅他的文档获取更这方面的多信息。 一旦新的源代码文件在项目中就绪,就可以上传到临时缓冲区中:右键点击文件 => "Fedora Packager" => Upload This File => Replace/Add File。这样既可以添加新文件到构建软件包,亦可以替换 sources 中的当前内容,并包含一个当前选中文件的 MD5 校验和。

上传到临时缓冲区需要一个有效的证书。若是过期了,可以通过在终端执行以下命令生成一个新的:

$ fedora-cert -n

下载打包所需的源代码文件

要为已有的软件包下载构建所需要的源代码,右键点击 spec 文件 => "Fedora Packager" => Download Sources。这将下载所有列举在 sources 部分的源代码。

使用 Spec 文件编辑器

Eclipse Fedora Packager 使用来自 Eclipse Linux Tools 项目 的 RPM Editor 和 ChangeLog 插件。举例来说,一条新的更新日志可以通过快捷键 <CTRL>+<ALT>+C 轻松的插入到 spec 文件中(当然首先应该定下合理的“更新日志”要求)。使用 <CTRL>+<SPACE> 自动补全本地安装的软件包。同时,可以使用右键点击 spec文件 => “Run Rpmlint”的方式运行 rpmline。更多的内容请察看 spec 文件编辑器视频录像:http://www.eclipse.org/downloads/download.php?file=/technology/linuxtools/videos/specfile-demo.ogg 或者 "Specfile Editor User Guide": Help => Help Contents => Specfile Editor User Guide.

提交更改到本地 Git 仓库

在添加/更改 spec 文件、补丁之后,需要将这些变化提交到仓库去。这样操作:

  1. 选择需要提交的文件(或者选择 Fedora Git Project 然后在提交对话框出现时选择需要提交的 unstaged 文件)。
  2. 右键,选择 "Team" => "Commit..."

GitCommit.png

切换分支(Git 导出)

双击需要的本地分支就可以切换分支。当前导出的分支在右侧项目名称上有标示。在切换分支前确定已经提交、还原或者隐藏了更改。参考 GitEGit 文档来了解更多这方面内容。

本地构建软件包

为本地构建准备源代码

通过右键点击 spec 文件 => “Fedora Packager” => “Prepare Sources for Build”,Eclipse Fedora Packager 将会为本地构建下载并准备源代码。

PrepareSourcesForBuild.png

为本地架构构建 RPM

这是测试 spec 文件是否能成功构建的好方法。一旦本地构建成功 RPM,推荐使用 {{{mock}}} 在 chroot 环境中测试构建。这两种方式 Eclipse Fedora Packager 都支持。

要进行本地构建 RPM 操作,右键点击 spec 文件 => “Fedora Packager” => “Build for Local Architecture”。RPM 构建的结果将在 Eclipse 控制台显示。

使用 mock-builds 是一个测试 spec 文件 “Requires/BuildRequires” 部分的好方法。右键点击 spec 文件 => “Fedora Packager” => “Local Build Using Mock”. 注意这将需要更长的时间(一般超过20分钟)并且需要安装 mock 软件包。方便期间,可以使用 Eclipse 的 “Run in Background” 功能。

公开本地提交的更改(Git 推送)

如果对于本地提交的变化满意的话,就可以准备将这些变化公开(发布)。 Remember, Git allows history to be rewritten before changes are made public. 参考 GitEGit 文档获得更多信息。要让本地仓库和 origin 同步:

  1. 选择 Fedora Git project
  2. 右击, "Team" => "Push..."
  3. 选择要推送的 Git 仓库(通常这将保持不变)
  4. 选择要推送的 Git 引用
  5. 执行推送操作

Git 推送对话框。

Git push dialog

选择要推送的 Git 引用。在本例中,将推送分支 masterf14/master。 记住对于 Eclipse Fedora Packager 来说来源地和目的地的 Git 引用是一样的。点击“Add all branches spec” 按钮将会把所有本地分支的修改全部推送。

Select Git References

推送到 Koji 构建

如果对于 spec 文件感到满意,那么可以上传打包所需软代码、提交更改到本地仓库、推送本地更改到远程仓库。当这些都完成了之后,可以将其推送到 Koji 构建系统进行构建:右键点击 spec 文件 => “Fedora Packager” => “Push to Koji”.

EclipseFedoraPackagerPushBuildToKoji.png

Eclipse 将弹出一个包含 Koji URL 窗口以便跟踪构建状态。这是一个该消息外观的例子:

KojiBuildPopupMessage.png

这里面应该已经包含了足够跟踪构建状态的信息。

推送 Bohi 更新

在成功构建 RPM 之后,使用 Eclipse Fedora Packager 来推送该软件包的更新。要实现此目的,右键点击 spec => "Fedora Packager" => "Bodhi Update"。使用 Eclipse Fedora Packager 创建一个 Bodhi 更新的需要的信息和使用 Bodhi 网页界面的一致。一旦正确的建立的更新,将可以在 Bodhi 更新页面上察看到更新记录。同时也可以追踪更新状态。

Configure SSH in Eclipse

Before you get started with importing packages from Fedora Git, you should have your FAS SSH keys set up in Eclipse. You should do this because if Fedora Packager for Eclipse finds a ~/.fedora.cert file, it will use an SSH based clone URL with your FAS username extracted from this certificate. Note that you'll have the option of cloning anonymously anyway.

Unfortunately, Eclipse can't use your ssh-agent. Our believe is that this is because Eclipse has to run on several platforms (not just Eclipse). Since UNIX sockets are platform dependent, this may be be reason why Eclipse can't use it.

Eclipse SSH Preferences

Press CTRL+3, type "SSH2" and hit return. This should bring you to the following page:

Eclipse SSH2 Preference page

Make sure that your FAS SSH key is listed there and you can successfully unlock your key.

反馈/错误汇报

如果发现了一个 Eclipse Fedora Packager 的 Bug, 请汇报至 https://fedorahosted.org/eclipse-fedorapackager/report/1 (需要 FAS 用户名)。或者,尝试在 RedHat Bugzilla 上的这个搜索来获得所有已知 Bug 的信息。谢谢!

翻译:--Lovenemesis 14:16, 3 January 2012 (UTC)