Some cfg-expressions evaluated to "False" because all target_arch
checks were evaluated as "True", but that broke in situations where
the cfg-expression checked for the *absence* of a match for a specific
target_arch.
With this change, cfg-expressions are now evaluated once for every
supported target_arch, and they evaluate to "True" if the expression
evaluated to "True" for *any* value of target_arch.
The "sort" Jinja2 filter doesn't work because the bins are objects,
not strings. This commit changes the sorting to happen correctly,
before binary targets are passed to the template for rendering.
Dependencies listed as "testrequires" are handled the same as dependencies
that are listed as "buildrequires", except that they are wrapped in an
"%if %{with check}" conditional in the generated spec file.
This situation can occur in two ways:
- either the crate has published only pre-releases so far, or
- all previously published stable releases were yanked
Previous to this change, if there were no manual changes, the automatically
generated patch would not affect the calculated metadata, and result in
broken .spec files.
The logic in the cfg-expression evaluator checked *too many cases*,
some of which would have resulted in generation of broken patches
and packages. We need to ensure that the evaluation is independent
of the host architecture (i.e. we need to keep *all* dependencies
that are valid on *any* of our build targets, even if they end up
being unused on *some* of them).
When the automatic patching step was implemented, the metadata started
being read from the original Cargo.toml file instead of from the one
with manually applied changes.
Recent changes (in particular, use of the new "structural pattern
matching" syntax, which was introduced in Python 3.10) were already
incompatible with Python <3.10, but neither the tox settings nor
the project metadata had been updated to reflect this fact.
Fedora 35, the oldest currently supported branch of Fedora, already
ships with Python 3.10 by default, so we don't drop support for any
current Fedora releases.
This is slightly undefined, but it's more user-friendly to treat e.g. VISUAL=
the same as $VISUAL being unset. So to use e.g. RUST2RPM_NO_DETECT_PACKAGER,
"RUST2RPM_NO_DETECT_PACKAGER=1" must be used, and "RUST2RPM_NO_DETECT_PACKAGER="
is not enough.