1RUST2RPM(1)                        rust2rpm                        RUST2RPM(1)
2
3
4

NAME

6       rust2rpm - generate RPM spec files for Rust crates and projects
7

SYNOPSIS

9       rust2rpm [OPTION]... [crate] [version]
10

DESCRIPTION

12       rust2rpm is a tool for automatically generating RPM spec files for Rust
13       crates and projects built with cargo. Its primary target is Fedora
14       Linux, with support for other target distributions being provided on a
15       best-effort basis.
16
17       Some aspects of its behaviour can be controlled with command-line
18       options, and some settings can be stored permanently in
19       package-specific configuration files (c.f. rust2rpm.toml(5)), which are
20       read if they are found in the current working directory.
21
22       When packaging Rust crates that provide a library interface, it is
23       required to re-generate the spec file for every new version to ensure
24       the exact correspondence between crate "features" (including implicit
25       features for optional dependencies) and RPM subpackages is maintained.
26       If this is not the case, the resulting RPM package will either fail to
27       build, have incomplete or wrong metadata (i.e. Provides or Requires),
28       or fail to install due to unresolvable dependencies.
29

POSITIONAL ARGUMENTS

31       crate
32           This argument accepts three different kinds of identifiers for
33           projects:
34
35Name of the crate on crates.io
36
37           •   Path to a local .crate file
38
39           •   Path to a local project directory
40
41       If the argument is the name of a crate, rust2rpm downloads the
42       specified crate from crates.io and generates a spec file for a Rust
43       crate (including -devel subpackages, if applicable).
44
45       If the argument is a path to a .crate file or a local directory,
46       rust2rpm generates a spec file for non-crate cargo projects (no -devel
47       subpackages).
48
49       If this argument is not passed, the crate argument is "guessed" based
50       on two heuristics (the value of the %crate RPM macro if there is a
51       valid "rust-$crate.spec" file in the current directory, or the name of
52       the current working directory if it matches "rust-$crate").
53
54       version
55           This argument accepts two kinds of version identifiers:
56
57Version of the crate on crates.io
58
59Partial version / SemVer version requirement
60
61       If the version argument is a valid version according to SemVer,
62       rust2rpm generates a spec file for the specified version (if there is a
63       matching version published for the crate on crates.io).
64
65       If the version argument is a valid SemVer requirement instead, rust2rpm
66       queries crates.io for all versions that are available for the current
67       crate, and generates a spec file for the greatest version that matches
68       the specified requirement.
69
70       If the argument does not parse as either a valid version or a valid
71       version requirement, an error is raised.
72
73       If this argument is not passed, rust2rpm will default to the greatest
74       available stable version of the crate on crates.io. Pre-release
75       versions need to be explicitly specified.
76

OPTIONS

78   Options affecting command behaviour
79       -s, --store-crate
80           Store the .crate file downloaded from crates.io in the current
81           directory (not applicable if the crate argument points to a local
82           file or directory). If this option is not passed, crates are only
83           stored in rust2rpm’s cache directory ($HOME/.cache/rust2rpm/).
84
85       -p, --patch
86           Open Cargo.toml in the default editor to apply changes and generate
87           a patch file before loading project metadata from this file. This
88           is the only supported way to patch Cargo.toml, since many changes
89           to this file affect the content of the generated spec file.
90
91       -V, --vendor
92           Create a vendor tarball with cargo vendor and generate a spec file
93           that builds against dependencies from the vendor tarball instead of
94           packaged Rust crates. Both automatic and manually written patches
95           (--patch option) are taken into account. Using this option disables
96           generation of devel subpackages when packaging crates.
97
98       --compat
99           Generate a spec file for an alternative version of a crate,
100           applying a version suffix automatically derived from the crate
101           version to the package name. This is the recommended way to create
102           "compat" packages, since it will generate packages that follow the
103           guidelines for package names when packaging multiple versions of
104           the same project. For versions past 1.0, the suffix is the <major>
105           version, for versions between 0.1 and 1.0, the suffix is <0.minor>,
106           and for versions before 0.1 the suffix is <0.0.patch>, according to
107           the SemVer API stability guarantees as implemented in cargo.
108
109       --no-existence-check
110           Do not check whether the package already exists in Fedora dist-git.
111           The default setting is enabled on Fedora but disabled for other
112           targets. This first checks whether the dist-git repository exists,
113           and if it exists, whether there is a spec file in the current
114           rawhide branch (so retired packages also count as "non-existent").
115
116       --no-patch-foreign
117           Do not automatically strip non-applicable target-specific
118           dependencies from Cargo.toml. This option can be used if the
119           implementation for stripping these dependencies results in broken
120           metadata. Please file bug reports for cases like this (including
121           the name and version of the affected crate).
122
123       -t, --target={plain,fedora,mageia,opensuse}
124           Write spec file tailored to the specified distribution target. The
125           default value is determined by the contents of os-release(5).
126
127       -i, --interactive
128           Enable interactive mode (only applicable when rust2rpm is called
129           for a cargo "workspace" project). This is only required when the
130           "main" crate within a cargo workspace cannot be determined with
131           heuristics.
132
133   Options affecting spec file generation
134       -a, --rpmautospec, --no-rpmautospec
135           Explicitly enable or disable use of rpmautospec. The default
136           setting is enabled on Fedora but disabled for other targets - the
137           Target Support section has more information about the differences
138           between supported targets.
139
140       --no-auto-changelog-entry
141           Do not include a generic %changelog entry in the generated spec
142           file. By default, this is enabled on all targets. Passing this
143           option will result in more easily diffable spec files.
144
145       --relative-license-paths
146           Use relative paths when listing license files in the %files section
147           of the generated spec file. Causes a copy of the license files to
148           be installed in the default license directory. This is disabled by
149           default on all targets.
150
151   Deprecated options
152       -, --stdout
153           Write generated spec and patch files to stdout instead of writing
154           to files. NOTE: The output written by rust2rpm when using this
155           option is hard to parse when more than one file is written.
156
157       --suffix=SUFFIX
158           Generate a spec file for an alternative version of a crate,
159           applying the specified version suffix to the package name. This
160           option has been superseded by the --compat flag.
161
162       --all-features
163           Generate a spec file where the -a / --all-features flag will be
164           passed to all calls of cargo. It is recommended to set this
165           permanently in a package-specific rust2rpm.toml(5) configuration
166           file instead.
167
168       --show-license-map
169           Print the mapping between SPDX license identifiers and Fedora /
170           Callaway identifiers that’s used internally for "translating" crate
171           licenses from SPDX instead of generating a spec file.
172           SPDX identifiers are now used for the License tag on all targets
173           except mageia.
174
175       --translate-license
176           Parse the crate argument as a license expression, and print the
177           result of translating it from SPDX into Fedora / Callaway notations
178           instead of generating a spec file.
179           SPDX identifiers are now used for the License tag on all targets
180           except mageia.
181

TARGET SUPPORT

183       While the primary supported target is Fedora Linux, rust2rpm also has
184       best-effort support for generating spec files that should work on other
185       distributions (Mageia, OpenSUSE, and other generic RPM-based Linux with
186       the "plain" target).
187
188   Fedora
189       The "fedora" target enables all features that are supported by
190       rust2rpm, but which often require the latest versions of rust-packaging
191       (i.e. cargo-rpm-macros) and / or cargo2rpm.
192
193       •   set Release and %changelog for use with rpmautospec
194
195       •   rely on RPM generators for setting BuildRequires, Requires, and
196           Provides
197
198       •   do not set Group tag (no longer used in Fedora)
199
200   Mageia
201       •   hard-code BuildRequires in the generated spec file
202
203       •   rely on RPM generators for setting package Requires and Provides
204
205       •   generate a manual changelog entry in the format expected on Mageia
206
207       •   set Group tag to "Development/Rust"
208
209   OpenSUSE
210       •   hard-code BuildRequires in the generated spec file
211
212       •   rely on RPM generators for setting package Requires and Provides
213
214       •   include spec file header as exepcted for OpenSUSE packages
215
216       •   generate a manual changelog entry in the format expected on
217           OpenSUSE
218
219       •   set Group tag to "Development/Libraries/Rust"
220
221   Plain
222       The "plain" target has more limited requirements, and should procude
223       working packages for environments without RPM generators for Rust
224       crates:
225
226       •   hard-code BuildRequires, Requires, and Provides in the generated
227           spec file
228
229       •   generate a manual changelog entry in the generic format supported
230           by RPM
231

HOMEPAGE

233       https://pagure.io/fedora-rust/rust2rpm
234

SEE ALSO

236       rust2rpm.toml(5), rust2rpm.conf(5)
237
238
239
240rust2rpm                          2023-12-08                       RUST2RPM(1)
Impressum