Add support for --suffix

For compat packages.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2019-06-09 15:59:43 +02:00
parent d9b2cef72e
commit adba767c55
No known key found for this signature in database
GPG key ID: 695714BD1BBC5F4C
2 changed files with 12 additions and 2 deletions

View file

@ -239,6 +239,8 @@ def main():
help="Activate all available features")
parser.add_argument("--dynamic-buildrequires", action="store_true",
help="Use dynamic BuildRequires feature")
parser.add_argument("--suffix", action="store",
help="Package suffix")
parser.add_argument("crate", help="crates.io name\n"
"path/to/local.crate\n"
"path/to/project/",
@ -339,7 +341,15 @@ def main():
kwargs["distconf"] = conf[args.target]
spec_file = f"rust-{metadata.name}.spec"
if args.suffix is not None:
if metadata.name[-1].isdigit():
suffix = f'-{args.suffix}'
else:
suffix = args.suffix
else:
suffix = ""
kwargs["pkg_suffix"] = suffix
spec_file = f"rust-{metadata.name}{suffix}.spec"
spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs)
if args.stdout:
print(f"# {spec_file}")

View file

@ -10,7 +10,7 @@
%global real_crate {{ crate }}
{% endif %}
Name: rust-%{crate}
Name: rust-%{crate}{{ pkg_suffix }}
Version: {{ md.version }}
Release: {{ pkg_release }}
{% if md.description is none %}