From Fedora Project Wiki
(Redirect Package Maintainer wiki links to docs.fp.o)
 
(27 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{autolang}}
= 什么是  Fedora Packager for Eclipse? =
= 什么是  Fedora Packager for Eclipse? =


Line 11: Line 12:
* RPM .spec 文件编辑器,包含语法高亮、自动补全 Requires/BuildRequires 模板的包名、<code>%changelog</code>支持 (快捷键 <Ctrl>+<Alt>+C)等。
* RPM .spec 文件编辑器,包含语法高亮、自动补全 Requires/BuildRequires 模板的包名、<code>%changelog</code>支持 (快捷键 <Ctrl>+<Alt>+C)等。
* 下载源代码包以及上传新源代码包
* 下载源代码包以及上传新源代码包
* 准备本地编译(仅执行 spec 文件中的 %prep 部分)
* 准备本地构建(仅执行 spec 文件中的 %prep 部分)
* 按照当前 .spec 文件生成 SRPM 包
* 按照当前 .spec 文件生成 SRPM 包
* 执行本地编译
* 执行本地构建
* 推送至 Koji(Fedora 编译系统)
* 推送至 Koji(Fedora 构建系统)
* Mock 编译
* Mock 构建
* 推送 Bodhi 更新
* 推送 Bodhi 更新
* 创建一个本地 Fedora RPM 项目来简化新 Fedora 打包者的入门过程
* 创建一个本地 Fedora RPM 项目来简化新 Fedora 打包者的入门过程
Line 59: Line 60:
在 [https://bugzilla.redhat.com/createaccount.cgi 红帽 bugzilla] 创建账户。
在 [https://bugzilla.redhat.com/createaccount.cgi 红帽 bugzilla] 创建账户。
* 对于所有的 Fedora 打包工作,您在 bugzilla 账户中使用的电子邮件地址应该和在 ''Fedora 账户系统'' 中的一致。
* 对于所有的 Fedora 打包工作,您在 bugzilla 账户中使用的电子邮件地址应该和在 ''Fedora 账户系统'' 中的一致。
* 为了让您的工作和错误追踪更加简便,有一个适用于 Eclipse 的任务管理插件叫 '''Mylyn'''。您可以根据这里的指导 You can follow  these instructions on [https://fedoraproject.org/wiki/Eclipse_How_to_Maintain_Fedora_Package_User_Guide/mylyn_bugzilla 将您的 bugizlla 账户和您 Eclipse Mylyn 插件整合起来]。
* 为了让您的工作和错误追踪更加简便,有一个适用于 Eclipse 的任务管理插件叫 '''Mylyn'''。您可以根据这里的指导[[Eclipse_How_to_Maintain_Fedora_Package_User_Guide/mylyn_bugzilla|将您的 bugizlla 账户和您 Eclipse Mylyn 插件整合起来]]。


=== 初始设定 ===
=== 初始设定 ===
Line 77: Line 78:
== 制作软件包 ==
== 制作软件包 ==
=== 打包指南 ===
=== 打包指南 ===
* 如果您不知道如何创建一个 RPM 软件包的话,请参考package, refer to the tutorial at [http://fedoraproject.org/wiki/A_Short_RPM_Tutorial 简明 RPM 教程] 或者更高级及包含更多细节的[http://fedoraproject.org/wiki/How_to_create_an_RPM_package 如何创建一个软件包]。
* 如果您不知道如何创建一个 RPM 软件包的话,请参考[[A_Short_RPM_Tutorial|简明 RPM 教程]] 或者更高级及包含更多细节的[[How_to_create_an_RPM_package|如何创建一个软件包]]。
* 确定是一个新软件包。检查Check this [https://admin.fedoraproject.org/pkgdb/acls/list/ 已有软件包列表]。
* 确定是一个新软件包。检查[https://admin.fedoraproject.org/pkgdb/acls/list/ 已有软件包列表]。
* 确定软件包是合适的。阅读[http://fedoraproject.org/wiki/Packaging:Guidelines 打包指南] 和 [http://fedoraproject.org/wiki/Packaging:NamingGuidelines 打包命名指南]。
* 确定软件包是合适的。阅读[[Packaging:Guidelines|打包指南]] 和 [[Packaging:NamingGuidelines|打包命名指南]]。
* 阅读其他一些软件包的提交来更过的了解打包,并熟悉流程和需求。其中一个方式是加入[https://admin.fedoraproject.org/mailman/listinfo/package-review package-review@lists.fedoraproject.org] 邮件列表。
* 阅读其他一些软件包的提交来更过的了解打包,并熟悉流程和需求。其中一个方式是加入[https://admin.fedoraproject.org/mailman/listinfo/package-review package-review@lists.fedoraproject.org] 邮件列表。


Line 85: Line 86:
要开始使用 Eclipse 创建一个 RPM 软件包,完成[[#创建本地 _Fedora_RPM_项目|创建 本地Fedora 打包项目用户指南]]中的步骤。
要开始使用 Eclipse 创建一个 RPM 软件包,完成[[#创建本地 _Fedora_RPM_项目|创建 本地Fedora 打包项目用户指南]]中的步骤。
注意您可以使用时那面三种方式之一生成您的项目:
注意您可以使用时那面三种方式之一生成您的项目:
: 1. [[#4.a._Start_a_plain_project|Start a plain project]] using .spec file template or an existing .spec file.
: 1. [[#4.a._开始一个空白项目|开始一个空白项目]] 使用 .spec 文件模版或许现有的 .spec 文件
: 2. [[#4.b._Use_existing_.spec_file_and_sources_by_importing_SRPM_file|Extract .spec file and resources]] by importing an existing SRPM file
: 2. 通过导入已有 SRPM 文件[[#4.b._通过导入 SRPM 文件使用已有 .spec 文件和代码|提取 .spec 文件和资源]]到项目中。
to the project.
: 3. <code>feature.xml</code> <code>pom.xml</code> 中[[#4.c._使用 RPM Stubby 创建项目|使用 RPM Stubby]]。
: 3. [[#4.c._Create_project_using_Rpm_Stubby|Using RPM Stubby]] on <code>feature.xml</code> or <code>pom.xml</code>.
在您创建项目后,您可以通过[[#本地菜单|本地上下文菜单]]来执行可用的 rpm 构建命令进行打包和创建 SRPM 文件。
After you created the project, you can use rpm build commands available through the [[#Local_Menu|local context menu]] to build the package and create SRPM file.
在下一步中您需要提交您的 .spec 文件和你的 SRPM 文件去审核。
In next step you need to submit your .spec file and your SRPM file for review.


== 提交审核 ==
== 提交审核 ==
=== 使用 Fedora 邮件列表介绍介绍自己 ===
=== 使用 Fedora 邮件列表介绍介绍自己 ===


When a new package maintainer joins the Fedora Project, we request that he/she [https://fedoraproject.org/wiki/Staying_close_to_upstream_projects stays close to upstream]. Inform the developers that you are packaging the software by introducing yourself on the [https://admin.fedoraproject.org/mailman/listinfo/devel devel@lists.fedoraproject.org].<br/>
当一个新的软件包维护者加入 Fedora 项目时,我们要求他/[https://docs.fedoraproject.org/en-US/package-maintainers/Staying_Close_to_Upstream_Projects/ 和上游项目保持紧密联系]。可以通过在[https://admin.fedoraproject.org/mailman/listinfo/devel devel@lists.fedoraproject.org]邮件列表介绍自己的方式告知开发者您正在打包某软件。<br/>
To sign up for the list, visit the devel list signup page.
要注册列表,请访问 devel 列表注册页面。
* The primary purpose of this is to begin the process of building trust by learning about the package maintainer and increase the chances of your review request being processed sooner.
* 这样子的主要目的是通过了解软件包维护者来开始构建信任的过程,并增加您审核请求被及时处理的可能性。
* The purpose of all this is to break anonymity and foster real-world community within the project. You are under no obligation to reveal personal secrets. The objective is to establish a level of trust with yourself and the other members of the project.
* 这所有的目的是在于打破匿名性从而在项目中培养真实世界的社区。您并不需要透露任何个人秘密。目标只是在您和其他项目成员中构建一定水平上的信任。
: ''Subject:'' Self Introduction
: ''Subject:'' Self Introduction 自我介绍
: ''Body:'' Add any information you believe is applicable including past experience, a link to the review request you have filed and a brief description of yourself. You can also post your GPG key information if you want to.
: ''Body:'' 添加任何您认为合适的信息,包括过往经历,以及指向您提交审核请求的连接和一个简短的自我介绍。如果愿意的话也可以附上您的 GPG 公钥信息。
* Here is the information of [http://fedoraproject.org/wiki/Join_the_package_collection_maintainers#Join_the_important_Mailing_Lists possible mailing lists] for you to join. And there is also a list of [http://fedoraproject.org/wiki/Category:Packaging_SIGs special interest groups for Fedora Packaging].
* 这里有一些您[https://docs.fedoraproject.org/en-US/package-maintainers/Joining_the_Package_Maintainers/#join_the_important_mailing_lists 可能愿意加入的邮件列表]信息。以及一份  [[Category:Packaging_SIGs|Fedora 打包特别兴趣小组]]列表。


=== 上传软件包 ===
=== 上传软件包 ===
Upload your SRPM and .spec files onto the Internet somewhere. This can be anywhere accessible by a URL.
将您的 SRPM .spec 文件上传到互联网某处,任意一个可以通过 URL 访问的地址即可。
* If you need hosting space, please make a note of it in your ticket submission and someone will take care of you.
* 如果您需要主机空间,请在提交的 Ticket 中注明,之后会有人联系您并处理的。
* If you have already got a Fedora Account then you can use your storage at <code><user-name>.fedorapeople.org</code> for this.
* 如果您已经有一个 Fedora 账户,那么您可以使用位于 <code><user-name>.fedorapeople.org</code> 的空间。
 
样例:
Example:
<pre>  scp path/to/file.spec path/to/rpm-file.src.rpm <user-name>.fedorapeople.org:public_html </pre>
<pre>  scp path/to/file.spec path/to/rpm-file.src.rpm <user-name>.fedorapeople.org:public_html </pre>
<code>file.spec</code> and <code>rpm-file.src.rpm</code> will then be available via the following URLs:
<code>file.spec</code> <code>rpm-file.src.rpm</code> 将可以使用以下 URL 访问:
<pre>  http://<user-name>.fedorapeople.org/file.spec
<pre>  http://<user-name>.fedorapeople.org/file.spec
   http://<user-name>.fedorapeople.org/rpm-file.src.rpm
   http://<user-name>.fedorapeople.org/rpm-file.src.rpm
Line 116: Line 115:


=== 创建审核请求 ===
=== 创建审核请求 ===
Before submitting your request, be sure there is not a previous request for the same package.<br/>
在提交您的请求之前,请确保没有之前没有为同一个软件包提交的请求。<br/>
Fill out this form in [https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review bugzilla].
[https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review bugzilla] 中填写表格。
:1. Make sure that you put the name of the package (excluding version and release numbers) in the ''Review Summary'' field, along with a very brief summary of what the package is.
:1. 确认您将软件包名(除去版本和发布号)填入 ''Review Summary'' 区域,以及描述软件包是什么的简述。
:2. Put a description of your package (usually, this can be the same thing as what you put in the spec <code>%description</code>) in the ''Review Description'' field.
:2. 将您的软件包说明(通常,这跟您在 spec <code>%description</code> 中的内容是一致的。)填入''Review Description'' 区域。
:3- Obtain member sponsorship: If this is your first package, or you are a new maintainer who is updating a package, explain it and say that you need a sponsor (you will need sponsorship to check in and build your package).To be able to get sponsored, you should enter '''FE-NEEDSPONSOR''' into the ''Blocks'' field.
:3. 获取成员许可:如果这是您首个软件包,或者是上传更新版本软件包的新维护者,请说明您需要一个许可人(您需要许可才能提交和构建您的软件包)。要获得许可,请输入在 ''Blocks'' 区域输入 '''FE-NEEDSPONSOR'''
:: Sponsorship is not automatic and may require that you further participate in other ways in order to demonstrate your understanding of the packaging guidelines.
:: 许可并不是自动的,他或许需要您更多的参与来展现自己的确熟悉了打包指南。
:: Key to becoming sponsored is to convince an existing sponsor-level member that you understand and follow the project's guidelines and processes.
:: 获得许可的关键是使得一个具有许可等级的现有成员相信您已经理解并遵循了项目指南和流程。
:: For more information check this [https://fedoraproject.org/wiki/How_to_get_sponsored_into_the_packager_group How to get sponsored] user guide.
:: 更多内容请查阅这篇[https://docs.fedoraproject.org/en-US/package-maintainers/How_to_Get_Sponsored_into_the_Packager_Group/ 如何获得许可]用户指南。


[[Image:BugzillaForm.png|Bugzilla Form]]
[[Image:BugzillaForm.png|Bugzilla Form]]


:3. Include the URLs to your SRPM and .spec files.
:4. 包含指向您 SRPM .spec 文件的 URL。


[[Image:BugzillaReview.png|Bugzilla Review]]
[[Image:BugzillaReview.png|Bugzilla Review]]


=== Bugzilla 反馈 ===
=== Bugzilla 反馈 ===
* You should get notifications of changes by email. Fix any blockers that the reviewer(s) point out.
* 您应该可以通过邮件得到通知提醒。修复审核者指出的任何障碍性问题。


== 准备分发 ==
== 准备分发 ==
Follow these steps after your package is approved by reviewers.
如果您的软件包审核通过了,请遵循如下步骤。
=== 请求一个新软件包 SCM ===
=== 请求一个新软件包 SCM ===
When the package is approved by the reviewer, request a git module and branches with the info on [http://fedoraproject.org/wiki/Package_SCM_admin_requests Source Code Management(SCM) admin requests].
一旦软件包通过审核者批准,那么就可以请求一个 Git 模块和分支,包含位于[[Package_SCM_admin_requests|源代码管理(SCM) 请求]]上的信息。
* Requests that require package administrators approval may be requested through the fedora-cvs flag in Bugzilla tickets. Changing the fedora-cvs flag to '''"?"''' in a Bugzilla report means admin attention is needed.
* 需要包管理员批准的请求可以通过在 Bugzilla 标签上标注 fedora-cvs 实现。在 Bugzilla 报告中变更 fedora-cvs 标注为 '''"?"''' 表明需要管理员的关注。
* Mention the name of the branches you need your package to be included in.
* 表明您需要包含软件包的分支名字。


[[Image:PackageSCMRequest.png|Package SCM Request]]
[[Image:PackageSCMRequest.png|Package SCM Request]]


=== Fedora Packager 导入向导  ===
=== Fedora Packager 导入向导  ===
Once the Fedora Git repository has been created for you, you can import it in Eclipse.
一旦 Fedora Git 仓库为您创建完成,就可以导入到  Eclipse 中。


Go to '''File''' > '''Import''' > '''Git''' > '''Projects from Fedora Git''' (Alternatively use keyboard short-cut <code>CTRL+ALT+F I</code> and enter your package name when prompted. This will clone the desired Git repository. Refer to this user guide on [https://fedoraproject.org/wiki/Using_Fedora_GIT Using Fedora Git] for more information.
使用 '''File''' > '''Import''' > '''Git''' > '''Projects from Fedora Git''' (或者使用键盘快捷键 <code>CTRL+ALT+F I</code>) 并在提示窗口输入软件包名。这将克隆您所需的 Git 仓库。 参考位于 [[Using_Fedora_GIT|使用 Fedora Git]] 的用户指南来获得更多信息。
* For convenience, the ''Git Repositories view'' will also open once the clone process has finished. <br/><br/>
* 为方便起见,''Git Repositories view'' 会在克隆过程完成后打开。 <br/><br/>


[[Image:ImportFedoraGit.png|Fedora Git Import]]<br/><br/>
[[Image:ImportFedoraGit.png|Fedora Git Import]]<br/><br/>


* Here's what the Fedora Git import dialog looks like. Next, specify the package name that will then be prepared for you.<br/><br/>
* 这就是 Fedora Git 导入对话框的样子。下一步,指定需要为您准备的软件包名。<br/><br/>


[[Image:SelectPackageNameGit.png|Select Package Name]]<br/><br/>
[[Image:SelectPackageNameGit.png|Select Package Name]]<br/><br/>


* Since you are cloning your new empty git repository, you will just see the '''sources''' file in your cloned package directory.
* 因为您将要克隆的是新的空白 Git 仓库,所以您在软件包目录只会看到 '''sources''' 文件。


== Updating the SCM ==
== 更新 SCM ==
=== Importing and Committing the Package Contents ===
=== 导入并提交软件包内容 ===
After you have checked out your empty git module, you need to import and commit your package contents into the master branch.
当你导出空白 Git 模块完成后,您需要导入并提交您的软件包内容到主分支。
: 1. Right-click on your source files in the SOURCES folder of your local RPM project in Eclipse and click '''Copy'''.
: 1. 右键点击您 Eclipse 本地 RPM 项目的  SOURCES 文件夹并选择 '''Copy'''
: 2. Right-click on your cloned project from Fedora Git and click '''Paste'''.
: 2. 右键点击您从 Fedora Git 克隆来的项目并选择 '''Paste'''
: 3. To upload these upstream source files to the lookaside cache, right-click on them, select '''Fedora Packager''' > '''Upload this File''' > '''Add to Existing Sources'''. This adds the files to the list of source files required to build the package. Use '''Fedora Packager''' > '''Upload this File''' > '''Replace Sources''' in order to replace the current content of the '''sources''' file to contain a single line with the MD5 sum of the file selected. More information about the lookaside cache can be found in [https://fedoraproject.org/wiki/Package_Source_Control#Lookaside_Cache this document].
: 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|NOTE!| Do not add upstream sources (tar balls, zip files, etc.) to the Fedora Git repository. Use the lookaside cache instead!}}
{{admon/caution|注意!| 不要添加上游源代码 (tar 包、zip 文件等) Fedora Git 仓库。请转而使用后备缓冲区!}}
: 4. Repeat steps <b>1-2</b> for your .spec file in SPECS folder.
: 4. 对在 SPECS 文件夹的 .spec 文件重复步骤<b>1-2</b>
: 5. To commit the package contents to the git repository, select the '''source''' file and the '''.spec''' file to commit (alternatively select the Fedora Git project and select desired ''unstaged'' files when the commit dialog is shown), right-click, '''Team''' > '''Commit...'''
: 5. 要提交软件包内容到 Git 仓库,右键点击要提交的 '''SOURCE''' 文件和 '''.spec''' 文件 (或者选择 Fedora Git 项目并在提交对话框出现时选择需要的 ''unstaged'' 文件),选择 '''Team''' > '''Commit...'''
* Use this message for your initial commit: "<code>Initial import (#nnnnnn)</code>" (where nnnnnn is your Bugzilla package review bug number).
* 当您初次提交时使用如下信息: "<code>Initial import (#nnnnnn)</code>" (nnnnnn 代表您在 Bugzilla 中的软件包审核号)
{{admon/caution|NOTE!| 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!}}
{{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!}}


=== Building the Package ===
=== 构建软件包 ===
* Now you can [[#Building the Package Locally| build your package locally]] using Fedora Packager's features.
* 现在您可以使用 Fedora Packager 的功能来[[#本地构建软件包| 在本地构建您的软件包]]


=== Closing the Bugzilla Ticket ===
=== 关闭 Bugzilla Ticket ===
* If your package was built successfully, you should close it as '''NEXTRELEASE'''.
* 如果您的软件包构建成功了,那么请将其按照'''NEXTRELEASE''' 关闭。


=== Updating Your Package ===  
=== 更新您的软件包 ===  
Once you have built your package locally, you can perform the following steps to update your package:
一旦您完成本地构建软件包,您可以遵循以下步骤来更新您的软件包:
: [[#Make Locally Committed Changes Public .28Git Push.29 | Make locally committed changes public]]
: [[#公开本地提交的更改(Git 推送)  | 公开本地提交的更改]]
: [[#Pushing a Build to Koji | Push the build to Koji]]
: [[#推送到 Koji 构建  | 推送到 Koji 构建]]
: [[#Pushing a Bodhi Update | Push a Bodhi update]] (optional)
: [[#推送 Bohi 更新 | 推送 Bohi 更新]] (可选)
* To be able to include your builds in all releases, make sure to read [[#Fedora Packaging Work |these instructions]].
* 要确保您的构建会被包含到所有的发布版本中,请一定要阅读[[#Fedora 打包工作  |这些步骤]]
Continue with [[#Using Fedora Packager for Eclipse | next steps in this user-guide]] to be able to use all available features of Fedora Packager plug-in.
继续阅读[[#使用 Fedora Packager for Eclipse | 用户指南中的其他步骤]]来了解 Fedora Packager 插件提供的其他全部功能。


=== Enabling Upstream Release Monitoring ===
=== 启用上游发布监视 ===
Fedora has infrastructure available for monitoring new upstream releases of the software you are packaging.
Fedora 具有可以监控您打包软件的上游发布的基础设施。
* Refer to [http://fedoraproject.org/wiki/Upstream_Release_Monitoring Upstream Release Monitoring] for more details.
* 参考[https://docs.fedoraproject.org/en-US/package-maintainers/Upstream_Release_Monitoring/ 上游发布监控]了解详情。
* Learn to handle updates by reading the [http://fedoraproject.org/wiki/Package_update_HOWTO Package update HOWTO].
* 阅读[https://docs.fedoraproject.org/en-US/package-maintainers/Package_Update_Guide/ 如何更新软件包]来掌握如何处理软件包更新。


= 使用 Fedora Packager for Eclipse =
= 使用 Fedora Packager for Eclipse =
Line 253: Line 252:
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.
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.


== Creating a Local Fedora RPM Project ==
== 创建本地 Fedora RPM 项目 ==


{{admon/warning|Note| 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]].}}
{{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. Select '''New''' > '''Fedora''' > '''Fedora RPM Project''' and click '''Next'''.
: 1. 选择 '''New''' > '''Fedora''' > '''Fedora RPM Project''' 然后点击 '''Next'''
: 2. Type the name of your desired package name in '''Project name''' and click '''Next'''.
: 2. '''Project name''' 中输入您想要的软件包名字,然后点击 '''Next'''


[[Image:LocalNewProject.png|New Project]]
[[Image:LocalNewProject.png|New Project]]


: 3. Select the option that matches you:
: 3. 选择符合您情况的选项:
:: If you are an '''Existing maintainer''', select this option and click '''Next'''.
:: 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'''.  
:: 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'''.  
Line 270: Line 269:
:4. You can start the project in three different ways:
:4. You can start the project in three different ways:


=====4.a. Start a plain project=====
=====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.
: 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'''.  
: Select your .spec file and click '''Finish'''.  
Line 285: Line 284:
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.
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. Use existing .spec file and sources by importing SRPM file=====
=====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.  
: If you have already an SRPM, you can upload it to your workspace and the Specfile and sources will be extracted from SRPM.  


Line 295: Line 294:
[[Image:LocalSrpmPopulate.png|Srpm Populated Project]]<br/><br/>
[[Image:LocalSrpmPopulate.png|Srpm Populated Project]]<br/><br/>


=====4.c. Create project using Rpm Stubby=====
=====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:
: 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.
:: Select '''ECLIPSE_FEATURE''' to upload an existing ''feature.xml'' file to your project.
Line 306: Line 305:
[[Image:LocalStubbyPopulate.png|Stubby populate]]<br/><br/>
[[Image:LocalStubbyPopulate.png|Stubby populate]]<br/><br/>


=====Local Menu=====
=====本地菜单=====
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]]:
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]]:


Line 327: Line 326:
== Fedora 打包工作 ==
== Fedora 打包工作 ==


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


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


要在 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 校验和。
要在 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 校验和。


上传到临时缓冲区需要一个有效的证书。若是过期了,可以通过在终端执行以下命令生成一个新的:  
上传到临时缓冲区需要一个有效的证书。若是过期了,可以通过在终端执行以下命令生成一个新的:  
Line 341: Line 340:
=== 下载打包所需的源代码文件 ===
=== 下载打包所需的源代码文件 ===


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


=== 使用 Spec 文件编辑器 ===
=== 使用 Spec 文件编辑器 ===
Line 360: Line 359:
双击需要的本地分支就可以切换分支。当前导出的分支在右侧项目名称上有标示。在切换分支前确定已经提交、还原或者隐藏了更改。参考 [http://www.kernel.org/pub/software/scm/git/docs/ Git] 和 [http://wiki.eclipse.org/EGit/User_Guide EGit] 文档来了解更多这方面内容。
双击需要的本地分支就可以切换分支。当前导出的分支在右侧项目名称上有标示。在切换分支前确定已经提交、还原或者隐藏了更改。参考 [http://www.kernel.org/pub/software/scm/git/docs/ Git] 和 [http://wiki.eclipse.org/EGit/User_Guide EGit] 文档来了解更多这方面内容。


=== 本地编译软件包 ===
=== 本地构建软件包 ===
==== 为本地编译准备源代码 ====
==== 为本地构建准备源代码 ====


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


[[Image:PrepareSourcesForBuild.png]]
[[Image:PrepareSourcesForBuild.png]]


==== 为本地架构编译 RPM ====
==== 为本地架构构建 RPM ====


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


要进行本地编译 RPM 操作,右键点击 spec 文件 => “Fedora Packager” => “Build for Local Architecture”。RPM 编译的结果将在 Eclipse 控制台显示。
要进行本地构建 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” 功能。
使用 mock-builds 是一个测试 spec 文件 “Requires/BuildRequires” 部分的好方法。右键点击 spec 文件 => “Fedora Packager” => “Local Build Using Mock”. 注意这将需要更长的时间(一般超过20分钟)并且需要安装 mock 软件包。方便期间,可以使用 Eclipse 的 “Run in Background” 功能。
Line 393: Line 392:
[[Image:SelectGitReferencesToPush.png|Select Git References]]
[[Image:SelectGitReferencesToPush.png|Select Git References]]


=== 推送编译到 Koji ===
=== 推送到 Koji 构建 ===


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


[[Image:EclipseFedoraPackagerPushBuildToKoji.png]]
[[Image:EclipseFedoraPackagerPushBuildToKoji.png]]


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


[[Image:KojiBuildPopupMessage.png]]
[[Image:KojiBuildPopupMessage.png]]


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


=== 推送 Bohi 更新 ===
=== 推送 Bohi 更新 ===


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


== Configure SSH in Eclipse ==
== Configure SSH in Eclipse ==
Line 427: Line 426:
如果发现了一个 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 的信息。谢谢!
如果发现了一个 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 的信息。谢谢!


翻译:--[[User:Lovenemesis|Lovenemesis]] 16:16, 27 October 2010 (UTC)
翻译:--[[User:Lovenemesis|Lovenemesis]] 14:16, 3 January 2012 (UTC)


[[Category:Zh]]
[[Category:Zh]]
[[Category:Zh/OS]]
[[Category:Zh/OS]]
[[Category:Zh/Translation]]
[[Category:Zh/Translation]]

Latest revision as of 19:27, 2 October 2021

什么是 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.

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

Conversion Tool Icon as Shown in the Fedora Packaging Perspective

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

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 校验和。更多关于后备缓冲区的信息可以在 这个文档找到。
注意!
不要添加上游源代码 (tar 包、zip 文件等) 到 Fedora Git 仓库。请转而使用后备缓冲区!
4. 对在 SPECS 文件夹的 .spec 文件重复步骤1-2
5. 要提交软件包内容到 Git 仓库,右键点击要提交的 SOURCE 文件和 .spec 文件 (或者选择 Fedora Git 项目并在提交对话框出现时选择需要的 unstaged 文件),选择 Team > Commit...
  • 当您初次提交时使用如下信息: "Initial import (#nnnnnn)" (nnnnnn 代表您在 Bugzilla 中的软件包审核号)。
注意!
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 项目

注意
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" 视图将会在克隆进程结束后开启。

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

Image:SelectPackageNameGit.png

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

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..."

切换分支(Git 导出)

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

本地构建软件包

为本地构建准备源代码

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

为本地架构构建 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”.

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

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

推送 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)