9.4. Using gem2rpm to generate a spec file
You can use the gem2rpm utility to create an RPM spec file.
9.4.1. Creating an RPM spec file for a Ruby gem 링크 복사링크가 클립보드에 복사되었습니다!
You can generate an RPM spec file for a RubyGems package by using the gem2rpm utility.
Prerequisites
You have the
gem2rpmutility installed on your system:$ gem install gem2rpm
Procedure
Download a gem in its latest version and generate the RPM
specfile for this gem:$ gem2rpm --fetch <gem_name> > <gem_name>.spec-
Edit the generated
specfile to add the missing information, for example, a license and a changelog.
9.4.2. Using custom gem2rpm templates to generate a spec file 링크 복사링크가 클립보드에 복사되었습니다!
gem2rpm templates are standard Embedded Ruby (ERB) files that RPM spec files can be generated from. You can edit the template from which the RPM spec file is generated instead of editing the generated spec file.
Prerequisites
You have the
gem2rpmutility installed on your system:$ gem install gem2rpm
Procedure
Display all
gem2rpmbuilt-in templates:$ gem2rpm --templatesSelect one of the built-in templates and save it as a custom template:
$ gem2rpm -t <template> -T > rubygem-<gem_name>.spec.templateNote that for RHEL 10 Beta, the
fedora-27-rawhidetemplate is recommended.- Edit the template as needed. For more information, see gem2rpm template variables.
Generate the
specfile by using the edited template:$ gem2rpm -t rubygem-<gem_name>.spec.template <gem_name>-<latest_version>.gem > <gem_name>-GEM.spec
9.4.3. gem2rpm template variables 링크 복사링크가 클립보드에 복사되었습니다!
The following are the variables included in the gem2rpm template for RPM spec file generation.
| Variable | Explanation |
|---|---|
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
|
The |
|
|
The |