From Fedora Project Wiki

What is Fedora Packager for Eclipse?

Fedora Packager for Eclipse is a plug-in for Eclipse that has been available for Fedora users since F14. It helps Fedora packagers who are used to IDEs (such as Eclipse IDE), to package their Fedora RPMs from within Eclipse without needing to resort to the command line. (at least for the most part :-) ).
First, install fedora packager for eclipse:

   yum install eclipse-fedorapackager

Some features included in the Fedora Packager for Eclipse are:

  • Conveniently clone Fedora Git projects
  • RPM .spec file editor with syntax highlighting, auto-completion of package names for Requires/BuildRequires templates, %changelog support (Ctrl+Alt+c keyboard shortcut), etc.
  • Download source files and upload new source files
  • Prepare local builds (execute %prep section of your .spec file only)
  • Create source RPMs based on current .spec file
  • Perform local builds
  • Push builds to Koji (the Fedora build system)
  • Mock builds
  • Push Bodhi updates
  • Eclipse Git support (via EGit, please refer to EGit documentation)


Feel free to skip the next section if you are an existing maintainer and also know how to create a new software for Fedora.

Getting Started as Maintainer for a New Fedora Package

If you haven't previously packaged software for Fedora, this guide will lead you through your first package submission. fedora package process

Creating Account for New Contributors

If you are a new package maintainer:

Creating a new account in Fedora Account System

  • First step is to create account in Fedora Account System (FAS).
  • Click New account and fill in the blanks.
  • After you create your account, please be sure to sign the CLA (if you click on the My Account link in the top right, you should see CLA: CLA Done).
  • Also you need to upload a public RSA SSH key. You need to use the matching private key to access Fedora machines via SSH.

Creating a Bugzilla Account

Create an account in Red Hat bugzilla.

  • The email address that you use for your bugzilla account should be the same email address as you use in the Fedora Account System for all things related to fedora packaging.
  • To make you work and your bug tracking easier, there is a task management plug-in for eclipse called Mylyn. You can follow these instructions on how to integrate your bugizlla account with your mylyn plug-in in eclipse.

Initial Setup

This step is only required to be completed once for a new Fedora packager or if using a new machine that does not have the required FAS certificates set up. When it is certain this is correct it is safe to skip this step. The following explains how to set up those certificates for an FAS account.

  • First, install the fedora-packager RPM package:
   yum install fedora-packager 
  • Then run the following command and follow the instructions provided:
   fedora-packager-setup 

Feel free to skip the next section if you are an existing maintainer and also know how to create a new software for Fedora.

Making a Package

Packaging Guidlines

Creating an RPM package:

To start with creating an RPM package using Eclipse, perform the steps in creating Local Fedora Packager Project of the user guide. Note that you can populate your project using one of these three options:

1. Using RPM Stubby on feature.xml or pom.xml.

Submiting For Review

Introduce Yourself Using Fedora Mailing Lists

When a new package maintainer joins the Fedora Project, we request that he/she stays close to upstream. Inform the developers that you are packaging the software by introducing yourself on the devel@lists.fedoraproject.org.
To sign up for the list, visit the devel list signup page.

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

Uploading the Package

Upload your SRPM and .spec files onto the Internet somewhere. This can be anywhere accessible by a URL.

  • If you need hosting space, please make a note of it in your ticket submission and someone will take care of you.
  • If you have already got a Fedora Account then you can use your storage at <user-name>.fedorapeople.org for this.

Example:

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

file.spec and rpm-file.src.rpm will then be available via the following URLs:

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

Creating Review Request

Before submitting your request, be sure there is not a previous request for the same package.
Fill out this form in 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.
2. Put a description of your package (usually, this can be the same thing as what you put in the spec %description) in the Review Description field.
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.
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 How to get sponsored user guide.

Bugzilla Form

3. Include the URLs to your SRPM and .spec files.

Bugzilla Review

Bugzilla feedback

  • You should get notifications of changes by email. Fix any blockers that the reviewer(s) point out.

Ready to Ship

Follow these steps after your package is approved by reviewers.

Requesting a new package SCM

When the package is approved by the reviewer, request a git module and branches with the info on Source Code Management(SCM) admin requests.

  • 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.
  • Mention the name of the branches you need your package to be included in.

Package SCM Request

Checking Out the Empty Module from SCM

Once you have the git module, clone your module from git.

  • Go to File > Import > Git > Projects from Fedora Git and enter your package name when prompted. This will clone the desired Git repository. Refer to this user guide on Using Fedora Git for more information.
  • For convenience, the Git Repositories view will also open once the clone process has finished.

Fedora Git Import

  • Here's what the Fedora Git import dialog looks like. Next, specify the package name that will then be prepared for you.

Select Package Name

  • Since you are cloning your new empty git repository, you will just see the sources file in your cloned package directory.

Updating the 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.

1. Right-click on your source files in the SOURCES folder of your local RPM project in Eclipse and click Copy.
2. Right-click on your cloned project from Fedora Git and click 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 this document.
NOTE!
Do not add upstream sources (tar balls, zip files, etc.) to the Fedora Git repository. Use the lookaside cache instead!
4. Repeat steps 1-2 for your .spec file in SPECS folder.
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...
  • Use this message for your initial commit: "Initial import (#nnnnnn)" (where nnnnnn is your Bugzilla package review bug number).
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!

Building the Package

Closing the Bugzilla Ticket

  • If your package was built successfully, you should close it as 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
Push the build to Koji
Push a Bodhi update (optional)

Continue with next steps in this user-guide to be able to use all available features of Fedora Packager plug-in.

Enabling Upstream Release Monitoring

Fedora has infrastructure available for monitoring new upstream releases of the software you are packaging.

Using Fedora Packager for Eclipse

Now that you are a maintainer, this part will give you the information you need in order to update a package using all features of Fedora Packager for Eclipse. Before continuing on this part, make sure you have done the initial setup.
Since Fedora 14, the Git version control system for keeping track of files required for Fedora packaging is used. See the dist-git documentation for in depth information about dist-git. Fortunately, how dist-git works when using the Fedora Packager for Eclipse plug-in is unimportant. There is only a slightly different approach for doing packaging work compared to what might have been used with CVS instead of Git.

As of Fedora Packager for Eclipse 0.2 there are two options for creating a Fedora packaging project.

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

We'll describe how Fedora Packager for Eclipse can be used for creating a new package (which is not in Fedora, yet) first.

Creating a Local Fedora RPM Project

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 here.
1. Select New > Fedora > Fedora RPM Project and click Next.
2. Type the name of your desired package name in Project name and click Next.

New Project Wizard

3. Select the option that matches you:
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 Maintainer

4. You can start the project in three different ways:
4.a. Create project using 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 Feature

4.b. Use existing Specfile and sources by importing SourceRpm file
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 file and click Finish.
Your project content and your generated specfile should look like this:

Stubby Feature

Importing a Fedora Git Project

Getting started is easy:

1. Select Import > Git > Projects from Fedora Git and click Next.
2. Type the name of the package in Package name.
You can find screenshots of these steps in Checking Out the Empty Module from SCM in this user guide.
3. Once the new project has been created something akin to the following is seen.
In this case, eclipse-fedorapackager refers to the Git repository name and master to the currently checked out branch.

Git Branch View

Fedora Packaging Work

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, once switched to branch f13. Files in branch master correspond to Fedora rawhide, the current development release of Fedora. All the development should be done in this branch and once it's done you can checkout to another desired branch and rebase that branches on top of master. Then push them together to the upstream.
The following is a brief description of things to consider doing while packaging up some software.

Uploading Source Files Required for a Package

  • In order to upload new sources in Fedora Packager for Eclipse, 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 Specfile Editor functionality directly.
  • Once the new source file is available in the project, it can be uploaded to the lookaside cache by right-clicking on your file, Fedora Packager > Upload This File > Replace/Add Existing Sources. This either adds the file to the sources required to build the package or replaces the current content of the sources file to contain a single line with the MD5 sum of the file selected.
  • 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 in a terminal:
    $ fedora-cert -n

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 and select Fedora Packager > Download Sources. This downloads all sources listed in the file sources.

Using the Specfile Editor

Fedora Packager for Eclipse uses the RPM Specfile Editor and ChangeLog plug-in from the Eclipse Linux Tools project.
For instance, a new ChangeLog Entry can easily be created in the .spec file by using the Ctrl+Alt+c keyboard shortcut or by clicking Edit > ChangeLog Entry (though a good idea is to set appropriate ChangeLog Preferences first). Also, rpmlint can be run by right-clicking on the .spec file and selecting Run Rpmlint.
For more information have a look at the .spec file editor screen-cast, or at the Specfile Editor User Guide.

Committing Changes on the Local Git Working Directory

After the .spec file, patches, etc. have been added/changed, commit those changes to the repository. This is done by:

  1. Selecting the files to commit (alternatively select the Fedora Git project and select desired unstaged files when the commit dialog is shown)
  2. Right-click, Team > Commit...

Git Commit

Switching Branches (Git Checkout)

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 Git and EGit documentation for more information on this.

Building the Package Locally

Preparing Sources for Build

Fedora Packager for Eclipse will download and prepare sources for building a package.

  • Select your .spec file, right-click, Fedora Packager > Prepare Sources for Build.

Prepare Sources for Build

Building RPM for a Local Architecture

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 environment using mock. Both ways are supported by Fedora Packager for Eclipse.

  • To build the RPM locally right-click on the .spec file and select Fedora Packager > Build for Local Architecture. Output of the RPM build process will appear in the Eclipse Console view.

Using mock to build your package is a great way to verify that you have the correct BuildRequires in a .spec file.

  • To build the RPM locally using mock, right-click on the .spec file and select Fedora Packager > Local Build Using Mock. Be aware that this may take a long time and requires the mock package to be installed. Use Eclipse's Run in Background functionality for convenience.

Make Locally Committed Changes Public (Git Push)

When you are satisfied with your locally-committed changes, you are ready to publish them publicly. Remember, if you made any mistake in your commits, Git allows history to be rewritten before changes are made public. See the Git and EGit documentation for more information.
To bring the local repository in sync with the remote repository (which is by default called origin):

1. Right-click on the Fedora Git project, click Team > Remote > Push...
2. Select the Git repository to which you would like to push (usually this is kept unchanged), click Next.

Git Push Dialog

5. 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 Fedora Packager for Eclipse.
Clicking the Add all branches spec button is a convenience way that pushes all commits to all local branches.

Select Git References

4. Carry out the push operation

Pushing a Build to Koji

  • Keep in mind that before trying a Koji build push your locally committed changes to the public repository
  • To push a build to Koji, right-click on the .spec file, select Fedora Packager > Push to Koji.



  • Eclipse will pop up a message with the Koji URL to track your build. This is an example of how the message may look:

Koji Popup Dialog

  • If you get an error, your certificate is probably expired. To create a new one, type "$fedora-cert -n" in a terminal.
  • If you click on the provided URL, a browser tab will open in Eclipse showing you the contents of the koji status page. Refresh it as you like to follow build progress.
  • You can find more information on Koji build in this page.

Pushing a Bodhi Update

If this package will be built for any version of Fedora that is already released, please submit it for inclusion in the fedora-updates repository for those versions of Fedora. For doing this:

  • Switch to the appropriate git branch on Git Repositories view.
  • Commit all your changes for this branch.
  • Right-click on your project, Fedora Packager > Create New Bodhi Update.

When creating a Bodhi update using Fedora Packager for Eclipse, similar information is required as needed by the Bodhi web interface. Once an update has successfully been created, the pushed update will be visible in the Bodhi updates website. The status of updates can also be tracked there.

Feedback/Reporting Bugs

  • If a bug is found in the Fedora Packager for Eclipse, please feel free to open a ticket at Fedora Hosted (an FAS username is required to create tickets).
  • Alternatively, try this query in Red Hat bugzilla in order to find already existing bugs. Thanks!