rust2rpm: fix crash in sorting of binary targets

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.
This commit is contained in:
Fabio Valentini 2022-10-31 15:26:11 +01:00
parent 08e54604ce
commit 09a496c65e
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import operator
import time
import jinja2
@ -52,6 +53,9 @@ def spec_file_render(
is_bin = len(bins) > 0
is_lib = len(libs) > 0
# sort binaries by name for consistent ordering
bins.sort(key=operator.attrgetter("name"))
kwargs = {
"generator_version": __version__,
"target": args.target,

View file

@ -124,7 +124,7 @@ Requires: {{ req }}
{% for file in doc_files %}
%doc {{ file }}
{% endfor %}
{% for bin in bins | sort %}
{% for bin in bins %}
%{_bindir}/{{ bin.name }}
{% endfor %}
{% if not only_main %}