Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Linux Tools Project/SpecfileEditor/User Guide"

(Macros location)
(Configuring Createrepo Execution)
 
(66 intermediate revisions by the same user not shown)
Line 1: Line 1:
= '''Overview'''=
 
  
== '''Basic introduction''' ==
+
=Overview=
  
 +
The Specfile Editor Plug-in for Eclipse provides useful features to help developers manage ''<code>.spec</code>'' files. This plug-in allows users to leverage several Eclipse GUI features in editing ''<code>.spec</code>'' files, including outline/quick outline view in the editor, auto-completion, highlighting, file hyperlinks, and folding.
  
This editor provides a great number of features to make your *.spec files editing better. One of the most valued parts is the rpmlint which assist in finding the most common mistakes made in RPM spec files and also a quick way to fix some of this warnings. It also tries to provide all the nice features you have seen in JDT. Just to name a few:
+
In addition, the Specfile Editor Plug-in also integrates the <code>rpmlint</code> tool into the Eclipse interface. <code>rpmlint</code> is a command-line tool that helps developers detect common RPM package errors. The richer visualization offered by the Eclipse interface helps developers quickly detect, view, and correct mistakes reported by <code>rpmlint</code>.
  
    * Outline view and quick outline in the editor
+
RPM plugin also supports the ability to create your own repository using the <code>createrepo</code> command. <code>createrepo</code> is a command-line tool that generates an xml-based RPM metadata repository from a set of RPMs. Eclipse offers this tool bundled with the RPM plugin to allow developers to create repositories in the same environment that they create their RPMs.
    * Various auto-completions
+
    * Highlighting
+
    * Hyperlinks - both inside the file and to external resouces
+
    * Folding and etc.
+
  
== '''Start editing''' ==
+
=Installing=
  
 +
In order for the Specfile Editor Plug-in for Eclipse to work, you should have the ''<code>rpmlint</code>'' package installed.
  
Starting editing should be as simple as double click on any of the spec files in your projects or going through the File/Open File procedure and select your spec file.
+
Once the ''<code>rpmlint</code>'' package is installed, the easiest way to install the Specfile Editor plug-in for Eclipse is through the '''''Software Updates and Add-ons''''' menu. For information on how to use this menu, refer to https://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp.
  
'''Note:''' It is strongly recommended that you always have your spec file in a project inside Eclipse workspace to take the most of the editor. Rpmlint integration, some auto-completion and hyperlink are not available when you are editing external (for the workspace) file.
+
The <code>createrepo</code> package needs to be installed for the <code>createrepo</code> features to work as intended. Specfile Editor Plug-in for Eclipse will continue to work even without the <code>createrepo</code> command not installed. However, if installed, do note that a <code>yum</code> version of 3.2.23 or higher is required to use the command to its full extent.
At this stage you should see something nice looking like this:
+
  
[[Image: Specfile_generic.png]]
+
=General Usage=
  
== '''Create new spec file''' ==
+
To fully benefit from all the features offered by the Specfile Editor, ensure that your ''<code>.spec</code>'' file is part of a project inside the Eclipse workspace. <code>rpmlint</code> integration, file hyperlinks, and some auto-completion features are not available otherwise. The following screenshot provides an impression of the full interface benefits provided by the Specfile Editor plug-in:<br/>[[Image:Specfile_generic.png]]
  
 +
==Creating a New RPM project==
  
Part of the plugin is a wizard for creating new specfile. It can be invoked from the menu File/New/Other which should bring the following dialog where you can select "New specfile based on a template".
+
To create a RPM Project, user must go to File > New > Other, expand RPM and select RPM Project. In the next window, it is necessary to select the project name and the layout to be used. RPMBUILD layout means that the directory layout of BUILD, RPMS, SOURCES, SPECS and SRPMS is going to be used. FLAT layout means that all files will be kept inside the main project directory.  
  
[[Image: Specfile_new_wizard.png]]
+
It is possible to use the default file system or create a RPM project remotely. To create the remote project, user must clear the Use default location check box and select RSE or RemoteTools. The Browse button can be used to find the location of where the project is to be stored on the remote server.
  
Dialog providing options and interface for filling the data in the spec file should appear at this stage.
+
[[Image:RPM_NewProject.png]]
  
 +
==Creating a New Specfile==
  
[[Image: Specfile_new_from_template.png]]
+
The Specfile Editor plug-in provides a wizard for creating new ''<code>.spec</code>'' files. To use this wizard, navigate first to <u>File</u> > <u>New</u> > <u>Other...</u> ; then, expand the <u>RPM Wizards</u> entry to select <u>New specfile based on a template</u>.
  
Description of the fields:
+
[[Image:Specfile_new_wizard.png]]
  
    * Project: This is simply the place where generated spec file will be stored and this should be a project in this workspace. For convenience it is auto-filled with the active project when you started the wizard.
+
This will open the Specfile Creation wizard, which provides an interface for generating the basic contents of a ''<code>.spec</code>'' file.
    * Select a template: Template functionality is based on the templates provided by [https://fedorahosted.org/rpmdevtools rpmdevtools]. Check its home page or just try the provided templates to see whether they suits you. The names are clear enough to not need further explanations - perl, ruby, python, etc.
+
    * Version: The version of the software the spec file is for.
+
    * Summary: One line description of the packaged software.
+
    * Group: Drop down menu for selecting the RPM Group this package belongs to. The values in this drop down are filled from the GROUPS file which is part of the RPM documentation package. This file usually resist in a place like /usr/share/doc/rpm-*/GROUPS.
+
    * License: The license of the packaged software.
+
    * URL: The URL pointing to the home page of the packaged software.
+
    * Source0: The name of the source archive the package is builded from.
+
  
=''' Rpmlint'''=
+
[[Image:Specfile_new_from_template.png]]
  
== '''Enable rpmlint warnings''' ==
+
The Specfile Creation wizard contains the following fields:
  
  
Enabling rpmlint warnings is as easy as right clicking on the project containing the spec file to be checked by rpmlint and select "Add/Remove rpmlint warnings" from the context menu.
+
; Project
 +
: This field associates the generated ''<code>.spec</code>'' with a project in the current workspace, which ultimately specifies where the ''<code>.spec</code>'' will be saved. The '''''Select a project...''''' button allows you to select a specific project for this field with ease. By default, the Specfile Editor plug-in specifies the last active project when you invoked the Specfile Creation wizard.
  
[[Image: Specfile_enable_rpmlint.png]]
+
; Select a template
 +
: This drop-down list allows you to select a ''<code>.spec</code>'' template to use. You can install templates provided by <code>rpmdevtools</code>, which is available https://fedorahosted.org/rpmdevtools .
  
To disable rpmlint warnings just execute the same steps again.
+
; Version
 +
: This fills in the <code>Version:</code> line of the ''<code>.spec</code>'' file.
  
== '''Benefits from rpmlint integrations''' ==
+
; Summary
 +
: This fills in the <code>Summary:</code> line of the ''<code>.spec</code>'' file.
  
==='''Warnings for common mistakes'''===
+
; Group
 +
: This drop-down list allows you to select a package group to which the project belongs.
  
After rpmlint warnings are enabled new Rpmlint project builder is added to the project builders and the reported warnings/errors are showed as markers in the editor view.
+
; License
 +
: This fills in the <code>License:</code> line of the ''<code>.spec</code>'' file.
  
[[Image: Specfile_warnings_rpmlint.png]]
+
; URL
 +
: This fills in the <code>URL:</code> line of the ''<code>.spec</code>'' file, which typically specifies the public home page of the project.
  
For better integration with the Eclipse platform these warnings are also added to the Problems view.
+
; Source0
 +
: This field specifies the source archive from which the package is built.
  
[[Image: Specfile_problems_rpmlint.png]]
+
==Building RPMs==
  
==='''Fix the warnings'''===
+
To build RPMs, right-click on the RPM project or the Specfile Editor. Then, select <u>RPM</u> menu item from the context menu. You will be given a list of build options for the ''<code>.spec</code>'' file, as well as other Specfile options.
  
Part of the rpmlint integration is the ability to provide quick fixes for some of the reported warnings. While not providing quick fixes for all the fixes available in rpmlint, the number of fixes is constantly improving. If you want to see a quick fix for the most disturbing for you warning please report it [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Linux%20Distros here] against the RPM component.
+
[[Image:SpecfileEditor_rpmMenu.png]]
  
To execute some quick fix right click on the warning/error in the Problems view and select "Quick fix" or just use the shortcut Ctrl+1 with a selected warning. In the dialog that appears
 
[[Image: Specfile_rpmlint_quickfix.png]]
 
  
select the provided fix and click Finish. The changes will auto appear in the specfile editor. For comparison look at the following screenshots - Before and After.
+
====Toolbar====
[[Image: Specfile_rpmlint_fix_before.png]][[Image: Specfile_rpmlint_fix_after.png]]
+
  
='''Customizing Editor Settings'''=
+
These build options are also readily available on the toolbar menu for quicker access.
  
Spec file editor should be completely working without any tweaking of the settings but doing it you should be able to save even more time.
+
[[Image:SpecfileEditor_rpmToolbar.png]]
  
=='''Changelog settings'''==
+
==rpmlint==
  
Simple properties allowing customizing the generated ChangeLog entries (Ctrl+Alt+C).
+
To enable <code>rpmlint</code> warnings, right-click on the project containing the ''<code>.spec</code>'' file. Then, select the <u>RPM</u> menu item. Then, <u>Add/Remove rpmlint warnings</u> from the context menu. You can use this menu selection to disable <code>rpmlint</code> warnings as well.
  
[[Image: Specfile_settings_changelog.png]]
+
[[Image:Specfileeditor_rpmlint.png]]
  
'''Note:''' Be sure to set the Author name and Author email in ChangeLog plugin preferences so they get properly generated.
+
Enabling <code>rpmlint</code> warnings will add a new <code>rpmlint</code> builder to the project. This <code>rpmlint</code> builder checks the ''<code>.spec</code>'' file during each project build or clean. Afterwards, the builder displays any appropriate warnings and errors in the '''''Problems''''' pane. Each warning/error is plotted in the ''<code>.spec</code>'' file as well; clicking an <code>rpmlint</code> warning/error in the '''''Problems''''' pane will automatically place the insertion point on the corresponding section in the ''<code>.spec</code>'' file.
  
=='''Rpmlint settings'''==
+
[[Image:Specfile_problems_rpmlint.png]]
  
This page is really useful when you have rpmlint installed in place different from the default (/usr/bin). The ability to set custom rpmlint is especially useful during development of quick-fixes or rpmlint itself.
 
Another option on this page is whether warnings should be shown for space usage or for tabs usage, when they are used in a mixed mode in the spec file.
 
  
[[Image: Specfile_settings_rpmlint.png]]
+
===Quick Fixes===
  
=='''Tasks settings'''==
+
You can also directly resolve several warnings and errors through the '''''Quick Fix''''' menu. To access this menu, right-click on a warning or error from the '''''Problems''''' pane and select <u>Quick Fix</u>.
  
This page provides the ability to select the task tags to be used when searching for tasks. Task tags are looked only in comments. When a task tag is found it is added to the Tasks view and a marker in the editor is created. Task tags used by default are TODO and FIXME. Users have the power to define their own Task tags by just pressing the New button and entering the new tag (e.g. REMOVE).
+
As the name suggests, the '''''Quick Fix''''' menu provides you with quick solutions to common ''<code>.spec</code>'' file errors and problems. For example, <code>rpmlint</code> detected a <code>no-cleaning-of-buildroot</code> error in the following <code>%install</code> section from the <code>.spec</code> file:
  
[[Image: Specfile_settings_tasks.png]]
+
[[Image:Specfile_rpmlint_fix_before.png]]
  
=='''Templates settings'''==
+
If the '''''Quick Fix''''' menu can provide a solution for a particular error, it will be available in the menu. To apply it, simply select the solution (from the '''''Select a fix:''''' area) and the corresponding problem (from the '''''Problems:''''' area), then click the <u>Finish</u> button.
  
A list of predefined/generic templates to speed up creation various fragments of the specfile in the editor.
+
[[Image:Specfile_rpmlint_quickfix.png]]
Provided features match the templates functionality provided by Java editor.  
+
  
[[Image: Specfile_settings_templates.png]]
+
The following screenshot shows the revisions to the <code>%install</code> section applied by the '''''Quick Fix''''' menu:
  
The user can manipulate the list by:
+
[[Image:Specfile_rpmlint_fix_after.png]]
  
    * Adding new template
+
==Hyperlink Detection==
    * Editing existing template
+
    * Deleting existing template
+
    * Import a list of templates
+
    * Export the list of templates for future usage on another machine or for providing default templates for your team
+
  
=='''Macros settings'''==
+
A common feature in most eclipse plugins is the ability to detect hyperlinks and to provide options for the user to handle the clicking of the hyperlink.
  
Properly setting up macros locations is a crucial part for the editor to work properly. Having all the macros path configures enables the editor to properly highlight, autocomplete and showing hover for all the available macros.
+
The SpecfileEditor handles the hyperlinks, often located in the ''<code>SOURCE</code>'' and ''<code>PATCH</code>'' defines, differently than regular hyperlinks.
==='''Macros location'''===
+
  
The path used for looking for macros can be formed by either single files or a directory. When a directory is added to the path all files in it are read and macros from them added to the list of available macros.
+
As shown below you are given the options to:
  
[[Image: Specfile_settings_macros.png]]
+
* Open the hyperlink in a browser
 +
* Open the file if it exists within the project (hidden if it doesn't)
 +
* Download the file from the browser
  
==='''Macros preview'''===
+
In addition to these, if the user also happens to hover above a macro (e.g. ''<code>%{name}</code>'' or ''<code>%{version}</code>''), it would show a "Go to ..." option to jump to where the macro is defined, if located in the ''<code>.spec</code>'' file.
  
This setting controls how to present macros value in hovers in case they contain another macros in their value. To distinguish the options look at the following hovers:
+
[[Image:SpecfileEditor_hyperlinksAfter.png]]
 +
 
 +
 
 +
====Patches====
 +
Patches are also considered hyperlinks in the SpecfileEditor. Based on the link itself, patch options could show a combination of the following options:
 +
 
 +
* Open the patch file in a browser if it is a URL
 +
* Create the file if it doesn't exist (or Open it if it does)
 +
* Download the file if it is a URL
 +
 
 +
[[Image:SpecfileEditor_patchSourceImprovement.png]]
 +
 
 +
=Import src.rpm=
 +
 
 +
One of the features of the RPM  plugin is the ability to import src.rpm files into an Eclipse project. A selection has been added to the screen that is displayed when the Eclipse File > Import > Other pulldown item is selected. This allows you to quickly and easily import source RPMs into the Eclipse development environment.
 +
 
 +
==Invoking the Eclipse SRPM Import Feature==
 +
 
 +
Invoking the SRPM Import feature of Eclipse is a very simple matter. At the top of the Eclipse click on File which causes a pulldown menu to appear. From this menu click on Import. This causes the screen below to appear:
 +
 
 +
[[Image:Specfile import srpm.png]]
 +
 
 +
From this screen select Source RPM and then Next to activate the next screen shown here:
 +
 
 +
[[Image:Specfile_import_select_srpm.png]]
 +
 
 +
There are three functions that this screen must perform in order to successfully import a source RPM into Eclipse. The first thing you must do is select a source RPM to be imported using the Browse button.
 +
It is used to browse around a system to the desired source RPM. Once the desired source RPM is found, either double-click on it or single-click and then click OK. The source RPMs name should now appear in the SRPM Name window.
 +
 
 +
Next, either select the already-existing project where this source RPM will be imported or click on the "Check out as a project using the New Project Wizard" button. If you select the latter, the New project wizard pops up and guides you through the process of creating a new project.  Once the wizard is done, the import process begins automatically.  If there is a project already created you want to import into, the Select a project window contains a list of the available Eclipse projects. Scroll to the desired project and select it so it is highlighted and click on "Finish".
 +
 
 +
Now you can use all of the resources of Eclipse on this imported project just as any other project. Notice that the source RPM that was selected for import has been copied into the project.
 +
 
 +
=Configuring Specfile Editor Settings=
 +
 
 +
To configure Specfile Editor settings, navigate to <u>Window</u> / <u>Preferences</u>. Then, from the left pane of the '''''Preferences''''' menu, select '''''Specfile Editor'''''.
 +
 
 +
[[Image:Specfile_settings_changelog.png]]
 +
 
 +
Upon selecting the '''''Specfile Editor''''' menu, you can configure the format and locale of Changelog entries. To edit the actual content of your Changelogs, click the <u>ChangeLog</u> hyperlink in the menu, or use '''Ctrl'''+'''Alt'''+'''C''' (outside of the '''''Preferences''''' menu).
 +
 
 +
==Macro Completion==
 +
 
 +
Macro definitions enable the Specfile Editor to properly highlight and autocompile ''.spec'' files.  The '''''Macro Completion''''' sub-menu allows you to add/remove macro definitions and configure how the Specfile Editor should present macro values during mouse hovers.
 +
 
 +
[[Image:Specfile_settings_macros.png]]
 +
 
 +
The '''''Macro Definitions''''' section shows what macros the Specfile Editor is using. You can add, delete, and reorder macros using the buttons to the left of this section.
 +
 
 +
The '''''Mouse hover content''''' section enables you to specify what kind of information about a macro value whenever you hover your mouse over it. You can choose whether to display the contents or description of a macro value. The following screenshots illustrate the difference between both options:
 +
 
 +
; Show macro descriptions
 +
: [[Image:Specfile_macros_description.png]]
 +
; Show macro contents
 +
: [[Image:Specfile_macros_content.png]]
 +
 
 +
==RPM Completions==
 +
 
 +
The '''''RPM Completions''''' section allows you to configure generic package list settings. This section allows you to use distribution-specific references which supplement auto-completion in editing ''<code>.spec</code>'' files. These distribution-specific references include a list of installed RPM packages as well as online repositories.
 +
 
 +
[[Image:Specfile_settings_rpms_generic.png]]
 +
 
 +
'''''RPM Completions''''' configures the following settings:
 +
 
 +
* Whether to use <code>rpm</code> or <code>yum</code> to build the package list
 +
* The path to the package list file
 +
* Whether or not to automatically build the RPM packages proposals list
 +
* When to refresh package list ('''''Proposals RPM list build rate''''')
 +
 
 +
The Specfile Editor can use package management tools to build the package list. Currently, the Specfile Editor only supports <code>yum</code> and <code>urpmi</code>. If neither package management tools are present in the system, the Specfile Editor will use <code>rpm</code> to build the package list.
 +
 
 +
===Package Information===
 +
 
 +
This sub-section of '''''RPM Completions''''' allows you to configure what package details (i.e. RPM tags) to display during mouse hovers over appropriate values. '''''Package Information''''' also lets you set the number of packages to show details for.
 +
 
 +
[[Image:Specfile_settings_rpms_details.png]]
 +
 
 +
'''''Package Information''''' contains a checklist of RPM tags (e.g. '''''Name''''', '''''Version''''', '''''Release'''''). The Specfile Editor displays these tags during mouse hovers on package information in the ''<code>.spec</code>'' file. You can also set a threshold for the number of proposals that enables the Specfile Editor to display this information. By default, the threshold is 10.
 +
 
 +
==Rpmlint==
 +
 
 +
The '''''Rpmlint''''' section allows you to configure where <code>rpmlint</code> is installed, which is useful if it is installed somewhere other than the default ''<code>/usr/bin/rpmlint</code>''. This section also allows you to set whether warnings should be used for tabs or spaces, which is useful if you use both in the ''<code>.spec</code>'' file.
 +
 
 +
[[Image:Specfile_settings_rpmlint.png]]
 +
 
 +
==Task Tags==
 +
 
 +
The '''''Task Tags''''' section allows the Specfile Editor to identify specific strings as ''task tags''. The Specfile Editor will only search for these strings in comments. By default, the Specfile Editor identifies the strings <code>TODO</code> and ''<code>FIXME</code>'' as task tags.
 +
 
 +
[[Image:Specfile_settings_tasks.png]]
 +
 
 +
Whenever the Specfile Editor finds a task tag in the ''<code>.spec</code>'' file, it adds the tag to the '''''Tasks''''' view and plots an appropriate marker in the editor. Clicking the tag in the '''''Tasks''''' view will automatically place the insertion point on the corresponding string in the ''<code>.spec</code>'' file.
 +
 
 +
[[Image:Screenshot-taskscreenshot.png]]
 +
 
 +
==Templates==
 +
 
 +
The '''''Templates''''' section allows you to share and manage different ''<code>.spec</code>'' file directive/section templates for all contexts.
 +
 
 +
[[Image:Specfile_settings_templates.png]]
 +
 
 +
The <u>Import</u> and <u>Export</u> functions allow you to share templates with other developers who may also be working on the same package. The <u>New</u> and <u>Edit</u> buttons open a menu for adding or revising templates; they both contain the same options.
 +
 
 +
[[Image:Screenshot-edittemplate.png]]

Latest revision as of 07:34, 3 July 2023

Overview

The Specfile Editor Plug-in for Eclipse provides useful features to help developers manage .spec files. This plug-in allows users to leverage several Eclipse GUI features in editing .spec files, including outline/quick outline view in the editor, auto-completion, highlighting, file hyperlinks, and folding.

In addition, the Specfile Editor Plug-in also integrates the rpmlint tool into the Eclipse interface. rpmlint is a command-line tool that helps developers detect common RPM package errors. The richer visualization offered by the Eclipse interface helps developers quickly detect, view, and correct mistakes reported by rpmlint.

RPM plugin also supports the ability to create your own repository using the createrepo command. createrepo is a command-line tool that generates an xml-based RPM metadata repository from a set of RPMs. Eclipse offers this tool bundled with the RPM plugin to allow developers to create repositories in the same environment that they create their RPMs.

Installing

In order for the Specfile Editor Plug-in for Eclipse to work, you should have the rpmlint package installed.

Once the rpmlint package is installed, the easiest way to install the Specfile Editor plug-in for Eclipse is through the Software Updates and Add-ons menu. For information on how to use this menu, refer to https://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp.

The createrepo package needs to be installed for the createrepo features to work as intended. Specfile Editor Plug-in for Eclipse will continue to work even without the createrepo command not installed. However, if installed, do note that a yum version of 3.2.23 or higher is required to use the command to its full extent.

General Usage

To fully benefit from all the features offered by the Specfile Editor, ensure that your .spec file is part of a project inside the Eclipse workspace. rpmlint integration, file hyperlinks, and some auto-completion features are not available otherwise. The following screenshot provides an impression of the full interface benefits provided by the Specfile Editor plug-in:
Specfile generic.png

Creating a New RPM project

To create a RPM Project, user must go to File > New > Other, expand RPM and select RPM Project. In the next window, it is necessary to select the project name and the layout to be used. RPMBUILD layout means that the directory layout of BUILD, RPMS, SOURCES, SPECS and SRPMS is going to be used. FLAT layout means that all files will be kept inside the main project directory.

It is possible to use the default file system or create a RPM project remotely. To create the remote project, user must clear the Use default location check box and select RSE or RemoteTools. The Browse button can be used to find the location of where the project is to be stored on the remote server.

RPM NewProject.png

Creating a New Specfile

The Specfile Editor plug-in provides a wizard for creating new .spec files. To use this wizard, navigate first to File > New > Other... ; then, expand the RPM Wizards entry to select New specfile based on a template.

Specfile new wizard.png

This will open the Specfile Creation wizard, which provides an interface for generating the basic contents of a .spec file.

Specfile new from template.png

The Specfile Creation wizard contains the following fields:


Project
This field associates the generated .spec with a project in the current workspace, which ultimately specifies where the .spec will be saved. The Select a project... button allows you to select a specific project for this field with ease. By default, the Specfile Editor plug-in specifies the last active project when you invoked the Specfile Creation wizard.
Select a template
This drop-down list allows you to select a .spec template to use. You can install templates provided by rpmdevtools, which is available https://fedorahosted.org/rpmdevtools .
Version
This fills in the Version: line of the .spec file.
Summary
This fills in the Summary: line of the .spec file.
Group
This drop-down list allows you to select a package group to which the project belongs.
License
This fills in the License: line of the .spec file.
URL
This fills in the URL: line of the .spec file, which typically specifies the public home page of the project.
Source0
This field specifies the source archive from which the package is built.

Building RPMs

To build RPMs, right-click on the RPM project or the Specfile Editor. Then, select RPM menu item from the context menu. You will be given a list of build options for the .spec file, as well as other Specfile options.

SpecfileEditor rpmMenu.png


Toolbar

These build options are also readily available on the toolbar menu for quicker access.

SpecfileEditor rpmToolbar.png

rpmlint

To enable rpmlint warnings, right-click on the project containing the .spec file. Then, select the RPM menu item. Then, Add/Remove rpmlint warnings from the context menu. You can use this menu selection to disable rpmlint warnings as well.

Specfileeditor rpmlint.png

Enabling rpmlint warnings will add a new rpmlint builder to the project. This rpmlint builder checks the .spec file during each project build or clean. Afterwards, the builder displays any appropriate warnings and errors in the Problems pane. Each warning/error is plotted in the .spec file as well; clicking an rpmlint warning/error in the Problems pane will automatically place the insertion point on the corresponding section in the .spec file.

Specfile problems rpmlint.png


Quick Fixes

You can also directly resolve several warnings and errors through the Quick Fix menu. To access this menu, right-click on a warning or error from the Problems pane and select Quick Fix.

As the name suggests, the Quick Fix menu provides you with quick solutions to common .spec file errors and problems. For example, rpmlint detected a no-cleaning-of-buildroot error in the following %install section from the .spec file:

Specfile rpmlint fix before.png

If the Quick Fix menu can provide a solution for a particular error, it will be available in the menu. To apply it, simply select the solution (from the Select a fix: area) and the corresponding problem (from the Problems: area), then click the Finish button.

Specfile rpmlint quickfix.png

The following screenshot shows the revisions to the %install section applied by the Quick Fix menu:

Specfile rpmlint fix after.png

Hyperlink Detection

A common feature in most eclipse plugins is the ability to detect hyperlinks and to provide options for the user to handle the clicking of the hyperlink.

The SpecfileEditor handles the hyperlinks, often located in the SOURCE and PATCH defines, differently than regular hyperlinks.

As shown below you are given the options to:

  • Open the hyperlink in a browser
  • Open the file if it exists within the project (hidden if it doesn't)
  • Download the file from the browser

In addition to these, if the user also happens to hover above a macro (e.g. %{name} or %{version}), it would show a "Go to ..." option to jump to where the macro is defined, if located in the .spec file.

SpecfileEditor hyperlinksAfter.png


Patches

Patches are also considered hyperlinks in the SpecfileEditor. Based on the link itself, patch options could show a combination of the following options:

  • Open the patch file in a browser if it is a URL
  • Create the file if it doesn't exist (or Open it if it does)
  • Download the file if it is a URL

SpecfileEditor patchSourceImprovement.png

Import src.rpm

One of the features of the RPM plugin is the ability to import src.rpm files into an Eclipse project. A selection has been added to the screen that is displayed when the Eclipse File > Import > Other pulldown item is selected. This allows you to quickly and easily import source RPMs into the Eclipse development environment.

Invoking the Eclipse SRPM Import Feature

Invoking the SRPM Import feature of Eclipse is a very simple matter. At the top of the Eclipse click on File which causes a pulldown menu to appear. From this menu click on Import. This causes the screen below to appear:

Specfile import srpm.png

From this screen select Source RPM and then Next to activate the next screen shown here:

Specfile import select srpm.png

There are three functions that this screen must perform in order to successfully import a source RPM into Eclipse. The first thing you must do is select a source RPM to be imported using the Browse button. It is used to browse around a system to the desired source RPM. Once the desired source RPM is found, either double-click on it or single-click and then click OK. The source RPMs name should now appear in the SRPM Name window.

Next, either select the already-existing project where this source RPM will be imported or click on the "Check out as a project using the New Project Wizard" button. If you select the latter, the New project wizard pops up and guides you through the process of creating a new project. Once the wizard is done, the import process begins automatically. If there is a project already created you want to import into, the Select a project window contains a list of the available Eclipse projects. Scroll to the desired project and select it so it is highlighted and click on "Finish".

Now you can use all of the resources of Eclipse on this imported project just as any other project. Notice that the source RPM that was selected for import has been copied into the project.

Configuring Specfile Editor Settings

To configure Specfile Editor settings, navigate to Window / Preferences. Then, from the left pane of the Preferences menu, select Specfile Editor.

Specfile settings changelog.png

Upon selecting the Specfile Editor menu, you can configure the format and locale of Changelog entries. To edit the actual content of your Changelogs, click the ChangeLog hyperlink in the menu, or use Ctrl+Alt+C (outside of the Preferences menu).

Macro Completion

Macro definitions enable the Specfile Editor to properly highlight and autocompile .spec files. The Macro Completion sub-menu allows you to add/remove macro definitions and configure how the Specfile Editor should present macro values during mouse hovers.

Specfile settings macros.png

The Macro Definitions section shows what macros the Specfile Editor is using. You can add, delete, and reorder macros using the buttons to the left of this section.

The Mouse hover content section enables you to specify what kind of information about a macro value whenever you hover your mouse over it. You can choose whether to display the contents or description of a macro value. The following screenshots illustrate the difference between both options:

Show macro descriptions
Specfile macros description.png
Show macro contents
Specfile macros content.png

RPM Completions

The RPM Completions section allows you to configure generic package list settings. This section allows you to use distribution-specific references which supplement auto-completion in editing .spec files. These distribution-specific references include a list of installed RPM packages as well as online repositories.

Specfile settings rpms generic.png

RPM Completions configures the following settings:

  • Whether to use rpm or yum to build the package list
  • The path to the package list file
  • Whether or not to automatically build the RPM packages proposals list
  • When to refresh package list (Proposals RPM list build rate)

The Specfile Editor can use package management tools to build the package list. Currently, the Specfile Editor only supports yum and urpmi. If neither package management tools are present in the system, the Specfile Editor will use rpm to build the package list.

Package Information

This sub-section of RPM Completions allows you to configure what package details (i.e. RPM tags) to display during mouse hovers over appropriate values. Package Information also lets you set the number of packages to show details for.

Specfile settings rpms details.png

Package Information contains a checklist of RPM tags (e.g. Name, Version, Release). The Specfile Editor displays these tags during mouse hovers on package information in the .spec file. You can also set a threshold for the number of proposals that enables the Specfile Editor to display this information. By default, the threshold is 10.

Rpmlint

The Rpmlint section allows you to configure where rpmlint is installed, which is useful if it is installed somewhere other than the default /usr/bin/rpmlint. This section also allows you to set whether warnings should be used for tabs or spaces, which is useful if you use both in the .spec file.

Specfile settings rpmlint.png

Task Tags

The Task Tags section allows the Specfile Editor to identify specific strings as task tags. The Specfile Editor will only search for these strings in comments. By default, the Specfile Editor identifies the strings TODO and FIXME as task tags.

Specfile settings tasks.png

Whenever the Specfile Editor finds a task tag in the .spec file, it adds the tag to the Tasks view and plots an appropriate marker in the editor. Clicking the tag in the Tasks view will automatically place the insertion point on the corresponding string in the .spec file.

Screenshot-taskscreenshot.png

Templates

The Templates section allows you to share and manage different .spec file directive/section templates for all contexts.

Specfile settings templates.png

The Import and Export functions allow you to share templates with other developers who may also be working on the same package. The New and Edit buttons open a menu for adding or revising templates; they both contain the same options.

Screenshot-edittemplate.png

Back to the top